emacs-diffs
[Top][All Lists]
Advanced

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

feature/native-comp 8b135af 2/2: Provide feature nativecomp and make use


From: Andrea Corallo
Subject: feature/native-comp 8b135af 2/2: Provide feature nativecomp and make use of it
Date: Sat, 10 Oct 2020 12:49:20 -0400 (EDT)

branch: feature/native-comp
commit 8b135af5bbdfb6cf561f92a02ef92e855acc04dd
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>

    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.
---
 lisp/emacs-lisp/comp.el    | 2 +-
 lisp/emacs-lisp/nadvice.el | 2 +-
 lisp/emacs-lisp/package.el | 2 +-
 lisp/loadup.el             | 4 ++--
 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 d860fa3..a4f2b6c 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -422,7 +422,7 @@ CFG is mutated by a pass.")
 Raise an error otherwise.
 To be used by all entry points."
   (cond
-   ((null (boundp 'comp-ctxt))
+   ((null (featurep 'nativecomp))
     (error "Emacs not compiled with native compiler support 
(--with-nativecomp)"))
    ((null (native-comp-available-p))
     (error "Cannot find libgccjit"))))
diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el
index 0396132..8b60c08 100644
--- a/lisp/emacs-lisp/nadvice.el
+++ b/lisp/emacs-lisp/nadvice.el
@@ -318,7 +318,7 @@ is also interactive.  There are 3 cases:
 
 ;;;###autoload
 (defun advice--add-function (where ref function props)
-  (when (and (boundp 'comp-ctxt)
+  (when (and (featurep 'nativecomp)
              (subr-primitive-p (gv-deref ref)))
     (let ((subr-name (intern (subr-name (gv-deref ref)))))
       ;; Requiring the native compiler to advice `macroexpand' cause a
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index ac1396f..c0125e6 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."
   "Delete DIR recursively.
 Clean-up the corresponding .eln files if Emacs is native
 compiled."
-  (when (boundp 'comp-ctxt)
+  (when (featurep 'nativecomp)
     (cl-loop
      for file in (directory-files-recursively dir ".el\\'")
      do (comp-clean-up-stale-eln (comp-el-to-eln-filename file))))
diff --git a/lisp/loadup.el b/lisp/loadup.el
index 9112670..827087f 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -449,7 +449,7 @@ lost after dumping")))
 ;; At this point, we're ready to resume undo recording for scratch.
 (buffer-enable-undo "*scratch*")
 
-(when (boundp 'comp-ctxt)
+(when (featurep 'nativecomp)
   ;; Fix the compilation unit filename to have it working when
   ;; when installed or if the source directory got moved.  This is set to be
   ;; a pair in the form: (rel-path-from-install-bin . rel-path-from-local-bin).
@@ -510,7 +510,7 @@ lost after dumping")))
                         ((equal dump-mode "bootstrap") "emacs")
                         ((equal dump-mode "pbootstrap") "bootstrap-emacs.pdmp")
                         (t (error "unrecognized dump mode %s" dump-mode)))))
-      (when (and (boundp 'comp-ctxt)
+      (when (and (featurep 'nativecomp)
                  (equal dump-mode "pdump"))
         ;; Don't enable this before bootstrap is completed the as the
         ;; compiler infrastructure may not be usable.
diff --git a/src/comp.c b/src/comp.c
index 13343de..0b5a49f 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.  */);
               doc: /* Hash table subr-name -> bool.  */);
   Vcomp_installed_trampolines_h = CALLN (Fmake_hash_table);
 
+  Fprovide (intern_c_string ("nativecomp"), Qnil);
 #endif /* #ifdef HAVE_NATIVE_COMP */
 
   defsubr (&Snative_comp_available_p);



reply via email to

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