GNU bug report logs - #64526
30.0.50; jit-compilation and multiple function definitions

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Sat, 8 Jul 2023 01:43:02 UTC

Severity: normal

Found in version 30.0.50

To reply to this bug, email your comments to 64526 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to acorallo <at> gnu.org, bug-gnu-emacs <at> gnu.org:
bug#64526; Package emacs. (Sat, 08 Jul 2023 01:43:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
New bug report received and forwarded. Copy sent to acorallo <at> gnu.org, bug-gnu-emacs <at> gnu.org. (Sat, 08 Jul 2023 01:43:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; jit-compilation and multiple function definitions
Date: Fri, 07 Jul 2023 21:41:24 -0400
Package: Emacs
Version: 30.0.50


Say you have a file ~/tmp/foo.el:

    ;;  -*- lexical-binding: t; -*-
    (defun sm-foo1 (a) (list a 1))
    (defun sm-foo1 (a) (list a 2))

which you byte-compile into ~/tmp/foo.elc, and then you do:

    emacs -Q -l ~/tmp/foo
    M-: (sm-foo1 'a) RET

you'll usually get `(a 2)` (and that's what we expect).  But if you enable
native compilation and erase the `eln-cache` before trying it out you
may get `(a 1)` because when the `.eln` file is reloaded on top of the
`.elc` definitions, `comp--late-register-subr` will skip the second
definition :-(

I suspect similar problems can occur when the two definitions are placed
in different files (and those files are loaded "at the same time",
i.e. the second file is loaded before the native-compilation of the
first file finishes) since `comp-deferred-pending-h` does not pay
attention to the file names.  :-(


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64526; Package emacs. (Mon, 10 Jul 2023 07:45:01 GMT) Full text and rfc822 format available.

Message #8 received at 64526 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 64526 <at> debbugs.gnu.org
Subject: Re: bug#64526: 30.0.50; jit-compilation and multiple function
 definitions
Date: Mon, 10 Jul 2023 03:44:24 -0400
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> Package: Emacs
> Version: 30.0.50
>
>
> Say you have a file ~/tmp/foo.el:
>
>     ;;  -*- lexical-binding: t; -*-
>     (defun sm-foo1 (a) (list a 1))
>     (defun sm-foo1 (a) (list a 2))
>
> which you byte-compile into ~/tmp/foo.elc, and then you do:
>
>     emacs -Q -l ~/tmp/foo
>     M-: (sm-foo1 'a) RET
>
> you'll usually get `(a 2)` (and that's what we expect).  But if you enable
> native compilation and erase the `eln-cache` before trying it out you
> may get `(a 1)` because when the `.eln` file is reloaded on top of the
> `.elc` definitions, `comp--late-register-subr` will skip the second
> definition :-(

Hi Stefan,

are we sure about this? Is this reproducible?

Thanks

  Andrea

> I suspect similar problems can occur when the two definitions are placed
> in different files (and those files are loaded "at the same time",
> i.e. the second file is loaded before the native-compilation of the
> first file finishes) since `comp-deferred-pending-h` does not pay
> attention to the file names.  :-(
>
>
>         Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64526; Package emacs. (Mon, 10 Jul 2023 09:39:02 GMT) Full text and rfc822 format available.

Message #11 received at 64526 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Andrea Corallo <acorallo <at> gnu.org>
Cc: 64526 <at> debbugs.gnu.org
Subject: Re: bug#64526: 30.0.50; jit-compilation and multiple function
 definitions
Date: Mon, 10 Jul 2023 05:38:11 -0400
>> Package: Emacs
>> Version: 30.0.50
>>
>>
>> Say you have a file ~/tmp/foo.el:
>>
>>     ;;  -*- lexical-binding: t; -*-
>>     (defun sm-foo1 (a) (list a 1))
>>     (defun sm-foo1 (a) (list a 2))
>>
>> which you byte-compile into ~/tmp/foo.elc, and then you do:
>>
>>     emacs -Q -l ~/tmp/foo
>>     M-: (sm-foo1 'a) RET
>>
>> you'll usually get `(a 2)` (and that's what we expect).  But if you enable
>> native compilation and erase the `eln-cache` before trying it out you
>> may get `(a 1)` because when the `.eln` file is reloaded on top of the
>> `.elc` definitions, `comp--late-register-subr` will skip the second
>> definition :-(
>
> Hi Stefan,
>
> are we sure about this? Is this reproducible?

Yes, the above recipe reproduces it on my machine at least.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64526; Package emacs. (Mon, 10 Jul 2023 11:53:02 GMT) Full text and rfc822 format available.

Message #14 received at 64526 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 64526 <at> debbugs.gnu.org
Subject: Re: bug#64526: 30.0.50; jit-compilation and multiple function
 definitions
Date: Mon, 10 Jul 2023 07:52:10 -0400
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>>> Package: Emacs
>>> Version: 30.0.50
>>>
>>>
>>> Say you have a file ~/tmp/foo.el:
>>>
>>>     ;;  -*- lexical-binding: t; -*-
>>>     (defun sm-foo1 (a) (list a 1))
>>>     (defun sm-foo1 (a) (list a 2))
>>>
>>> which you byte-compile into ~/tmp/foo.elc, and then you do:
>>>
>>>     emacs -Q -l ~/tmp/foo
>>>     M-: (sm-foo1 'a) RET
>>>
>>> you'll usually get `(a 2)` (and that's what we expect).  But if you enable
>>> native compilation and erase the `eln-cache` before trying it out you
>>> may get `(a 1)` because when the `.eln` file is reloaded on top of the
>>> `.elc` definitions, `comp--late-register-subr` will skip the second
>>> definition :-(
>>
>> Hi Stefan,
>>
>> are we sure about this? Is this reproducible?
>
> Yes, the above recipe reproduces it on my machine at least.

Okay, will look at thanks.

  Andrea




This bug report was last modified 2 years and 72 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.