From: Andrea Corallo Date: Sun, 12 Apr 2020 12:06:14 +0000 (+0100) Subject: * src/pdumper.c (dump_do_dump_relocation): Optimize native dump load. X-Git-Tag: emacs-28.0.90~2727^2~712 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b56de5dda235599c0dcb26c9d4936aaf8be46db3;p=emacs.git * src/pdumper.c (dump_do_dump_relocation): Optimize native dump load. Check just once if is a local build or Emacs got installed. --- diff --git a/src/pdumper.c b/src/pdumper.c index 490f357219d..bf6bc3a3bc3 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);