unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lynn Winebarger <owinebar@gmail.com>
To: "Mattias Engdegård" <mattiase@acm.org>
Cc: 55972@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#55972: 28.1; Package quickstart generated for large number of packages generates byte-code string larger than 64K, triggering bytecode overflow error
Date: Fri, 17 Jun 2022 16:06:01 -0400	[thread overview]
Message-ID: <CAM=F=bBtjwK7nBCuyU6YJ8kPL+u7Ta5N3Yi=3Wd2w+sZ1SLu1Q@mail.gmail.com> (raw)
In-Reply-To: <1058D1B4-9A9F-41D9-BE59-55BFA2A69A10@acm.org>

[-- Attachment #1: Type: text/plain, Size: 2142 bytes --]

On Tue, Jun 14, 2022 at 12:29 PM Mattias Engdegård <mattiase@acm.org> wrote:

> If, as seems to be the case, byte-compile-keep-pending is only used for
> top-level forms, then this patch may even be correct. Does it solve your
> problems?
> It still seems to generate far bigger bytecode chunks than the 300 cutoff
> would imply but that's perhaps just a matter of calling the function in
> more places.
>
>
Thanks, Mattias, it does work.

I was going to ask about directly addressing the underlying problem by
tail-calling
or trampolining to a byte-code vector in the constants array, but then
realized you would have to
either make sure there could be no "gotos" between the segments or do a
real trampoline to
an explicit label.  And in either case you would have to save the contents
of the stack frame
and reinstate them in the continuation byte-code call, and I don't see any
byte-codes that would
support that.   Otherwise you could only do it when you know there is no
stack in use, which is what I believe
your solution effectively does.

On the other hand, given the code for patching up byte-code in
byte-compile-lapcode, you could
explicitly byte-compile a thunk for every top-level expression, then glue
them together until they would exceed
the 65K pc limit, then do another segment, etc, and do a simple trampoline
between the resulting byte-code vectors,
or no trampoline if there were only one required.  Strictly speaking,
gluing them all together is really an optimization
of creating byte-code vectors (thunks) for each top-level expression, and
looping over the collection of them, invoking
each one in turn.

As long as I'm looking at the compile log, I also see a lot of errors of
the form:
     package-quickstart2.el:14739:39: Warning: The compiler ignores
‘autoload’ except at top level.  You should
         probably put the autoload of the macro ‘bind-map-for-minor-mode’
at top-level.
This message is only reported for macros - there are plenty of autoload
expressions that do not generate this
message despite being in the same kind of "let" form.

Lynn

[-- Attachment #2: Type: text/html, Size: 2740 bytes --]

  parent reply	other threads:[~2022-06-17 20:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14 14:51 bug#55972: 28.1; Package quickstart generated for large number of packages generates byte-code string larger than 64K, triggering bytecode overflow error Lynn Winebarger
2022-06-14 16:29 ` Mattias Engdegård
2022-06-15  9:31   ` Mattias Engdegård
2022-06-17 20:06   ` Lynn Winebarger [this message]
2022-06-17 21:27     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-18 10:45       ` Mattias Engdegård
2022-06-18 12:59         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-18 13:53           ` Mattias Engdegård
2022-06-18 14:53             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-13  1:37               ` Stefan Kangas
2023-09-13 14:52                 ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-13 14:58                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAM=F=bBtjwK7nBCuyU6YJ8kPL+u7Ta5N3Yi=3Wd2w+sZ1SLu1Q@mail.gmail.com' \
    --to=owinebar@gmail.com \
    --cc=55972@debbugs.gnu.org \
    --cc=mattiase@acm.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).