* 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.
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. */
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
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,
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))
#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;