all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#64526: 30.0.50; jit-compilation and multiple function definitions
@ 2023-07-08  1:41 Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-07-10  7:44 ` Andrea Corallo
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-07-08  1:41 UTC (permalink / raw)
  To: 64526; +Cc: Andrea Corallo

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






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#64526: 30.0.50; jit-compilation and multiple function definitions
  2023-07-08  1:41 bug#64526: 30.0.50; jit-compilation and multiple function definitions Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-07-10  7:44 ` Andrea Corallo
  2023-07-10  9:38   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 4+ messages in thread
From: Andrea Corallo @ 2023-07-10  7:44 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 64526

Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#64526: 30.0.50; jit-compilation and multiple function definitions
  2023-07-10  7:44 ` Andrea Corallo
@ 2023-07-10  9:38   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-07-10 11:52     ` Andrea Corallo
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-07-10  9:38 UTC (permalink / raw)
  To: Andrea Corallo; +Cc: 64526

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






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#64526: 30.0.50; jit-compilation and multiple function definitions
  2023-07-10  9:38   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-07-10 11:52     ` Andrea Corallo
  0 siblings, 0 replies; 4+ messages in thread
From: Andrea Corallo @ 2023-07-10 11:52 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 64526

Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-10 11:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-08  1:41 bug#64526: 30.0.50; jit-compilation and multiple function definitions Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-10  7:44 ` Andrea Corallo
2023-07-10  9:38   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-10 11:52     ` Andrea Corallo

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.