unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Aaron Jensen <aaronjensen@gmail.com>
Cc: 46617@debbugs.gnu.org
Subject: bug#46617: 28.0.50; nativecomp: native compile cache is not invalidated when file is re-byte compiled and changes
Date: Sun, 21 Mar 2021 17:59:23 +0000	[thread overview]
Message-ID: <xjf1rc8tmkk.fsf@sdf.org> (raw)
In-Reply-To: <CAHyO48zX=rK4pkuZ8zaDW2HYajAgO_9uUgg+cyEHc9YW25V-Bg@mail.gmail.com> (Aaron Jensen's message of "Sun, 21 Mar 2021 12:36:39 -0500")

Aaron Jensen <aaronjensen@gmail.com> writes:

> On Sun, Mar 21, 2021 at 12:27 PM Andrea Corallo <akrl@sdf.org> wrote:
>>
>> Hi Aaron,
>>
>> I had to slightly modify your init.el reproducer as we have changed the
>> semantic of `load' [1].
>
> With this change, how do you specify that you want the eln to load if
> it's there? If I understand correctly, this prevents loading the eln
> with load unless it is specified explicitly? Or can you leave the
> extension off when loading and that will prefer the eln, then elc,
> then el?

Exactly load by default tries to add the extentions to the FILE
argument.

>> I think what happened is that in the original reproducer the second load
>> of the .elc file still automatically loaded in place the corresponding
>> .eln as the source file didn't changed.  The issue here is that in the
>> compilation unit repro.elk is capturing some of the environment and this
>> is not accounted in the hash computation of the .eln file.
>
> The original repro simulated a restart without a restart. The real bug
> (in straight.el) is that on start, it loads a byte compiled/native
> compiled file that relies on outside environment. So, that may be
> fixed now because I believe they load the elc explicitly, but that
> means it'll never load the native compiled version. Ideally, they
> would, but I don't know how to force loading byte compiled OR native
> compiled in one command.

ATM to force the byte-code version to be used one can use `load' making
the .elc extension explicit (or without using the extension binding
`load-no-native' to non-nil).

To explicitly force load the native code version one has to do like:

(load (comp-el-to-eln-filename ".../foo.el"))

But this is limited as it works only if the .eln is in the first
directory of `com-eln-load-path', so probably we have to offer a more
complete solution.

>> The new reproducer (well it does not reproduce much :) ) works because
>> now `load' called explicitly on a .elc file does not load automatically
>> the corresponding .eln.  Alternatively to overcome the issue still using
>> native compilation one has to force a new native compilation using
>> `native-compile.  WDYT?
>
> I think it sounds like straight.el will need to add detection for
> native compilation, and any time they byte compile, also native
> compile. I also think that this is extremely fragile and I wonder if
> byte compiling should result in "invalidating" (deleting) the
> previously corresponding eln. We essentially have a cache invalidation
> that is relying purely on a cache key that is incomplete.

Mmhh maybe it's a good idea.  The other option would be to re-introduce
the constrain that, to be used in place, the .eln must be younger than
the .elc.

Thanks

  Andrea





  reply	other threads:[~2021-03-21 17:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18 15:42 bug#46617: 28.0.50; nativecomp: native compile cache is not invalidated when file is re-byte compiled and changes Aaron Jensen
2021-02-25  5:48 ` Aaron Jensen
2021-02-25  9:04   ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-02-25 16:09     ` Aaron Jensen
2021-02-25 17:01       ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-21 17:27       ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-21 17:36         ` Aaron Jensen
2021-03-21 17:59           ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-03-21 20:54             ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-22  0:44               ` Aaron Jensen
2021-03-22  7:57                 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-26  7:54                   ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-28 18:24                     ` Aaron Jensen
2021-03-29  8:14                       ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-29 16:26                         ` Aaron Jensen
2021-03-31 10:22                           ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-31 16:30                             ` Aaron Jensen
2021-03-31 17:58                               ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-07 18:48                                 ` Andrea Corallo 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=xjf1rc8tmkk.fsf@sdf.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=46617@debbugs.gnu.org \
    --cc=aaronjensen@gmail.com \
    --cc=akrl@sdf.org \
    /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).