From 9709ff1436d547664e6b3ca252cd37665467b4de Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Wed, 18 Sep 2019 12:46:45 +0200 Subject: [PATCH] add native_elisp field into Lisp_Subr --- src/comp.c | 1 + src/data.c | 14 ++++++++++++++ src/lisp.h | 3 +++ src/pdumper.c | 6 +++++- 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/comp.c b/src/comp.c index 8aadd5acc91..ca22b81de13 100644 --- a/src/comp.c +++ b/src/comp.c @@ -3228,6 +3228,7 @@ load_comp_unit (dynlib_handle_ptr handle) x->s.min_args = minargs; x->s.max_args = maxargs; x->s.symbol_name = SSDATA (Fsymbol_name (Qsym)); + x->s.native_elisp = true; defsubr(x); func_list = XCDR (func_list); diff --git a/src/data.c b/src/data.c index 56e363f16b6..70068c30a71 100644 --- a/src/data.c +++ b/src/data.c @@ -864,6 +864,17 @@ SUBR must be a built-in function. */) return build_string (name); } +#ifdef HAVE_NATIVE_COMP +DEFUN ("subr-native-elispp", Fsubr_native_elispp, Ssubr_native_elispp, 1, 1, 0, + doc: /* Return t if the subr is native compiled elisp, +nil otherwise. */) + (Lisp_Object subr) +{ + CHECK_SUBR (subr); + return XSUBR (subr)->native_elisp ? Qt : Qnil; +} +#endif + DEFUN ("interactive-form", Finteractive_form, Sinteractive_form, 1, 1, 0, doc: /* Return the interactive form of CMD or nil if none. If CMD is not a command, the return value is nil. @@ -3983,6 +3994,9 @@ syms_of_data (void) defsubr (&Sbyteorder); defsubr (&Ssubr_arity); defsubr (&Ssubr_name); +#ifdef HAVE_NATIVE_COMP + defsubr (&Ssubr_native_elispp); +#endif #ifdef HAVE_MODULES defsubr (&Suser_ptrp); #endif diff --git a/src/lisp.h b/src/lisp.h index cb3487675e7..a84c08e5669 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2088,6 +2088,9 @@ struct Lisp_Subr const char *symbol_name; const char *intspec; EMACS_INT doc; +#ifdef HAVE_NATIVE_COMP + bool native_elisp; +#endif } GCALIGNED_STRUCT; union Aligned_Lisp_Subr { diff --git a/src/pdumper.c b/src/pdumper.c index 3ee11460405..7b3109607b4 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -2922,7 +2922,10 @@ dump_bool_vector (struct dump_context *ctx, const struct Lisp_Vector *v) static dump_off dump_subr (struct dump_context *ctx, const struct Lisp_Subr *subr) { -#if CHECK_STRUCTS && !defined (HASH_Lisp_Subr_594AB72B54) +#if CHECK_STRUCTS && ((defined (HAVE_NATIVE_COMP) \ + && !defined (HASH_Lisp_Subr_D4F15794AF)) \ + || (!defined (HAVE_NATIVE_COMP) \ + && !defined (HASH_Lisp_Subr_594AB72B54))) # error "Lisp_Subr changed. See CHECK_STRUCTS comment in config.h." #endif struct Lisp_Subr out; @@ -2934,6 +2937,7 @@ dump_subr (struct dump_context *ctx, const struct Lisp_Subr *subr) dump_field_emacs_ptr (ctx, &out, subr, &subr->symbol_name); dump_field_emacs_ptr (ctx, &out, subr, &subr->intspec); DUMP_FIELD_COPY (&out, subr, doc); + DUMP_FIELD_COPY (&out, subr, native_elisp); return dump_object_finish (ctx, &out, sizeof (out)); } -- 2.39.5