(defvar byte-compile-depth 0 "Current depth of execution stack.")
(defvar byte-compile-maxdepth 0 "Maximum depth of execution stack.")
-;; These are use by comp.el to spill lap
-(defvar byte-compile-spilling-lap nil)
-(defvar byte-compile-lap-output nil)
+;; These are use by comp.el to spill
+(defvar byte-native-compiling nil)
+(defvar byte-to-native-lap-output nil)
+(defvar byte-to-native-bytecode-output nil)
\f
;;; The byte codes; this information is duplicated in bytecomp.c
(setq rest (cdr rest)))
rest))
;; Spill lap output here
- (setq byte-compile-lap-output byte-compile-output)
+ (when byte-native-compiling
+ (push byte-compile-output byte-to-native-lap-output))
(let ((byte-compile-vector (byte-compile-constants-vector)))
(list 'byte-code (byte-compile-lapcode byte-compile-output)
byte-compile-vector byte-compile-maxdepth)))
(defun comp-spill-lap (func)
"Byte compile and spill the LAP rapresentation for FUNC."
- (let (byte-compile-lap-output)
+ (let ((byte-native-compiling t)
+ (byte-to-native-lap-output ()))
(setf (comp-func-byte-func func)
(byte-compile (comp-func-symbol-name func)))
(comp-within-log-buff
- (cl-prettyprint byte-compile-lap-output))
+ (cl-prettyprint byte-to-native-lap-output))
(let ((lambda-list (aref (comp-func-byte-func func) 0)))
(if (fixnump lambda-list)
(setf (comp-func-args func)
(comp-decrypt-lambda-list lambda-list))
(error "Can't native compile a non lexical scoped function")))
- (setf (comp-func-lap func) byte-compile-lap-output)
+ (setf (comp-func-lap func) (car byte-to-native-lap-output))
(setf (comp-func-frame-size func) (aref (comp-func-byte-func func) 3))
func))