1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-13 09:32:47 +00:00

Sanity check on lambdas fixups

* src/pdumper.c (dump_do_dump_relocation): While fixing up lambda
	relocation verify placeholder coherency.

	* src/comp.c (syms_of_comp): Define symbol 'lambda-fixup'.

	* lisp/emacs-lisp/comp.el (comp-finalize-container): Leave a
	lambda-fixup as placeholder in the relocation as a sanity check.
This commit is contained in:
Andrea Corallo 2020-05-13 08:52:47 +01:00
parent 2b064c780c
commit e351a12216
3 changed files with 7 additions and 3 deletions

View File

@ -2158,7 +2158,7 @@ These are substituted with a normal 'set' op."
;; from the corresponding m-var.
collect (if (gethash obj
(comp-ctxt-byte-func-to-func-h comp-ctxt))
nil
'lambda-fixup
obj))))
(defun comp-finalize-relocs ()

View File

@ -3891,6 +3891,7 @@ syms_of_comp (void)
DEFSYM (Qfixnum, "fixnum");
DEFSYM (Qscratch, "scratch");
DEFSYM (Qlate, "late");
DEFSYM (Qlambda_fixup, "lambda-fixup");
/* To be signaled by the compiler. */
DEFSYM (Qnative_compiler_error, "native-compiler-error");

View File

@ -5342,11 +5342,14 @@ dump_do_dump_relocation (const uintptr_t dump_base,
if (!NILP (lambda_data_idx))
{
/* This is an anonymous lambda.
We must fixup data_vec so the lambda can be referenced
We must fixup d_reloc_imp so the lambda can be referenced
by code. */
Lisp_Object tem;
XSETSUBR (tem, subr);
comp_u->data_imp_relocs[XFIXNUM (lambda_data_idx)] = tem;
Lisp_Object *fixup =
&(comp_u->data_imp_relocs[XFIXNUM (lambda_data_idx)]);
eassert (EQ (*fixup, Qlambda_fixup));
*fixup = tem;
Fputhash (tem, Qnil, comp_u->lambda_gc_guard);
}
break;