}
static void
-load_comp_unit (Lisp_Object comp_u_obj, Lisp_Object file)
+load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u)
{
- struct Lisp_Native_Comp_Unit *comp_u = XNATIVE_COMP_UNIT (comp_u_obj);
dynlib_handle_ptr handle = comp_u->handle;
struct thread_state ***current_thread_reloc =
dynlib_sym (handle, CURRENT_THREAD_RELOC_SYM);
&& data_relocs
&& freloc_link_table
&& top_level_run))
- xsignal1 (Qnative_lisp_file_inconsistent, file);
+ xsignal1 (Qnative_lisp_file_inconsistent, comp_u->file);
*current_thread_reloc = ¤t_thread;
*pure_reloc = (EMACS_INT **)&pure;
/* Imported functions. */
*freloc_link_table = freloc.link_table;
+ Lisp_Object comp_u_obj;
+ XSETNATIVE_COMP_UNIT (comp_u_obj, comp_u);
+
/* Executing this will perform all the expected environment modification. */
top_level_run (comp_u_obj);
copy_file_fd (fd_out, fd_in, &st, Qnil, file);
dynlib_handle_ptr handle =
dynlib_open (format_string ("/proc/%d/fd/%d", getpid (), fd_out));
- Lisp_Object comp_u = make_native_comp_u (fd_in, handle);
if (!handle)
xsignal2 (Qnative_lisp_load_failed, file, build_string (dynlib_error ()));
-
- load_comp_unit (comp_u, file);
+ struct Lisp_Native_Comp_Unit *comp_u = allocate_native_comp_unit();
+ comp_u->file = file;
+ comp_u->fd = fd_out;
+ comp_u->handle = handle;
+ load_comp_unit (comp_u);
return Qt;
}
struct Lisp_Native_Comp_Unit
{
union vectorlike_header header;
+ /* Original eln file loaded (just for debug purpose). */
+ Lisp_Object file;
/* Analogous to the constant vector but per compilation unit. */
Lisp_Object data_vec;
/* Compilation unit file descriptor and handle. */
return SUBRP (a) && XSUBR (a)->native_comp_u;
}
-INLINE Lisp_Object
-make_native_comp_u (int fd, dynlib_handle_ptr handle)
-{
- struct Lisp_Native_Comp_Unit *x =
- ALLOCATE_ZEROED_PSEUDOVECTOR (struct Lisp_Native_Comp_Unit, data_vec,
- PVEC_NATIVE_COMP_UNIT);
- x->fd = fd;
- x->handle = handle;
- Lisp_Object cu;
- XSETNATIVE_COMP_UNIT (cu, x);
- return cu;
+INLINE struct Lisp_Native_Comp_Unit *
+allocate_native_comp_unit (void)
+{
+ return ALLOCATE_ZEROED_PSEUDOVECTOR (struct Lisp_Native_Comp_Unit, data_vec,
+ PVEC_NATIVE_COMP_UNIT);
}
#endif