From 43f29696adc37ae75d87cd4b86d78e830e01e018 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Thu, 6 May 2021 10:12:48 +0200 Subject: [PATCH] Rename comp-speed -> native-comp-speed * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Rename comp-speed -> native-comp-speed. * lisp/emacs-lisp/comp.el (native-comp-speed, comp-ctxt, comp-func, comp-spill-lap-function, comp-trampoline-compile, comp-run-async-workers): Likewise. * src/comp.c (emit_ctxt_code, load_comp_unit, syms_of_comp): Likewise. * test/src/comp-tests.el (comp-tests-tco, comp-tests-fw-prop-1) (comp-tests-check-ret-type-spec, comp-tests-pure): Likewise. --- lisp/emacs-lisp/bytecomp.el | 4 ++-- lisp/emacs-lisp/comp.el | 18 +++++++++--------- src/comp.c | 6 +++--- test/src/comp-tests.el | 8 ++++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index e93cee99249..2a07ea79f56 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2238,8 +2238,8 @@ With argument ARG, insert value in current buffer after the form." (setq byte-compile-noruntime-functions nil) (setq byte-compile-new-defuns nil) (when byte-native-compiling - (defvar comp-speed) - (push `(comp-speed . ,comp-speed) byte-native-qualities) + (defvar native-comp-speed) + (push `(native-comp-speed . ,native-comp-speed) byte-native-qualities) (defvar comp-debug) (push `(comp-debug . ,comp-debug) byte-native-qualities) (defvar comp-native-driver-options) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 19a6d1eef9c..d02c3b0c23b 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -43,7 +43,7 @@ "Emacs Lisp native compiler." :group 'lisp) -(defcustom comp-speed 2 +(defcustom native-comp-speed 2 "Optimization level for native compilation, a number between -1 and 3. -1 functions are kept in bytecode form and no native compilation is performed. 0 native compilation is performed with no optimizations. @@ -743,7 +743,7 @@ Returns ELT." "Lisp side of the compiler context." (output nil :type string :documentation "Target output file-name for the compilation.") - (speed comp-speed :type number + (speed native-comp-speed :type number :documentation "Default speed for this compilation unit.") (debug comp-debug :type number :documentation "Default debug level for this compilation unit.") @@ -899,7 +899,7 @@ CFG is mutated by a pass.") (has-non-local nil :type boolean :documentation "t if non local jumps are present.") (speed nil :type number - :documentation "Optimization level (see `comp-speed').") + :documentation "Optimization level (see `native-comp-speed').") (pure nil :type boolean :documentation "t if pure nil otherwise.") (type nil :type (or null comp-mvar) @@ -1334,7 +1334,7 @@ clashes." filename (when byte-native-for-bootstrap (car (last comp-eln-load-path)))))) - (setf (comp-ctxt-speed comp-ctxt) (alist-get 'comp-speed + (setf (comp-ctxt-speed comp-ctxt) (alist-get 'native-comp-speed byte-native-qualities) (comp-ctxt-debug comp-ctxt) (alist-get 'comp-debug byte-native-qualities) @@ -3250,14 +3250,14 @@ Return t if something was changed." ;; funcall trampoline gets optimized into normal indirect calls. ;; This makes effectively this calls equivalent to all the subrs that got ;; dedicated byte-code ops. -;; Triggered at comp-speed >= 2. +;; Triggered at native-comp-speed >= 2. ;; - Recursive calls gets optimized into direct calls. -;; Triggered at comp-speed >= 2. +;; Triggered at native-comp-speed >= 2. ;; - Intra compilation unit procedure calls gets optimized into direct calls. ;; This can be a big win and even allow gcc to inline but does not make ;; function in the compilation unit re-definable safely without recompiling ;; the full compilation unit. -;; For this reason this is triggered only at comp-speed == 3. +;; For this reason this is triggered only at native-comp-speed == 3. (defun comp-func-in-unit (func) "Given FUNC return the `comp-fun' definition in the current context. @@ -3756,7 +3756,7 @@ Return the trampoline if found or nil otherwise." ;; Use speed 0 to maximize compilation speed and not to ;; optimize away funcall calls! (byte-optimize nil) - (comp-speed 1) + (native-comp-speed 1) (lexical-binding t)) (comp--native-compile form nil @@ -3905,7 +3905,7 @@ display a message." do (let* ((expr `((require 'comp) ,(when (boundp 'backtrace-line-length) `(setf backtrace-line-length ,backtrace-line-length)) - (setf comp-speed ,comp-speed + (setf native-comp-speed ,native-comp-speed comp-debug ,comp-debug comp-verbose ,comp-verbose comp-libgccjit-reproducer ,comp-libgccjit-reproducer diff --git a/src/comp.c b/src/comp.c index 89667b2febc..c87a3e66661 100644 --- a/src/comp.c +++ b/src/comp.c @@ -2745,7 +2745,7 @@ emit_ctxt_code (void) { /* Emit optimize qualities. */ Lisp_Object opt_qly[] = - { Fcons (Qcomp_speed, make_fixnum (comp.speed)), + { Fcons (Qnative_comp_speed, make_fixnum (comp.speed)), Fcons (Qcomp_debug, make_fixnum (comp.debug)), Fcons (Qgccjit, Fcomp_libgccjit_version ()) }; @@ -4856,7 +4856,7 @@ load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u, bool loading_dump, /* 'dlopen' returns the same handle when trying to load two times the same shared. In this case touching 'd_reloc' etc leads to fails in case a frame with a reference to it in a live reg is - active (comp-speed > 0). + active (native-comp-speed > 0). We must *never* mess with static pointers in an already loaded eln. */ @@ -5207,7 +5207,7 @@ After compilation, each function definition is updated to the native compiled one. */); comp_deferred_compilation = true; - DEFSYM (Qcomp_speed, "comp-speed"); + DEFSYM (Qnative_comp_speed, "native-comp-speed"); DEFSYM (Qcomp_debug, "comp-debug"); DEFSYM (Qcomp_native_driver_options, "comp-native-driver-options"); DEFSYM (Qcomp_libgccjit_reproducer, "comp-libgccjit-reproducer"); diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index e3e4bdd9b61..9e9097c994a 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -786,7 +786,7 @@ Return a list of results." (comp-deftest tco () "Check for tail recursion elimination." - (let ((comp-speed 3) + (let ((native-comp-speed 3) ;; Disable ipa-pure otherwise `comp-tests-tco-f' gets ;; optimized-out. (comp-disabled-passes '(comp-ipa-pure)) @@ -814,7 +814,7 @@ Return a list of results." (comp-deftest fw-prop-1 () "Some tests for forward propagation." - (let ((comp-speed 2) + (let ((native-comp-speed 2) (comp-post-pass-hooks '((comp-final comp-tests-fw-prop-checker-1)))) (eval '(defun comp-tests-fw-prop-1-f () (let* ((a "xxx") @@ -828,7 +828,7 @@ Return a list of results." (defun comp-tests-check-ret-type-spec (func-form ret-type) (let ((lexical-binding t) - (comp-speed 2) + (native-comp-speed 2) (f-name (cl-second func-form))) (eval func-form t) (native-compile f-name) @@ -1399,7 +1399,7 @@ Return a list of results." (comp-deftest pure () "Some tests for pure functions optimization." - (let ((comp-speed 3) + (let ((native-comp-speed 3) (comp-post-pass-hooks '((comp-final comp-tests-pure-checker-1 comp-tests-pure-checker-2)))) (load (native-compile (ert-resource-file "comp-test-pure.el"))) -- 2.39.2