unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Emacs:Native-Comp Backtrace
@ 2020-08-26  0:36 T.V Raman
  2020-08-26 15:06 ` T.V Raman
  0 siblings, 1 reply; 5+ messages in thread
From: T.V Raman @ 2020-08-26  0:36 UTC (permalink / raw)
  To: emacs-devel

Hi Andrea and others,

This is a follow-on to my earlier message re a possible race
condition, this time with a backtrace.

1. I load dired-x in my emacs startup, and I have dired-omit-mode
   enabled via customize (settings saved to a custom file)

   2. The above emacs startup works with no errors or warnings  with
      regular emacs.

      3. With emacs native-comp version, this throws a symbol's value
         as variable is void in the *Messages* buffer.
         4. native-emacs (native comp version) does not throw a
            backtrace even if you start it as native-emacs
            --debug-init

            5. I produced the attached backtrace by setting
               debug-on-error to t at the top of my early-init.el
               6. As the backtrace below shows, the psession package
                  in the process of restoring buffers opens a dired
                  buffer, and at that point, dired-omit-mode    is on
                   dired-mode-hook, but apparently dired-x hasn't been
                  fully loaded yet.

                  Debugger entered--Lisp error: (void-function dired-omit-mode)
  (dired-omit-mode)
  (run-hooks change-major-mode-after-body-hook dired-mode-hook)
  (apply run-hooks (change-major-mode-after-body-hook dired-mode-hook))
  (run-mode-hooks dired-mode-hook)
  (dired-mode "~/Mail/foo" "-al")
  (dired-internal-noselect "~/Mail/foo" nil)
  (dired-noselect "~/Mail/foo")
  (run-hook-with-args-until-success dired-noselect "~/Mail/foo")
  (find-file-noselect "/home/raman/Mail/foo/" nowarn)
  (psession--restore-some-buffers)
  (run-hooks emacs-startup-hook term-setup-hook)
  (#f(compiled-function () #<bytecode -0x11887347ec248cf1>))
  (normal-top-level)

-- 
♉Id: kg:/m/0285kf1  🦮♉

--
♉Id: kg:/m/0285kf1  🦮♉



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

* Re: Emacs:Native-Comp Backtrace
  2020-08-26  0:36 Emacs:Native-Comp Backtrace T.V Raman
@ 2020-08-26 15:06 ` T.V Raman
  2020-08-26 19:09   ` Andrea Corallo via Emacs development discussions.
  0 siblings, 1 reply; 5+ messages in thread
From: T.V Raman @ 2020-08-26 15:06 UTC (permalink / raw)
  To: emacs-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 3034 bytes --]

"T.V Raman" <raman@google.com> writes:

Here is some more info based on a work-around:

Conjecture: native-comp has issues with with-eval-after-load and
friends:

The following setup produced the afore-mentioned error:

1. In the emacs startup, load dired-x when dired is loaded:
   (with-eval-after-load "dired" (require 'dired-x))
   2. dired-mode-hook contains dired-omit-mode defined in dired-x
3. During startup, a dired buffer is opened -- either via psession,
   desktop or some other means

   With the above, you get the error (symbol's function definition is
   void: dired-omit-mode)

   Fix: If in the startup file, you remove the with-eval-after-load and
   simply require dired-x, then it works.

   Additional info which lends credence to the conjecture:

   Emacspeak loads module-specific code using eval-after-load e.g. when
   "ido" is loaded, it loads emacspeak-ido after ido is done loading. In
   native-comp emacs, I find that (featurep 'emacspeak-ido) is nil after
   ido is loaded.

   I suspect use-package may also  be affected in  a similar way.
      
> Hi Andrea and others,
>
> This is a follow-on to my earlier message re a possible race
> condition, this time with a backtrace.
>
> 1. I load dired-x in my emacs startup, and I have dired-omit-mode
>    enabled via customize (settings saved to a custom file)
>
>    2. The above emacs startup works with no errors or warnings  with
>       regular emacs.
>
>       3. With emacs native-comp version, this throws a symbol's value
>          as variable is void in the *Messages* buffer.
>          4. native-emacs (native comp version) does not throw a
>             backtrace even if you start it as native-emacs
>             --debug-init
>
>             5. I produced the attached backtrace by setting
>                debug-on-error to t at the top of my early-init.el
>                6. As the backtrace below shows, the psession package
>                   in the process of restoring buffers opens a dired
>                   buffer, and at that point, dired-omit-mode    is on
>                    dired-mode-hook, but apparently dired-x hasn't been
>                   fully loaded yet.
>
>                   Debugger entered--Lisp error: (void-function dired-omit-mode)
>   (dired-omit-mode)
>   (run-hooks change-major-mode-after-body-hook dired-mode-hook)
>   (apply run-hooks (change-major-mode-after-body-hook dired-mode-hook))
>   (run-mode-hooks dired-mode-hook)
>   (dired-mode "~/Mail/foo" "-al")
>   (dired-internal-noselect "~/Mail/foo" nil)
>   (dired-noselect "~/Mail/foo")
>   (run-hook-with-args-until-success dired-noselect "~/Mail/foo")
>   (find-file-noselect "/home/raman/Mail/foo/" nowarn)
>   (psession--restore-some-buffers)
>   (run-hooks emacs-startup-hook term-setup-hook)
>   (#f(compiled-function () #<bytecode -0x11887347ec248cf1>))
>   (normal-top-level)
>
> -- 
> 7©4Id: kg:/m/0285kf1  •0Ü87©4

-- 
7©4Id: kg:/m/0285kf1  •0Ü87©4



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

* Re: Emacs:Native-Comp Backtrace
  2020-08-26 15:06 ` T.V Raman
@ 2020-08-26 19:09   ` Andrea Corallo via Emacs development discussions.
  2020-08-26 19:32     ` T.V Raman
  0 siblings, 1 reply; 5+ messages in thread
From: Andrea Corallo via Emacs development discussions. @ 2020-08-26 19:09 UTC (permalink / raw)
  To: T.V Raman; +Cc: emacs-devel

"T.V Raman" <raman@google.com> writes:

> "T.V Raman" <raman@google.com> writes:
>
> Here is some more info based on a work-around:
>
> Conjecture: native-comp has issues with with-eval-after-load and
> friends:
>
> The following setup produced the afore-mentioned error:
>
> 1. In the emacs startup, load dired-x when dired is loaded:
>    (with-eval-after-load "dired" (require 'dired-x))
>    2. dired-mode-hook contains dired-omit-mode defined in dired-x
> 3. During startup, a dired buffer is opened -- either via psession,
>    desktop or some other means
>
>    With the above, you get the error (symbol's function definition is
>    void: dired-omit-mode)
>
>    Fix: If in the startup file, you remove the with-eval-after-load and
>    simply require dired-x, then it works.
>
>    Additional info which lends credence to the conjecture:
>
>    Emacspeak loads module-specific code using eval-after-load e.g. when
>    "ido" is loaded, it loads emacspeak-ido after ido is done loading. In
>    native-comp emacs, I find that (featurep 'emacspeak-ido) is nil after
>    ido is loaded.
>
>    I suspect use-package may also  be affected in  a similar way.

Hi Raman

thanks for having a look.

This issue sounds strange but before looking into it I'd like to rework
the advicing primitive mechanism for the native code.

This is a source of incompatibility that may cause a number of the small
strange behaviours we still see today.  As a matter of fact today any
primitive that gets advised if is not listed in
`comp-never-optimize-functions' will misbehave with respect to the
vanilla implementation.

This should be the last non small area that need intervention and I'll
be on this very soon.

  Andrea

-- 
akrl@sdf.org



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

* Re: Emacs:Native-Comp Backtrace
  2020-08-26 19:09   ` Andrea Corallo via Emacs development discussions.
@ 2020-08-26 19:32     ` T.V Raman
  2020-08-26 19:46       ` Andrea Corallo via Emacs development discussions.
  0 siblings, 1 reply; 5+ messages in thread
From: T.V Raman @ 2020-08-26 19:32 UTC (permalink / raw)
  To: akrl; +Cc: raman, emacs-devel

thanks. Emacspeak (https://github.com/tvraman/emacspeak) should prove
a good test-bed re advice. Note that with-eval-after-load turns its
body into an anonymous lambda --- an din general, those may not be
worth native-compiling Andrea Corallo writes:
 > "T.V Raman" <raman@google.com> writes:
 > 
 > > "T.V Raman" <raman@google.com> writes:
 > >
 > > Here is some more info based on a work-around:
 > >
 > > Conjecture: native-comp has issues with with-eval-after-load and
 > > friends:
 > >
 > > The following setup produced the afore-mentioned error:
 > >
 > > 1. In the emacs startup, load dired-x when dired is loaded:
 > >    (with-eval-after-load "dired" (require 'dired-x))
 > >    2. dired-mode-hook contains dired-omit-mode defined in dired-x
 > > 3. During startup, a dired buffer is opened -- either via psession,
 > >    desktop or some other means
 > >
 > >    With the above, you get the error (symbol's function definition is
 > >    void: dired-omit-mode)
 > >
 > >    Fix: If in the startup file, you remove the with-eval-after-load and
 > >    simply require dired-x, then it works.
 > >
 > >    Additional info which lends credence to the conjecture:
 > >
 > >    Emacspeak loads module-specific code using eval-after-load e.g. when
 > >    "ido" is loaded, it loads emacspeak-ido after ido is done loading. In
 > >    native-comp emacs, I find that (featurep 'emacspeak-ido) is nil after
 > >    ido is loaded.
 > >
 > >    I suspect use-package may also  be affected in  a similar way.
 > 
 > Hi Raman
 > 
 > thanks for having a look.
 > 
 > This issue sounds strange but before looking into it I'd like to rework
 > the advicing primitive mechanism for the native code.
 > 
 > This is a source of incompatibility that may cause a number of the small
 > strange behaviours we still see today.  As a matter of fact today any
 > primitive that gets advised if is not listed in
 > `comp-never-optimize-functions' will misbehave with respect to the
 > vanilla implementation.
 > 
 > This should be the last non small area that need intervention and I'll
 > be on this very soon.
 > 
 >   Andrea
 > 
 > -- 
 > akrl@sdf.org

-- 
♉Id: kg:/m/0285kf1  🦮♉

--
♉Id: kg:/m/0285kf1  🦮♉



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

* Re: Emacs:Native-Comp Backtrace
  2020-08-26 19:32     ` T.V Raman
@ 2020-08-26 19:46       ` Andrea Corallo via Emacs development discussions.
  0 siblings, 0 replies; 5+ messages in thread
From: Andrea Corallo via Emacs development discussions. @ 2020-08-26 19:46 UTC (permalink / raw)
  To: T.V Raman; +Cc: emacs-devel

"T.V Raman" <raman@google.com> writes:

> thanks. Emacspeak (https://github.com/tvraman/emacspeak) should prove
> a good test-bed re advice.

Cool, I'll ping you when this rework is done then so you can have a
look then.

Thanks

  Andrea

-- 
akrl@sdf.org



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

end of thread, other threads:[~2020-08-26 19:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-26  0:36 Emacs:Native-Comp Backtrace T.V Raman
2020-08-26 15:06 ` T.V Raman
2020-08-26 19:09   ` Andrea Corallo via Emacs development discussions.
2020-08-26 19:32     ` T.V Raman
2020-08-26 19:46       ` Andrea Corallo via Emacs development discussions.

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