1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-23 22:20:24 -08:00

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.
This commit is contained in:
Andrea Corallo 2020-11-07 00:13:01 +01:00
parent acf101c636
commit 4a69e953f3
3 changed files with 39 additions and 25 deletions

View file

@ -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