diff options
| author | Andrea Corallo | 2020-05-15 11:43:31 +0100 |
|---|---|---|
| committer | Andrea Corallo | 2020-05-15 20:06:49 +0100 |
| commit | d6f6353cfdbbea5501915675081265b4dc4591e3 (patch) | |
| tree | ac034ea56f880952d107e31ac2e3088e93fcf436 | |
| parent | 9a64585c126200d0f4b65fd45f6380244fe1d26c (diff) | |
| download | emacs-d6f6353cfdbbea5501915675081265b4dc4591e3.tar.gz emacs-d6f6353cfdbbea5501915675081265b4dc4591e3.zip | |
* 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.
| -rw-r--r-- | lisp/emacs-lisp/comp.el | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 38c89ec263b..662cfe2d4e8 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." | |||
| 487 | 487 | ||
| 488 | ;;; spill-lap pass specific code. | 488 | ;;; spill-lap pass specific code. |
| 489 | 489 | ||
| 490 | (defsubst comp-lex-byte-func-p (f) | ||
| 491 | "Return t if F is a lexical scoped byte compiled function." | ||
| 492 | (and (byte-code-function-p f) | ||
| 493 | (fixnump (aref f 0)))) | ||
| 494 | |||
| 490 | (defun comp-c-func-name (name prefix) | 495 | (defun comp-c-func-name (name prefix) |
| 491 | "Given NAME return a name suitable for the native code. | 496 | "Given NAME return a name suitable for the native code. |
| 492 | Put PREFIX in front of it." | 497 | Put PREFIX in front of it." |
| @@ -590,28 +595,31 @@ Put PREFIX in front of it." | |||
| 590 | byte-func)) | 595 | byte-func)) |
| 591 | return form)) | 596 | return form)) |
| 592 | (name (when top-l-form | 597 | (name (when top-l-form |
| 593 | (byte-to-native-func-def-name top-l-form))) | 598 | (byte-to-native-func-def-name top-l-form)))) |
| 594 | (c-name (comp-c-func-name (or name "anonymous-lambda") "F")) | 599 | ;; Do not refuse to compile if a dynamic byte-compiled lambda |
| 595 | (func (make-comp-func :name name | 600 | ;; leaks here (advice). |
| 596 | :byte-func byte-func | 601 | (when (or name (comp-lex-byte-func-p byte-func)) |
| 597 | :doc (documentation byte-func) | 602 | (let* ((c-name (comp-c-func-name (or name "anonymous-lambda") "F")) |
| 598 | :int-spec (interactive-form byte-func) | 603 | (func (make-comp-func :name name |
| 599 | :c-name c-name | 604 | :byte-func byte-func |
| 600 | :args (comp-decrypt-arg-list (aref byte-func 0) | 605 | :doc (documentation byte-func) |
| 601 | name) | 606 | :int-spec (interactive-form byte-func) |
| 602 | :lap lap | 607 | :c-name c-name |
| 603 | :frame-size (comp-byte-frame-size byte-func)))) | 608 | :args (comp-decrypt-arg-list (aref byte-func 0) |
| 604 | ;; Store the c-name to have it retrivable from | 609 | name) |
| 605 | ;; `comp-ctxt-top-level-forms'. | 610 | :lap lap |
| 606 | (when top-l-form | 611 | :frame-size (comp-byte-frame-size byte-func)))) |
| 607 | (setf (byte-to-native-func-def-c-name top-l-form) c-name)) | 612 | ;; Store the c-name to have it retrivable from |
| 608 | (unless name | 613 | ;; `comp-ctxt-top-level-forms'. |
| 609 | (puthash byte-func func (comp-ctxt-byte-func-to-func-h comp-ctxt))) | 614 | (when top-l-form |
| 610 | ;; Create the default array. | 615 | (setf (byte-to-native-func-def-c-name top-l-form) c-name)) |
| 611 | (puthash 0 (comp-func-frame-size func) (comp-func-array-h func)) | 616 | (unless name |
| 612 | (comp-add-func-to-ctxt func) | 617 | (puthash byte-func func (comp-ctxt-byte-func-to-func-h comp-ctxt))) |
| 613 | (comp-log (format "Function %s:\n" name) 1) | 618 | ;; Create the default array. |
| 614 | (comp-log lap 1)))) | 619 | (puthash 0 (comp-func-frame-size func) (comp-func-array-h func)) |
| 620 | (comp-add-func-to-ctxt func) | ||
| 621 | (comp-log (format "Function %s:\n" name) 1) | ||
| 622 | (comp-log lap 1)))))) | ||
| 615 | 623 | ||
| 616 | (cl-defgeneric comp-spill-lap-function ((filename string)) | 624 | (cl-defgeneric comp-spill-lap-function ((filename string)) |
| 617 | "Byte compile FILENAME spilling data from the byte compiler." | 625 | "Byte compile FILENAME spilling data from the byte compiler." |