* Expose `comp-loaded-comp-units-h'
authorAndrea Corallo <akrl@sdf.org>
Wed, 17 Aug 2022 20:29:33 +0000 (22:29 +0200)
committerAndrea Corallo <akrl@sdf.org>
Thu, 18 Aug 2022 09:03:25 +0000 (11:03 +0200)
* src/comp.c : remove 'all_loaded_comp_units_h'.
(syms_of_comp): Define `comp-loaded-comp-units-h'.
(register_native_comp_unit, Fnative_elisp_load): Use it.

src/comp.c

index 21d2ee5300b4d98a82906a0f24377c5e56064475..70e7d5a8bbf4710c09c4f8135e2865097dac6bf8 100644 (file)
@@ -5017,8 +5017,6 @@ helper_GET_SYMBOL_WITH_POSITION (Lisp_Object a)
 \f
 /* `native-comp-eln-load-path' clean-up support code.  */
 
-static Lisp_Object all_loaded_comp_units_h;
-
 #ifdef WINDOWSNT
 static Lisp_Object
 return_nil (Lisp_Object arg)
@@ -5060,11 +5058,12 @@ eln_load_path_final_clean_up (void)
 }
 
 /* This function puts the compilation unit in the
-  `all_loaded_comp_units_h` hashmap.  */
+  `Vcomp_loaded_comp_units_h` hashmap.  */
 static void
 register_native_comp_unit (Lisp_Object comp_u)
 {
-  Fputhash (XNATIVE_COMP_UNIT (comp_u)->file, comp_u, all_loaded_comp_units_h);
+  Fputhash (
+    XNATIVE_COMP_UNIT (comp_u)->file, comp_u, Vcomp_loaded_comp_units_h);
 }
 
 \f
@@ -5552,7 +5551,7 @@ LATE_LOAD has to be non-nil when loading for deferred compilation.  */)
   struct Lisp_Native_Comp_Unit *comp_u = allocate_native_comp_unit ();
   Lisp_Object encoded_filename = ENCODE_FILE (filename);
 
-  if (!NILP (Fgethash (filename, all_loaded_comp_units_h, Qnil))
+  if (!NILP (Fgethash (filename, Vcomp_loaded_comp_units_h, Qnil))
       && !file_in_eln_sys_dir (filename)
       && !NILP (Ffile_writable_p (filename)))
     {
@@ -5754,10 +5753,6 @@ compiled one.  */);
   staticpro (&loadsearch_re_list);
   loadsearch_re_list = Qnil;
 
-  staticpro (&all_loaded_comp_units_h);
-  all_loaded_comp_units_h =
-    CALLN (Fmake_hash_table, QCweakness, Qkey_and_value, QCtest, Qequal);
-
   DEFVAR_LISP ("comp-ctxt", Vcomp_ctxt,
               doc: /* The compiler context.  */);
   Vcomp_ctxt = Qnil;
@@ -5817,6 +5812,12 @@ For internal use.  */);
               doc: /* When non-nil assume the file being compiled to
 be preloaded.  */);
 
+  DEFVAR_LISP ("comp-loaded-comp-units-h", Vcomp_loaded_comp_units_h,
+              doc: /* Hash table recording all loaded compilation units.
+file -> CU.  */);
+  Vcomp_loaded_comp_units_h =
+    CALLN (Fmake_hash_table, QCweakness, Qvalue, QCtest, Qequal);
+
   Fprovide (intern_c_string ("native-compile"), Qnil);
 #endif /* #ifdef HAVE_NATIVE_COMP */