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, 46617-done@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:27:30 +0000	[thread overview]
Message-ID: <xjfa6qwto1p.fsf@sdf.org> (raw)
In-Reply-To: <CAHyO48zGiJj3CPk7jSN57WoGEEbA7r1C=EJiishbwyLP_i1enA@mail.gmail.com> (Aaron Jensen's message of "Thu, 25 Feb 2021 10:09:08 -0600")

Aaron Jensen <aaronjensen@gmail.com> writes:

> On Thu, Feb 25, 2021 at 3:04 AM Andrea Corallo <akrl@sdf.org> wrote:
>>
>> Even tho I've no precise analysis on this most likely this is related to
>> the fact that I broke async compilation with 81b1013555 and fixed it
>> with 0ee1a16769.
>>
>> Right I'm closing this (we can always reopen in case).
>
> Ah, I'm afraid we have to reopen. What you describe was the reason it
> didn't repro for me this last time. It still does currently.

Hi Aaron,

I had to slightly modify your init.el reproducer as we have changed the
semantic of `load' [1].

init.el:
=========
(let ((repro
       (expand-file-name "repro.el" default-directory)))
  (defun some-fn ()
    1)
  (message "Byte and native compiling, some-fn = 1")
  (byte-compile-file repro)
  (load (native-compile repro))

  (message "Byte compiling, some-fn = 2")
  (defun some-fn ()
    2)
  (byte-compile-file repro)
  (load (concat repro "c") nil 'nomessage 'nosuffix)

  (message "Native compiling, some-fn = 2")
  (load (native-compile repro)))
=========

This is still:

- defining `some-fn'
- native compiling and loading repro.el
- re-defining `some-fn'
- byte compiling and loading repro.el
- native compiling and loading repro.el

Running ./src/emacs -Q -l init.el in the *Messages* buffer I get:

=========
Byte and native compiling, some-fn = 1
Compiling /home/andcor03/emacs2/repro.el...done
Wrote /home/andcor03/emacs2/repro.elc
Compiling /home/andcor03/emacs2/repro.el...done
Loading /home/andcor03/.emacs.d/eln-cache/28.0.50-32137a9a/repro-fd364f11-b5afb0b4.eln (native compiled elisp)...
EQUAL
Loading /home/andcor03/.emacs.d/eln-cache/28.0.50-32137a9a/repro-fd364f11-b5afb0b4.eln (native compiled elisp)...done
Byte compiling, some-fn = 2
Compiling /home/andcor03/emacs2/repro.el...done
Wrote /home/andcor03/emacs2/repro.elc
EQUAL
Native compiling, some-fn = 2
Compiling /home/andcor03/emacs2/repro.el...done
Loading /home/andcor03/.emacs.d/eln-cache/28.0.50-32137a9a/repro-fd364f11-b5afb0b4.eln (native compiled elisp)...
EQUAL
Loading /home/andcor03/.emacs.d/eln-cache/28.0.50-32137a9a/repro-fd364f11-b5afb0b4.eln (native compiled elisp)...done
=========

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 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?

Thanks

  Andrea

[1] <https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-03/msg01643.html>





  parent reply	other threads:[~2021-03-21 17:27 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 [this message]
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
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=xjfa6qwto1p.fsf@sdf.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=46617-done@debbugs.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).