diff options
| author | Andrea Corallo | 2020-10-10 18:18:09 +0200 |
|---|---|---|
| committer | Andrea Corallo | 2020-10-10 18:47:45 +0200 |
| commit | 8b135af5bbdfb6cf561f92a02ef92e855acc04dd (patch) | |
| tree | e6b4039137f54f29b2dbd853fcc63aa7a88c1842 | |
| parent | 77fa6befb478f49a47ef1cee88e2c791e0037617 (diff) | |
| download | emacs-8b135af5bbdfb6cf561f92a02ef92e855acc04dd.tar.gz emacs-8b135af5bbdfb6cf561f92a02ef92e855acc04dd.zip | |
Provide feature nativecomp and make use of it
* lisp/emacs-lisp/comp.el (comp-ensure-native-compiler): Use
`featurep' to identify if the native compiler is available.
* lisp/emacs-lisp/nadvice.el (advice--add-function): Likewise.
* lisp/emacs-lisp/package.el (package--delete-directory): Likewise.
* lisp/loadup.el: Likewise.
* src/comp.c (syms_of_comp): Provide feature nativecomp.
| -rw-r--r-- | lisp/emacs-lisp/comp.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/nadvice.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 2 | ||||
| -rw-r--r-- | lisp/loadup.el | 4 | ||||
| -rw-r--r-- | src/comp.c | 1 |
5 files changed, 6 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index d860fa31f0b..a4f2b6c36c7 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el | |||
| @@ -422,7 +422,7 @@ CFG is mutated by a pass.") | |||
| 422 | Raise an error otherwise. | 422 | Raise an error otherwise. |
| 423 | To be used by all entry points." | 423 | To be used by all entry points." |
| 424 | (cond | 424 | (cond |
| 425 | ((null (boundp 'comp-ctxt)) | 425 | ((null (featurep 'nativecomp)) |
| 426 | (error "Emacs not compiled with native compiler support (--with-nativecomp)")) | 426 | (error "Emacs not compiled with native compiler support (--with-nativecomp)")) |
| 427 | ((null (native-comp-available-p)) | 427 | ((null (native-comp-available-p)) |
| 428 | (error "Cannot find libgccjit")))) | 428 | (error "Cannot find libgccjit")))) |
diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el index 03961325856..8b60c08440b 100644 --- a/lisp/emacs-lisp/nadvice.el +++ b/lisp/emacs-lisp/nadvice.el | |||
| @@ -318,7 +318,7 @@ is also interactive. There are 3 cases: | |||
| 318 | 318 | ||
| 319 | ;;;###autoload | 319 | ;;;###autoload |
| 320 | (defun advice--add-function (where ref function props) | 320 | (defun advice--add-function (where ref function props) |
| 321 | (when (and (boundp 'comp-ctxt) | 321 | (when (and (featurep 'nativecomp) |
| 322 | (subr-primitive-p (gv-deref ref))) | 322 | (subr-primitive-p (gv-deref ref))) |
| 323 | (let ((subr-name (intern (subr-name (gv-deref ref))))) | 323 | (let ((subr-name (intern (subr-name (gv-deref ref))))) |
| 324 | ;; Requiring the native compiler to advice `macroexpand' cause a | 324 | ;; Requiring the native compiler to advice `macroexpand' cause a |
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index ac1396f88df..c0125e64727 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -2207,7 +2207,7 @@ If some packages are not installed propose to install them." | |||
| 2207 | "Delete DIR recursively. | 2207 | "Delete DIR recursively. |
| 2208 | Clean-up the corresponding .eln files if Emacs is native | 2208 | Clean-up the corresponding .eln files if Emacs is native |
| 2209 | compiled." | 2209 | compiled." |
| 2210 | (when (boundp 'comp-ctxt) | 2210 | (when (featurep 'nativecomp) |
| 2211 | (cl-loop | 2211 | (cl-loop |
| 2212 | for file in (directory-files-recursively dir ".el\\'") | 2212 | for file in (directory-files-recursively dir ".el\\'") |
| 2213 | do (comp-clean-up-stale-eln (comp-el-to-eln-filename file)))) | 2213 | do (comp-clean-up-stale-eln (comp-el-to-eln-filename file)))) |
diff --git a/lisp/loadup.el b/lisp/loadup.el index 91126703d18..827087f763c 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el | |||
| @@ -449,7 +449,7 @@ lost after dumping"))) | |||
| 449 | ;; At this point, we're ready to resume undo recording for scratch. | 449 | ;; At this point, we're ready to resume undo recording for scratch. |
| 450 | (buffer-enable-undo "*scratch*") | 450 | (buffer-enable-undo "*scratch*") |
| 451 | 451 | ||
| 452 | (when (boundp 'comp-ctxt) | 452 | (when (featurep 'nativecomp) |
| 453 | ;; Fix the compilation unit filename to have it working when | 453 | ;; Fix the compilation unit filename to have it working when |
| 454 | ;; when installed or if the source directory got moved. This is set to be | 454 | ;; when installed or if the source directory got moved. This is set to be |
| 455 | ;; a pair in the form: (rel-path-from-install-bin . rel-path-from-local-bin). | 455 | ;; a pair in the form: (rel-path-from-install-bin . rel-path-from-local-bin). |
| @@ -510,7 +510,7 @@ lost after dumping"))) | |||
| 510 | ((equal dump-mode "bootstrap") "emacs") | 510 | ((equal dump-mode "bootstrap") "emacs") |
| 511 | ((equal dump-mode "pbootstrap") "bootstrap-emacs.pdmp") | 511 | ((equal dump-mode "pbootstrap") "bootstrap-emacs.pdmp") |
| 512 | (t (error "unrecognized dump mode %s" dump-mode))))) | 512 | (t (error "unrecognized dump mode %s" dump-mode))))) |
| 513 | (when (and (boundp 'comp-ctxt) | 513 | (when (and (featurep 'nativecomp) |
| 514 | (equal dump-mode "pdump")) | 514 | (equal dump-mode "pdump")) |
| 515 | ;; Don't enable this before bootstrap is completed the as the | 515 | ;; Don't enable this before bootstrap is completed the as the |
| 516 | ;; compiler infrastructure may not be usable. | 516 | ;; compiler infrastructure may not be usable. |
diff --git a/src/comp.c b/src/comp.c index 13343de3d88..0b5a49fd1f1 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -5300,6 +5300,7 @@ The last directory of this list is assumed to be the system one. */); | |||
| 5300 | doc: /* Hash table subr-name -> bool. */); | 5300 | doc: /* Hash table subr-name -> bool. */); |
| 5301 | Vcomp_installed_trampolines_h = CALLN (Fmake_hash_table); | 5301 | Vcomp_installed_trampolines_h = CALLN (Fmake_hash_table); |
| 5302 | 5302 | ||
| 5303 | Fprovide (intern_c_string ("nativecomp"), Qnil); | ||
| 5303 | #endif /* #ifdef HAVE_NATIVE_COMP */ | 5304 | #endif /* #ifdef HAVE_NATIVE_COMP */ |
| 5304 | 5305 | ||
| 5305 | defsubr (&Snative_comp_available_p); | 5306 | defsubr (&Snative_comp_available_p); |