int staticidx;
-/* Lisp of freed native compilation unit handles.
-
- Because during GC Vcomp_loaded_handles can't be used (hash table) temporary
- annotate here and update Vcomp_loaded_handles when finished.
-*/
-
-static Lisp_Object freed_cu_handles[NATIVE_COMP_FLAG];
-
static void *pure_alloc (size_t, int);
/* Return PTR rounded up to the next multiple of ALIGNMENT. */
PSEUDOVEC_STRUCT (vector, Lisp_Native_Comp_Unit);
eassert (cu->handle);
dynlib_close (cu->handle);
- /* We'll update Vcomp_loaded_handles when finished. */
- freed_cu_handles[0] =
- Fcons (make_mint_ptr (cu->handle), freed_cu_handles[0]);
- set_cons_marked (XCONS (freed_cu_handles[0]));
}
}
if (garbage_collection_messages)
message1_nolog ("Garbage collecting...");
- if (NATIVE_COMP_FLAG)
- freed_cu_handles[0] = Qnil;
-
block_input ();
shrink_regexp_cache ();
gc_in_progress = 0;
- if (NATIVE_COMP_FLAG)
- FOR_EACH_TAIL (freed_cu_handles[0])
- Fputhash (XCAR (freed_cu_handles[0]), Qnil, Vcomp_loaded_handles);
-
unblock_input ();
consing_until_gc = gc_threshold
#define DATA_RELOC_IMPURE_SYM "d_reloc_imp"
#define FUNC_LINK_TABLE_SYM "freloc_link_table"
#define LINK_TABLE_HASH_SYM "freloc_hash"
+#define COMP_UNIT_SYM "comp_unit"
#define TEXT_DATA_RELOC_SYM "text_data_reloc"
#define TEXT_DATA_RELOC_IMPURE_SYM "text_data_reloc_imp"
gcc_jit_type_get_pointer (comp.void_ptr_type),
PURE_RELOC_SYM));
+ gcc_jit_context_new_global (
+ comp.ctxt,
+ NULL,
+ GCC_JIT_GLOBAL_EXPORTED,
+ gcc_jit_type_get_pointer (comp.lisp_obj_ptr_type),
+ COMP_UNIT_SYM);
+
declare_imported_data ();
/* Functions imported from Lisp code. */
{
dynlib_handle_ptr handle = comp_u->handle;
Lisp_Object lisp_handle = make_mint_ptr (handle);
- bool reloading_cu = !NILP (Fgethash (lisp_handle, Vcomp_loaded_handles, Qnil));
- Lisp_Object comp_u_obj;
- XSETNATIVE_COMP_UNIT (comp_u_obj, comp_u);
+ Lisp_Object comp_u_lisp_obj;
+ XSETNATIVE_COMP_UNIT (comp_u_lisp_obj, comp_u);
+
+ Lisp_Object *saved_cu = dynlib_sym (handle, COMP_UNIT_SYM);
+ if (!saved_cu)
+ xsignal1 (Qnative_lisp_file_inconsistent, comp_u->file);
+ bool reloading_cu = *saved_cu ? true : false;
if (reloading_cu)
/* 'dlopen' returns the same handle when trying to load two times
We must *never* mess with static pointers in an already loaded
eln. */
{
- comp_u_obj = Fgethash (lisp_handle, Vcomp_loaded_handles, Qnil);
- comp_u = XNATIVE_COMP_UNIT (comp_u_obj);
+ comp_u_lisp_obj = *saved_cu;
+ comp_u = XNATIVE_COMP_UNIT (comp_u_lisp_obj);
}
else
- Fputhash (lisp_handle, comp_u_obj, Vcomp_loaded_handles);
+ *saved_cu = comp_u_lisp_obj;
freloc_check_fill ();
if (!loading_dump)
/* Executing this will perform all the expected environment
modifications. */
- top_level_run (comp_u_obj);
+ top_level_run (comp_u_lisp_obj);
return;
}
doc: /* Hash table symbol-function -> function-c-name. For
internal use during */);
Vcomp_sym_subr_c_name_h = CALLN (Fmake_hash_table);
- DEFVAR_LISP ("comp-loaded-handles", Vcomp_loaded_handles,
- doc: /* Hash table keeping track of the currently
- loaded compilation unit: handle -> comp_u */);
- Vcomp_loaded_handles = CALLN (Fmake_hash_table, QCtest, Qequal);
}
#endif /* HAVE_NATIVE_COMP */