[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp d6f6353 17/17: * Do not refuse to compile if a dynam
From: |
Andrea Corallo |
Subject: |
feature/native-comp d6f6353 17/17: * Do not refuse to compile if a dynamic lambda is encountered |
Date: |
Fri, 15 May 2020 15:07:58 -0400 (EDT) |
branch: feature/native-comp
commit d6f6353cfdbbea5501915675081265b4dc4591e3
Author: Andrea Corallo <address@hidden>
Commit: Andrea Corallo <address@hidden>
* Do not refuse to compile if a dynamic lambda is encountered
* lisp/emacs-lisp/comp.el (comp-lex-byte-func-p): New subst.
(comp-intern-func-in-ctxt): Do not crash if we still encounter a
non lexical scoped lambda.
---
lisp/emacs-lisp/comp.el | 52 ++++++++++++++++++++++++++++---------------------
1 file changed, 30 insertions(+), 22 deletions(-)
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 38c89ec..662cfe2 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -487,6 +487,11 @@ VERBOSITY is a number between 0 and 3."
;;; spill-lap pass specific code.
+(defsubst comp-lex-byte-func-p (f)
+ "Return t if F is a lexical scoped byte compiled function."
+ (and (byte-code-function-p f)
+ (fixnump (aref f 0))))
+
(defun comp-c-func-name (name prefix)
"Given NAME return a name suitable for the native code.
Put PREFIX in front of it."
@@ -590,28 +595,31 @@ Put PREFIX in front of it."
byte-func))
return form))
(name (when top-l-form
- (byte-to-native-func-def-name top-l-form)))
- (c-name (comp-c-func-name (or name "anonymous-lambda") "F"))
- (func (make-comp-func :name name
- :byte-func byte-func
- :doc (documentation byte-func)
- :int-spec (interactive-form byte-func)
- :c-name c-name
- :args (comp-decrypt-arg-list (aref byte-func
0)
- name)
- :lap lap
- :frame-size (comp-byte-frame-size
byte-func))))
- ;; Store the c-name to have it retrivable from
- ;; `comp-ctxt-top-level-forms'.
- (when top-l-form
- (setf (byte-to-native-func-def-c-name top-l-form) c-name))
- (unless name
- (puthash byte-func func (comp-ctxt-byte-func-to-func-h comp-ctxt)))
- ;; Create the default array.
- (puthash 0 (comp-func-frame-size func) (comp-func-array-h func))
- (comp-add-func-to-ctxt func)
- (comp-log (format "Function %s:\n" name) 1)
- (comp-log lap 1))))
+ (byte-to-native-func-def-name top-l-form))))
+ ;; Do not refuse to compile if a dynamic byte-compiled lambda
+ ;; leaks here (advice).
+ (when (or name (comp-lex-byte-func-p byte-func))
+ (let* ((c-name (comp-c-func-name (or name "anonymous-lambda") "F"))
+ (func (make-comp-func :name name
+ :byte-func byte-func
+ :doc (documentation byte-func)
+ :int-spec (interactive-form byte-func)
+ :c-name c-name
+ :args (comp-decrypt-arg-list (aref
byte-func 0)
+ name)
+ :lap lap
+ :frame-size (comp-byte-frame-size
byte-func))))
+ ;; Store the c-name to have it retrivable from
+ ;; `comp-ctxt-top-level-forms'.
+ (when top-l-form
+ (setf (byte-to-native-func-def-c-name top-l-form) c-name))
+ (unless name
+ (puthash byte-func func (comp-ctxt-byte-func-to-func-h comp-ctxt)))
+ ;; Create the default array.
+ (puthash 0 (comp-func-frame-size func) (comp-func-array-h func))
+ (comp-add-func-to-ctxt func)
+ (comp-log (format "Function %s:\n" name) 1)
+ (comp-log lap 1))))))
(cl-defgeneric comp-spill-lap-function ((filename string))
"Byte compile FILENAME spilling data from the byte compiler."
- feature/native-comp acf7e12 04/17: * Rename emit_mvar_access -> emit_mvar_lval, (continued)
- feature/native-comp acf7e12 04/17: * Rename emit_mvar_access -> emit_mvar_lval, Andrea Corallo, 2020/05/15
- feature/native-comp 3ab6a75 02/17: * Indentation fix, Andrea Corallo, 2020/05/15
- feature/native-comp 392a6f9 05/17: * Split emit_const_lisp_obj logic, Andrea Corallo, 2020/05/15
- feature/native-comp 5bf685f 03/17: * Rename emit_mvar_val -> emit_mvar_rval, Andrea Corallo, 2020/05/15
- feature/native-comp 49f0331 09/17: * Render all immediates as comments at comp-debug > 2, Andrea Corallo, 2020/05/15
- feature/native-comp 27b80ae 11/17: * Better Vcomp_sym_subr_c_name_h test function + doc, Andrea Corallo, 2020/05/15
- feature/native-comp 44b0ce6 10/17: Add anonymous lambdas reload mechanism, Andrea Corallo, 2020/05/15
- feature/native-comp e351a12 14/17: Sanity check on lambdas fixups, Andrea Corallo, 2020/05/15
- feature/native-comp ff9e40e 15/17: * Add check_comp_unit_relocs, Andrea Corallo, 2020/05/15
- feature/native-comp 9a64585 16/17: * Allow for logging async compilation command line, Andrea Corallo, 2020/05/15
- feature/native-comp d6f6353 17/17: * Do not refuse to compile if a dynamic lambda is encountered,
Andrea Corallo <=
- feature/native-comp c12831a 06/17: * Rework comp-spill-lap-function, Andrea Corallo, 2020/05/15
- feature/native-comp 2ee2fb5 07/17: * Prune now unnecessary byte-code objects, Andrea Corallo, 2020/05/15
- feature/native-comp 6eb14da 08/17: * Dump log and intemediate GCC IRs only at comp-debug 3, Andrea Corallo, 2020/05/15
- feature/native-comp e5b24b8 12/17: * Native compiler test update, Andrea Corallo, 2020/05/15
- feature/native-comp 2b064c7 13/17: * Fix speed 2 bootstrap, Andrea Corallo, 2020/05/15