summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2019-12-22 09:28:39 +0100
committerAndrea Corallo <akrl@sdf.org>2020-01-01 11:38:14 +0100
commitb275ddd63a24b15dd8f90ea0c4f27341a8dfa977 (patch)
tree7454035f4c6a1bb0d41dcbb562a7bfa63acda785 /src
parent5ecb71c1e65038b79933c06e1c0303b3e58ef4b5 (diff)
downloademacs-b275ddd63a24b15dd8f90ea0c4f27341a8dfa977.tar.gz
emacs-b275ddd63a24b15dd8f90ea0c4f27341a8dfa977.tar.bz2
emacs-b275ddd63a24b15dd8f90ea0c4f27341a8dfa977.zip
rationalize load functions
Diffstat (limited to 'src')
-rw-r--r--src/comp.c16
-rw-r--r--src/comp.h2
-rw-r--r--src/lisp.h16
3 files changed, 17 insertions, 17 deletions
diff --git a/src/comp.c b/src/comp.c
index 9f8c24f3cf0..6d496e89bf7 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -3218,9 +3218,8 @@ load_static_obj (dynlib_handle_ptr handle, const char *name)
}
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);
@@ -3234,7 +3233,7 @@ load_comp_unit (Lisp_Object comp_u_obj, Lisp_Object file)
&& 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 = &current_thread;
*pure_reloc = (EMACS_INT **)&pure;
@@ -3250,6 +3249,9 @@ load_comp_unit (Lisp_Object comp_u_obj, Lisp_Object file)
/* 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);
@@ -3319,11 +3321,13 @@ DEFUN ("native-elisp-load", Fnative_elisp_load, Snative_elisp_load, 1, 1, 0,
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;
}
diff --git a/src/comp.h b/src/comp.h
index 8b83911f53c..677ffdc4d7f 100644
--- a/src/comp.h
+++ b/src/comp.h
@@ -26,6 +26,8 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
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. */
diff --git a/src/lisp.h b/src/lisp.h
index 81ccae5683f..3c3a9e22cf3 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4769,17 +4769,11 @@ SUBRP_NATIVE_COMPILEDP (Lisp_Object a)
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