emacs-diffs
[Top][All Lists]
Advanced

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

feature/native-comp b56de5d 6/7: * src/pdumper.c (dump_do_dump_relocatio


From: Andrea Corallo
Subject: feature/native-comp b56de5d 6/7: * src/pdumper.c (dump_do_dump_relocation): Optimize native dump load.
Date: Sun, 12 Apr 2020 12:13:39 -0400 (EDT)

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

    * src/pdumper.c (dump_do_dump_relocation): Optimize native dump load.
    
    Check just once if is a local build or Emacs got installed.
---
 src/pdumper.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/pdumper.c b/src/pdumper.c
index 490f357..bf6bc3a 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -5296,15 +5296,25 @@ dump_do_dump_relocation (const uintptr_t dump_base,
 #ifdef HAVE_NATIVE_COMP
     case RELOC_NATIVE_COMP_UNIT:
       {
+       static enum { UNKNOWN, LOCAL_BUILD, INSTALLED } installation_state;
        struct Lisp_Native_Comp_Unit *comp_u =
          dump_ptr (dump_base, reloc_offset);
+
        if (!CONSP (comp_u->file))
          error ("Trying to load incoherent dumped .eln");
+
+       if (installation_state == UNKNOWN)
+         /* Check just once if is a local build or Emacs got installed. */
+         installation_state =
+           NILP (Ffile_exists_p (concat2 (Vinvocation_directory,
+                                          XCAR (comp_u->file))))
+           ? LOCAL_BUILD : INSTALLED;
+
        comp_u->file =
-         NILP (Ffile_exists_p (XCAR (comp_u->file)))
-         ? XCDR (comp_u->file) : XCAR (comp_u->file);
-       comp_u->handle =
-         dynlib_open (SSDATA (concat2 (Vinvocation_directory, comp_u->file)));
+         concat2 (Vinvocation_directory,
+                  installation_state == LOCAL_BUILD
+                  ? XCDR (comp_u->file) : XCAR (comp_u->file));
+       comp_u->handle = dynlib_open (SSDATA (comp_u->file));
        if (!comp_u->handle)
          error ("%s", dynlib_error ());
        load_comp_unit (comp_u, true, false);



reply via email to

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