diff options
| author | Stefan Monnier | 2022-10-28 11:33:24 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2022-10-28 11:33:24 -0400 |
| commit | d79cdcd4ff6687c2f0dcfde83ba36732408e52e8 (patch) | |
| tree | 570e8832ca29ba5f8e6db49cd0b9b9acaf831011 /src/eval.c | |
| parent | de5a3fa1e529810f30d461d6682762c9c5e564a4 (diff) | |
| download | emacs-d79cdcd4ff6687c2f0dcfde83ba36732408e52e8.tar.gz emacs-d79cdcd4ff6687c2f0dcfde83ba36732408e52e8.zip | |
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) */) | |||
| 550 | CHECK_STRING (docstring); | 550 | CHECK_STRING (docstring); |
| 551 | cdr = Fcons (XCAR (cdr), Fcons (docstring, XCDR (XCDR (cdr)))); | 551 | cdr = Fcons (XCAR (cdr), Fcons (docstring, XCDR (XCDR (cdr)))); |
| 552 | } | 552 | } |
| 553 | Lisp_Object env | 553 | if (NILP (Vinternal_make_interpreted_closure_function)) |
| 554 | = NILP (Vinternal_filter_closure_env_function) | 554 | return Fcons (Qclosure, Fcons (Vinternal_interpreter_environment, cdr)); |
| 555 | ? Vinternal_interpreter_environment | 555 | else |
| 556 | /* FIXME: This macroexpands the body, so we should use the resulting | 556 | return call2 (Vinternal_make_interpreted_closure_function, |
| 557 | macroexpanded code! */ | 557 | Fcons (Qlambda, cdr), |
| 558 | : call2 (Vinternal_filter_closure_env_function, | 558 | Vinternal_interpreter_environment); |
| 559 | Fcons (Qprogn, CONSP (cdr) ? XCDR (cdr) : cdr), | ||
| 560 | Vinternal_interpreter_environment); | ||
| 561 | return Fcons (Qclosure, Fcons (env, cdr)); | ||
| 562 | } | 559 | } |
| 563 | else | 560 | else |
| 564 | /* Simply quote the argument. */ | 561 | /* Simply quote the argument. */ |
| @@ -4361,10 +4358,10 @@ alist of active lexical bindings. */); | |||
| 4361 | (Just imagine if someone makes it buffer-local). */ | 4358 | (Just imagine if someone makes it buffer-local). */ |
| 4362 | Funintern (Qinternal_interpreter_environment, Qnil); | 4359 | Funintern (Qinternal_interpreter_environment, Qnil); |
| 4363 | 4360 | ||
| 4364 | DEFVAR_LISP ("internal-filter-closure-env-function", | 4361 | DEFVAR_LISP ("internal-make-interpreted-closure-function", |
| 4365 | Vinternal_filter_closure_env_function, | 4362 | Vinternal_make_interpreted_closure_function, |
| 4366 | doc: /* Function to filter the env when constructing a closure. */); | 4363 | doc: /* Function to filter the env when constructing a closure. */); |
| 4367 | Vinternal_filter_closure_env_function = Qnil; | 4364 | Vinternal_make_interpreted_closure_function = Qnil; |
| 4368 | 4365 | ||
| 4369 | Vrun_hooks = intern_c_string ("run-hooks"); | 4366 | Vrun_hooks = intern_c_string ("run-hooks"); |
| 4370 | staticpro (&Vrun_hooks); | 4367 | staticpro (&Vrun_hooks); |