mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-12 22:40:46 -08:00
Lazy load function documentation.
* src/comp.c (native_function_doc): New function. (load_comp_unit): Do not load function doc during load. * src/comp.h: Extern 'native_function_doc'. * src/doc.c (Fdocumentation): Call 'native_function_doc' to retrive function doc. * src/pdumper.c (dump_native_comp_unit): Zero 'data_fdoc_h' before dumping.
This commit is contained in:
parent
f691af80f1
commit
a7fac2e91f
4 changed files with 22 additions and 6 deletions
17
src/comp.c
17
src/comp.c
|
|
@ -3627,7 +3627,6 @@ load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u, bool loading_dump,
|
|||
comp_u->data_vec = load_static_obj (comp_u, TEXT_DATA_RELOC_SYM);
|
||||
comp_u->data_impure_vec =
|
||||
load_static_obj (comp_u, TEXT_DATA_RELOC_IMPURE_SYM);
|
||||
comp_u->data_fdoc_h = load_static_obj (comp_u, TEXT_FDOC_SYM);
|
||||
|
||||
if (!NILP (Vpurify_flag))
|
||||
/* Non impure can be copied into pure space. */
|
||||
|
|
@ -3672,6 +3671,22 @@ load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u, bool loading_dump,
|
|||
return;
|
||||
}
|
||||
|
||||
Lisp_Object
|
||||
native_function_doc (Lisp_Object function)
|
||||
{
|
||||
struct Lisp_Native_Comp_Unit *cu =
|
||||
XNATIVE_COMP_UNIT (Fsubr_native_comp_unit (function));
|
||||
|
||||
if (NILP (cu->data_fdoc_h))
|
||||
cu->data_fdoc_h = load_static_obj (cu, TEXT_FDOC_SYM);
|
||||
|
||||
eassert (!NILP (cu->data_fdoc_h));
|
||||
|
||||
return Fgethash (make_fixnum (XSUBR (function)->doc),
|
||||
cu->data_fdoc_h,
|
||||
Qnil);
|
||||
}
|
||||
|
||||
DEFUN ("comp--register-subr", Fcomp__register_subr, Scomp__register_subr,
|
||||
7, 7, 0,
|
||||
doc: /* This gets called by top_level_run during load phase to register
|
||||
|
|
|
|||
|
|
@ -69,6 +69,8 @@ extern void hash_native_abi (void);
|
|||
extern void load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u,
|
||||
bool loading_dump, bool late_load);
|
||||
|
||||
extern Lisp_Object native_function_doc (Lisp_Object function);
|
||||
|
||||
extern void syms_of_comp (void);
|
||||
|
||||
extern void maybe_defer_native_compilation (Lisp_Object function_name,
|
||||
|
|
|
|||
|
|
@ -337,10 +337,7 @@ string is passed through `substitute-command-keys'. */)
|
|||
fun = XCDR (fun);
|
||||
#ifdef HAVE_NATIVE_COMP
|
||||
if (!NILP (Fsubr_native_elisp_p (fun)))
|
||||
doc =
|
||||
Fgethash (make_fixnum (XSUBR (fun)->doc),
|
||||
XNATIVE_COMP_UNIT (Fsubr_native_comp_unit (fun))->data_fdoc_h,
|
||||
Qnil);
|
||||
doc = native_function_doc (fun);
|
||||
else
|
||||
#endif
|
||||
if (SUBRP (fun))
|
||||
|
|
|
|||
|
|
@ -2982,8 +2982,10 @@ dump_subr (struct dump_context *ctx, const struct Lisp_Subr *subr)
|
|||
#ifdef HAVE_NATIVE_COMP
|
||||
static dump_off
|
||||
dump_native_comp_unit (struct dump_context *ctx,
|
||||
const struct Lisp_Native_Comp_Unit *comp_u)
|
||||
struct Lisp_Native_Comp_Unit *comp_u)
|
||||
{
|
||||
/* Have function documentation always lazy loaded to optimize load-time. */
|
||||
comp_u->data_fdoc_h = Qnil;
|
||||
START_DUMP_PVEC (ctx, &comp_u->header, struct Lisp_Native_Comp_Unit, out);
|
||||
dump_pseudovector_lisp_fields (ctx, &out->header, &comp_u->header);
|
||||
out->handle = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue