From 4a69e953f34d504809b94a0c4634444d34100039 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Sat, 7 Nov 2020 00:13:01 +0100 Subject: Allow for native compilation qualities to be specified per input file * lisp/emacs-lisp/bytecomp.el (byte-native-qualities): Define variable. (byte-compile-from-buffer): Spill compilation qualities. * lisp/emacs-lisp/comp.el (comp-speed, comp-debug): Make them file local variables. (comp-ctxt): Add `speed' and `debug' slots. (comp-spill-speed, comp-spill-lap-function): Make use of these. (comp-spill-lap-function): Spill qualities from `byte-native-qualities'. (comp-limplify-top-level): Do not use `comp-speed' but ctxt value unstead. (comp-final): Do not propagate qualities as they are already in the `comp-ctxt'. (comp--native-compile): Close on `byte-native-qualities'. * src/comp.c (comp_t): Add 'speed' and 'debug' fields. (emit_comment, emit_mvar_rval, emit_static_object) (emit_ctxt_code, Fcomp__init_ctxt): Use these instead of the global variables. (Fcomp__compile_ctxt_to_file): Set comp.speed and comp.debug and use them. --- lisp/emacs-lisp/bytecomp.el | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lisp/emacs-lisp/bytecomp.el') diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index a3c830e60dd..5508a60c444 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -598,6 +598,8 @@ Each element is (INDEX . VALUE)") (defvar byte-native-compiling nil "Non nil while native compiling.") +(defvar byte-native-qualities nil + "To spill default qualities from the compiled file.") (defvar byte-native-for-bootstrap nil "Non nil while compiling for bootstrap." ;; During boostrap we produce both the .eln and the .elc together. @@ -2216,6 +2218,11 @@ With argument ARG, insert value in current buffer after the form." (setq byte-compile-unresolved-functions nil) (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 comp-debug) + (push `(comp-debug . ,comp-debug) byte-native-qualities)) ;; Compile the forms from the input buffer. (while (progn -- cgit v1.2.3