1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-11 16:08:13 +00:00

native compile interactive functions support

This commit is contained in:
Andrea Corallo 2019-12-07 18:19:00 +01:00
parent 48f5530e79
commit a248dfe2c3
5 changed files with 21 additions and 12 deletions

View File

@ -1076,9 +1076,7 @@ the annotation emission."
(cl-defmethod comp-emit-for-top-level ((form byte-to-native-function))
(let* ((name (byte-to-native-function-name form))
(f (gethash name (comp-ctxt-funcs-h comp-ctxt)))
(args (comp-func-args f))
(c-name (comp-func-c-name f))
(doc (comp-func-doc f)))
(args (comp-func-args f)))
(cl-assert (and name f))
(comp-emit (comp-call 'comp--register-subr
(make-comp-mvar :constant name)
@ -1086,8 +1084,10 @@ the annotation emission."
(make-comp-mvar :constant (if (comp-args-p args)
(comp-args-max args)
'many))
(make-comp-mvar :constant c-name)
(make-comp-mvar :constant doc)))))
(make-comp-mvar :constant (comp-func-c-name f))
(make-comp-mvar :constant (comp-func-doc f))
(make-comp-mvar :constant
(comp-func-int-spec f))))))
(cl-defmethod comp-emit-for-top-level ((form byte-to-native-top-level))
(let ((form (byte-to-native-top-level-form form)))

View File

@ -7450,14 +7450,14 @@ N should be nonnegative. */);
static union Aligned_Lisp_Subr Swatch_gc_cons_threshold =
{{{ PSEUDOVECTOR_FLAG | (PVEC_SUBR << PSEUDOVECTOR_AREA_BITS) },
{ .a4 = watch_gc_cons_threshold },
4, 4, "watch_gc_cons_threshold", 0, {0}}};
4, 4, "watch_gc_cons_threshold", {0}, {0}, 0}};
XSETSUBR (watcher, &Swatch_gc_cons_threshold.s);
Fadd_variable_watcher (Qgc_cons_threshold, watcher);
static union Aligned_Lisp_Subr Swatch_gc_cons_percentage =
{{{ PSEUDOVECTOR_FLAG | (PVEC_SUBR << PSEUDOVECTOR_AREA_BITS) },
{ .a4 = watch_gc_cons_percentage },
4, 4, "watch_gc_cons_percentage", 0, {0}}};
4, 4, "watch_gc_cons_percentage", {0}, {0}, 0}};
XSETSUBR (watcher, &Swatch_gc_cons_percentage.s);
Fadd_variable_watcher (Qgc_cons_percentage, watcher);
}

View File

@ -3304,11 +3304,11 @@ load_comp_unit (dynlib_handle_ptr handle, Lisp_Object file)
DEFUN ("comp--register-subr", Fcomp__register_subr,
Scomp__register_subr,
5, 5, 0,
6, 6, 0,
doc: /* This gets called by top_level_run during load phase to register
each exported subr. */)
(Lisp_Object name, Lisp_Object minarg, Lisp_Object maxarg,
Lisp_Object c_name, Lisp_Object doc)
Lisp_Object c_name, Lisp_Object doc, Lisp_Object intspec)
{
dynlib_handle_ptr handle = xmint_pointer (XCAR (load_handle_stack));
if (!handle)
@ -3325,7 +3325,7 @@ DEFUN ("comp--register-subr", Fcomp__register_subr,
x->s.min_args = XFIXNUM (minarg);
x->s.max_args = FIXNUMP (maxarg) ? XFIXNUM (maxarg) : MANY;
x->s.symbol_name = xstrdup (SSDATA (Fsymbol_name (name)));
x->s.intspec = NULL;
x->s.native_intspec = intspec;
x->s.native_doc = doc;
x->s.native_elisp = true;
defsubr (x);

View File

@ -899,6 +899,10 @@ Value, if non-nil, is a list (interactive SPEC). */)
if (SUBRP (fun))
{
#ifdef HAVE_NATIVE_COMP
if (XSUBR (fun)->native_elisp && XSUBR (fun)->native_intspec)
return XSUBR (fun)->native_intspec;
#endif
const char *spec = XSUBR (fun)->intspec;
if (spec)
return list2 (Qinteractive,

View File

@ -2086,7 +2086,12 @@ struct Lisp_Subr
} function;
short min_args, max_args;
const char *symbol_name;
const char *intspec;
union {
const char *intspec;
#ifdef HAVE_NATIVE_COMP
Lisp_Object native_intspec;
#endif
};
union {
EMACS_INT doc;
#ifdef HAVE_NATIVE_COMP
@ -3106,7 +3111,7 @@ CHECK_INTEGER (Lisp_Object x)
static union Aligned_Lisp_Subr sname = \
{{{ PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, \
{ .a ## maxargs = fnname }, \
minargs, maxargs, lname, intspec, {0}}}; \
minargs, maxargs, lname, {intspec}, {0}, 0}}; \
Lisp_Object fnname
/* defsubr (Sname);