summaryrefslogtreecommitdiff
path: root/src/comp.c
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-03-19 15:11:15 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2022-03-19 15:11:37 +0100
commit71b8f1fc635d9bbe00ca89457065e0c83456ac43 (patch)
tree49edc7bebd20340555baf2a28ef8a4dcd05504db /src/comp.c
parentc79e0188e849715a7c4dc306c93ad8d0b3517d32 (diff)
downloademacs-71b8f1fc635d9bbe00ca89457065e0c83456ac43.tar.gz
Make `command-modes' work for (native-compiled) subrs, too
* lisp/emacs-lisp/comp.el (comp-func): Add a command-modes slot. (comp-spill-lap-function, comp-intern-func-in-ctxt): Fill it. (comp-emit-for-top-level, comp-emit-lambda-for-top-level): Use it. * src/alloc.c (mark_object): Mark the command_modes slot. * src/comp.c (make_subr): Add a command_modes parameter. (Fcomp__register_lambda): Use it. (Fcomp__register_subr): Ditto. * src/data.c (Fcommand_modes): Output the command_modes data for subrs (bug#54437). * src/lisp.h (GCALIGNED_STRUCT): Add a command_modes slot. * src/pdumper.c (dump_subr): Update hash. (dump_subr): Dump the command_modes slot.
Diffstat (limited to 'src/comp.c')
-rw-r--r--src/comp.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/comp.c b/src/comp.c
index 6449eedb278..499eee7e709 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -5411,7 +5411,7 @@ native_function_doc (Lisp_Object function)
static Lisp_Object
make_subr (Lisp_Object symbol_name, Lisp_Object minarg, Lisp_Object maxarg,
Lisp_Object c_name, Lisp_Object type, Lisp_Object doc_idx,
- Lisp_Object intspec, Lisp_Object comp_u)
+ Lisp_Object intspec, Lisp_Object command_modes, Lisp_Object comp_u)
{
struct Lisp_Native_Comp_Unit *cu = XNATIVE_COMP_UNIT (comp_u);
dynlib_handle_ptr handle = cu->handle;
@@ -5445,6 +5445,7 @@ make_subr (Lisp_Object symbol_name, Lisp_Object minarg, Lisp_Object maxarg,
x->s.max_args = FIXNUMP (maxarg) ? XFIXNUM (maxarg) : MANY;
x->s.symbol_name = xstrdup (SSDATA (symbol_name));
x->s.native_intspec = intspec;
+ x->s.command_modes = command_modes;
x->s.doc = XFIXNUM (doc_idx);
#ifdef HAVE_NATIVE_COMP
x->s.native_comp_u = comp_u;
@@ -5467,12 +5468,17 @@ This gets called by top_level_run during the load phase. */)
{
Lisp_Object doc_idx = FIRST (rest);
Lisp_Object intspec = SECOND (rest);
+ Lisp_Object command_modes = Qnil;
+ if (!NILP (XCDR (XCDR (rest))))
+ command_modes = THIRD (rest);
+
struct Lisp_Native_Comp_Unit *cu = XNATIVE_COMP_UNIT (comp_u);
if (cu->loaded_once)
return Qnil;
Lisp_Object tem =
- make_subr (c_name, minarg, maxarg, c_name, type, doc_idx, intspec, comp_u);
+ make_subr (c_name, minarg, maxarg, c_name, type, doc_idx, intspec,
+ command_modes, comp_u);
/* We must protect it against GC because the function is not
reachable through symbols. */
@@ -5497,9 +5503,13 @@ This gets called by top_level_run during the load phase. */)
{
Lisp_Object doc_idx = FIRST (rest);
Lisp_Object intspec = SECOND (rest);
+ Lisp_Object command_modes = Qnil;
+ if (!NILP (XCDR (XCDR (rest))))
+ command_modes = THIRD (rest);
+
Lisp_Object tem =
make_subr (SYMBOL_NAME (name), minarg, maxarg, c_name, type, doc_idx,
- intspec, comp_u);
+ intspec, command_modes, comp_u);
defalias (name, tem);