emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/native-comp e351a12 14/17: Sanity check on lambdas fixups


From: Andrea Corallo
Subject: feature/native-comp e351a12 14/17: Sanity check on lambdas fixups
Date: Fri, 15 May 2020 15:07:57 -0400 (EDT)

branch: feature/native-comp
commit e351a12216519d3ed09892752ce0b137f6672986
Author: Andrea Corallo <address@hidden>
Commit: Andrea Corallo <address@hidden>

    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.
---
 lisp/emacs-lisp/comp.el | 2 +-
 src/comp.c              | 1 +
 src/pdumper.c           | 7 +++++--
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index d546218..7de8e01 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -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 ()
diff --git a/src/comp.c b/src/comp.c
index 3a362fd..d1f8fe2 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -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");
diff --git a/src/pdumper.c b/src/pdumper.c
index a1b71e8..a6d12b6 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]