diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-10-28 11:33:24 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-10-28 11:33:24 -0400 |
commit | d79cdcd4ff6687c2f0dcfde83ba36732408e52e8 (patch) | |
tree | 570e8832ca29ba5f8e6db49cd0b9b9acaf831011 /src/eval.c | |
parent | de5a3fa1e529810f30d461d6682762c9c5e564a4 (diff) | |
download | emacs-d79cdcd4ff6687c2f0dcfde83ba36732408e52e8.tar.gz |
cconv.el: Fix regression in cconv-tests-interactive-closure-bug51695
The new code to make interpreted closures safe-for-space introduced
a regression in `cconv-tests-interactive-closure-bug51695`, only seen
when using TEST_LOAD_EL.
A few other issues were found and fixed along the way.
* lisp/emacs-lisp/cconv.el (cconv-fv): Change calling convention and
focus on finding the free variables.
(cconv-make-interpreted-closure): New function.
* lisp/loadup.el: Use `compiled-function-p` rather than
`byte-code-function-p` so we also use safe-for-space interpreted
closures when we build with native compilation.
(internal-make-interpreted-closure-function):
Use `cconv-make-interpreted-closure`.
* src/eval.c (syms_of_eval): Rename `internal-filter-closure-env-function`
to `internal-make-interpreted-closure-function`.
(Ffunction): Let that new var build the actual closure.
* test/lisp/emacs-lisp/cconv-tests.el
(cconv-tests-interactive-closure-bug51695): Test specifically the
interpreted case.
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/eval.c b/src/eval.c index d2cab006d11..2928a45ac1e 100644 --- a/src/eval.c +++ b/src/eval.c @@ -550,15 +550,12 @@ usage: (function ARG) */) CHECK_STRING (docstring); cdr = Fcons (XCAR (cdr), Fcons (docstring, XCDR (XCDR (cdr)))); } - Lisp_Object env - = NILP (Vinternal_filter_closure_env_function) - ? Vinternal_interpreter_environment - /* FIXME: This macroexpands the body, so we should use the resulting - macroexpanded code! */ - : call2 (Vinternal_filter_closure_env_function, - Fcons (Qprogn, CONSP (cdr) ? XCDR (cdr) : cdr), - Vinternal_interpreter_environment); - return Fcons (Qclosure, Fcons (env, cdr)); + if (NILP (Vinternal_make_interpreted_closure_function)) + return Fcons (Qclosure, Fcons (Vinternal_interpreter_environment, cdr)); + else + return call2 (Vinternal_make_interpreted_closure_function, + Fcons (Qlambda, cdr), + Vinternal_interpreter_environment); } else /* Simply quote the argument. */ @@ -4361,10 +4358,10 @@ alist of active lexical bindings. */); (Just imagine if someone makes it buffer-local). */ Funintern (Qinternal_interpreter_environment, Qnil); - DEFVAR_LISP ("internal-filter-closure-env-function", - Vinternal_filter_closure_env_function, + DEFVAR_LISP ("internal-make-interpreted-closure-function", + Vinternal_make_interpreted_closure_function, doc: /* Function to filter the env when constructing a closure. */); - Vinternal_filter_closure_env_function = Qnil; + Vinternal_make_interpreted_closure_function = Qnil; Vrun_hooks = intern_c_string ("run-hooks"); staticpro (&Vrun_hooks); |