bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#44813: 28.0.50; [feature/native-comp] Recent change to native-compil


From: Andrea Corallo
Subject: bug#44813: 28.0.50; [feature/native-comp] Recent change to native-compile-async
Date: Mon, 23 Nov 2020 08:44:30 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Andrew Whatson <whatson@gmail.com> writes:

> Hi,
>
> The change to the treatment of the load parameter of
> native-compile-async in commit 6781cd67 has exposed some problems with
> how native compilation has been handled by the `straight.el` package
> manager.
>
> Straight calls `(native-compile-async path-to-pkg 'recursively 'late)`
> to trigger compilation of packages, and relies on
> `comp-deferred-compilation-black-list` to prevent compilation of
> packages when requested by the user.
>
> The reasoning behind using the late is two-fold:
>
> 1) When compilation is requested, the package has not been loaded.
> Once async compilation has finished, it may have been loaded.  We want
> to load the native elisp if the package has been loaded, but otherwise
> not force the package to load.
>
> It seems that `late` loading provided this behaviour thanks to
> `comp--late-register-subr` checking `comp-deferred-pending-h` before
> loading the native definition.  The hash entry will be missing for
> packages where we requested compilation but were never loaded.
>
> Relying on undocumented behaviour of the `late` flag like is obviously
> fragile and naughty, but I believe this is a valid use-case.  What do
> you think about adding official support for this kind of "lazy"
> loading?

Hi Andrew,

I think straight should call `async-native-compile' with the load
parameter set to nil and perform the conventional byte compilation.

In case the late load will prove to be necessary (bytecode is loaded
before native compilation has finished) should be set automatically by
the existent machinery.

> 2) The `comp-deferred-compilation-black-list` is the only way that a
> user can prevent compilation of an elisp file, and this blacklist is
> only checked when compilation is requested with `late` loading.
>
> While what straight.el (and now package.el) are doing is not
> technically "deferred" compilation, I think it's useful to have a
> single blacklist to prevent compilation of a file regardless of how
> that compilation is requested.

I think would be nicer to add like a selector parameter to
`async-native-compile', this being a regexp to be satisfied for
compilation.

The reason why we rely on `comp-deferred-compilation-black-list' for
deferred compilation is that the user indeed does not invoke a function
as this happen automatically.

So the proposal would be to have like:

`(defun native-compile-async (paths &optional recursively load selector)`

WDYT?

Thanks

  Andrea





reply via email to

[Prev in Thread] Current Thread [Next in Thread]