mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-10 00:00:39 -08:00
Fix native compilation in dynamically bound files.
This fixes bug#64642. * lisp/emacs-lisp/comp.el (comp-spill-lap-function/symbol): Add code for dynamically bound functions. * test/src/comp-tests.el (comp-tests-result-lambda): New test. * test/src/comp-resources/comp-test-funcs-dyn2.el: New test file. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # On branch master # Your branch is up to date with 'origin/master'. # # Changes to be committed: # modified: lisp/emacs-lisp/comp.el # new file: test/src/comp-resources/comp-test-funcs-dyn2.el # modified: test/src/comp-tests.el # # Changes not staged for commit: # modified: .gitignore # # Untracked files: # .gitignore.acm # .gitignore.backup # .timestamps.txt # 2021-01-03.err # 2021-01-06.err # 2021-12-16.make # 2021-12-30.err # 2021-12-31.err # 2022-01-01.err # 2022-01-02.check.err # 2022-01-02.err # 2022-01-04.err # 2022-01-05.err # 2022-01-06.err # 2022-01-07.err # 2022-01-07.outerr # 2022-01-08.err # 2022-01-09.err # 2022-01-09b.err # 2022-01-10.err # 2022-01-11 # 2022-01-11.err # 2022-02-22.err # 2022-02-22.outerr # checkout.20220228.out # checkout.20220301.out # checkout.20220302.out # doc/lispref/syntax.20160318.techsi # doc/lispref/syntax.20160318b.techsi # lib/.deps/ # lisp/2022-01-09.err # lisp/emacs-lisp/comp.el.rej # src/2021-12-20.err # src/globals.20211124.aitch # src/lisp.20211127.aitch # test/lisp/calendar/icalendar-tests.elcr5m9Wq #
This commit is contained in:
parent
fb5e43040f
commit
f9f9c95ab5
3 changed files with 67 additions and 19 deletions
|
|
@ -1301,33 +1301,45 @@ clashes."
|
|||
(make-temp-file (comp-c-func-name function-name "freefn-")
|
||||
nil ".eln")))
|
||||
(let* ((f (symbol-function function-name))
|
||||
(byte-code (byte-compile function-name))
|
||||
(c-name (comp-c-func-name function-name "F"))
|
||||
(func (make-comp-func-l :name function-name
|
||||
:c-name c-name
|
||||
:doc (documentation f t)
|
||||
:int-spec (interactive-form f)
|
||||
:command-modes (command-modes f)
|
||||
:speed (comp-spill-speed function-name)
|
||||
:pure (comp-spill-decl-spec function-name
|
||||
'pure))))
|
||||
(func
|
||||
(if (comp-lex-byte-func-p byte-code)
|
||||
(make-comp-func-l :name function-name
|
||||
:c-name c-name
|
||||
:doc (documentation f t)
|
||||
:int-spec (interactive-form f)
|
||||
:command-modes (command-modes f)
|
||||
:speed (comp-spill-speed function-name)
|
||||
:pure (comp-spill-decl-spec function-name
|
||||
'pure))
|
||||
(make-comp-func-d :name function-name
|
||||
:c-name c-name
|
||||
:doc (documentation f t)
|
||||
:int-spec (interactive-form f)
|
||||
:command-modes (command-modes f)
|
||||
:speed (comp-spill-speed function-name)
|
||||
:pure (comp-spill-decl-spec function-name
|
||||
'pure)))))
|
||||
(when (byte-code-function-p f)
|
||||
(signal 'native-compiler-error
|
||||
'("can't native compile an already byte-compiled function")))
|
||||
(setf (comp-func-byte-func func)
|
||||
(byte-compile (comp-func-name func)))
|
||||
(setf (comp-func-byte-func func) byte-code)
|
||||
(let ((lap (byte-to-native-lambda-lap
|
||||
(gethash (aref (comp-func-byte-func func) 1)
|
||||
byte-to-native-lambdas-h))))
|
||||
(cl-assert lap)
|
||||
(comp-log lap 2 t)
|
||||
(let ((arg-list (aref (comp-func-byte-func func) 0)))
|
||||
(setf (comp-func-l-args func)
|
||||
(comp-decrypt-arg-list arg-list function-name)
|
||||
(comp-func-lap func)
|
||||
lap
|
||||
(comp-func-frame-size func)
|
||||
(comp-byte-frame-size (comp-func-byte-func func))))
|
||||
(setf (comp-ctxt-top-level-forms comp-ctxt)
|
||||
(if (comp-func-l-p func)
|
||||
(let ((arg-list (aref (comp-func-byte-func func) 0)))
|
||||
(setf (comp-func-l-args func)
|
||||
(comp-decrypt-arg-list arg-list function-name)))
|
||||
(setf (comp-func-d-lambda-list func) (cadr f)))
|
||||
(setf (comp-func-lap func)
|
||||
lap
|
||||
(comp-func-frame-size func)
|
||||
(comp-byte-frame-size (comp-func-byte-func func))
|
||||
(comp-ctxt-top-level-forms comp-ctxt)
|
||||
(list (make-byte-to-native-func-def :name function-name
|
||||
:c-name c-name)))
|
||||
(comp-add-func-to-ctxt func))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue