* src/pdumper.c (dump_subr): Update Lisp_Subr hash.
(dump_subr): Update for new compilation unit layout.
(dump_vectorlike): Update pvec_type hash.
* src/lisp.h (struct Lisp_Subr): Remove 'native_doc' index.
(DEFUN): Update macro for new compilation unit
layout.
* src/doc.c (Fdocumentation): Update for new compilation unit
layout.
* src/comp.h (struct Lisp_Native_Comp_Unit):
Add 'data_fdoc_h' field.
* src/comp.c (TEXT_FDOC_SYM): New macro.
(emit_ctxt_code): Emit function documentations.
(load_comp_unit): Load function documentation.
(Fcomp__register_subr): Rename parameter.
(Fcomp__register_subr): Update for new compilation unit
layout.
* src/alloc.c (mark_object): Update for new compilation unit
layout.
(syms_of_alloc): Likewise.
* lisp/emacs-lisp/comp.el (comp-ctxt): Add doc-index-h slot.
(comp-emit-for-top-level): Emit doc index as 'comp--register-subr'
doc parameter.
(sym-to-c-name-h (make-hash-table :test #'eq) :type hash-table
:documentation "symbol-function -> c-name.
This is only for optimizing intra CU calls at speed 3.")
+ (doc-index-h (make-hash-table :test #'eql) :type hash-table
+ :documentation "Documentation index -> documentation")
(d-default (make-comp-data-container) :type comp-data-container
:documentation "Standard data relocated in use by functions.")
(d-impure (make-comp-data-container) :type comp-data-container
(comp-args-max args)
'many))
(make-comp-mvar :constant c-name)
- (make-comp-mvar :constant (comp-func-doc f))
+ (make-comp-mvar
+ :constant
+ (let* ((h (comp-ctxt-doc-index-h comp-ctxt))
+ (i (hash-table-count h)))
+ (puthash i (comp-func-doc f) h)
+ i))
(make-comp-mvar :constant
(comp-func-int-spec f))
;; This is the compilation unit it-self passed as
set_vector_marked (ptr);
struct Lisp_Subr *subr = XSUBR (obj);
mark_object (subr->native_intspec);
- mark_object (subr->native_doc);
mark_object (subr->native_comp_u[0]);
}
break;
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}};
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}};
XSETSUBR (watcher, &Swatch_gc_cons_percentage.s);
Fadd_variable_watcher (Qgc_cons_percentage, watcher);
}
#define DATA_RELOC_SYM "d_reloc"
#define DATA_RELOC_IMPURE_SYM "d_reloc_imp"
#define DATA_RELOC_EPHEMERAL_SYM "d_reloc_eph"
+
#define FUNC_LINK_TABLE_SYM "freloc_link_table"
#define LINK_TABLE_HASH_SYM "freloc_hash"
#define COMP_UNIT_SYM "comp_unit"
#define TEXT_DATA_RELOC_SYM "text_data_reloc"
#define TEXT_DATA_RELOC_IMPURE_SYM "text_data_reloc_imp"
#define TEXT_DATA_RELOC_EPHEMERAL_SYM "text_data_reloc_eph"
+
#define TEXT_OPTIM_QLY "text_optim_qly"
+#define TEXT_FDOC_SYM "text_data_fdoc"
+
#define SPEED XFIXNUM (Fsymbol_value (Qcomp_speed))
#define COMP_DEBUG XFIXNUM (Fsymbol_value (Qcomp_debug))
Fsymbol_value (Qcomp_debug)) };
emit_static_object (TEXT_OPTIM_QLY, Flist (2, opt_qly));
+ emit_static_object (TEXT_FDOC_SYM,
+ CALL1I (comp-ctxt-doc-index-h, Vcomp_ctxt));
+
comp.current_thread_ref =
gcc_jit_lvalue_as_rvalue (
gcc_jit_context_new_global (
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. */
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 intspec,
+ Lisp_Object c_name, Lisp_Object doc_idx, Lisp_Object intspec,
Lisp_Object comp_u)
{
dynlib_handle_ptr handle = XNATIVE_COMP_UNIT (comp_u)->handle;
x->s.max_args = FIXNUMP (maxarg) ? XFIXNUM (maxarg) : MANY;
x->s.symbol_name = xstrdup (SSDATA (Fsymbol_name (name)));
x->s.native_intspec = intspec;
- x->s.native_doc = doc;
+ x->s.doc = XFIXNUM (doc_idx);
x->s.native_comp_u[0] = comp_u;
Lisp_Object tem;
XSETSUBR (tem, &x->s);
/* Original eln file loaded. */
Lisp_Object file;
Lisp_Object optimize_qualities;
+ /* Hash doc-idx -> function documentaiton. */
+ Lisp_Object data_fdoc_h;
/* Analogous to the constant vector but per compilation unit. */
Lisp_Object data_vec;
/* Same but for data that cannot be moved to pure space.
fun = XCDR (fun);
#ifdef HAVE_NATIVE_COMP
if (!NILP (Fsubr_native_elisp_p (fun)))
- doc = XSUBR (fun)->native_doc;
+ doc =
+ Fgethash (make_fixnum (XSUBR (fun)->doc),
+ XNATIVE_COMP_UNIT (Fsubr_native_comp_unit (fun))->data_fdoc_h,
+ Qnil);
else
#endif
if (SUBRP (fun))
const char *intspec;
Lisp_Object native_intspec;
};
- union {
- EMACS_INT doc;
- Lisp_Object native_doc;
- };
+ EMACS_INT doc;
Lisp_Object native_comp_u[NATIVE_COMP_FLAG];
} GCALIGNED_STRUCT;
union Aligned_Lisp_Subr
static union Aligned_Lisp_Subr sname = \
{{{ PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, \
{ .a ## maxargs = fnname }, \
- minargs, maxargs, lname, {intspec}, {0}}}; \
+ minargs, maxargs, lname, {intspec}, 0}}; \
Lisp_Object fnname
/* defsubr (Sname);
dump_subr (struct dump_context *ctx, const struct Lisp_Subr *subr)
{
#if CHECK_STRUCTS && ((defined (HAVE_NATIVE_COMP) \
- && !defined (HASH_Lisp_Subr_D4F15794AF)) \
+ && !defined (HASH_Lisp_Subr_99B6674034)) \
|| (!defined (HAVE_NATIVE_COMP) \
&& !defined (HASH_Lisp_Subr_594AB72B54)))
# error "Lisp_Subr changed. See CHECK_STRUCTS comment in config.h."
COLD_OP_NATIVE_SUBR,
make_lisp_ptr ((void *) subr, Lisp_Vectorlike));
dump_field_lv (ctx, &out, subr, &subr->native_intspec, WEIGHT_NORMAL);
- dump_field_lv (ctx, &out, subr, &subr->native_doc, WEIGHT_NORMAL);
}
else
{
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, doc);
if (NATIVE_COMP_FLAG)
dump_field_lv (ctx, &out, subr, &subr->native_comp_u[0], WEIGHT_NORMAL);
Lisp_Object lv,
dump_off offset)
{
-#if CHECK_STRUCTS && !defined HASH_pvec_type_A4A6E9984D
+#if CHECK_STRUCTS && !defined HASH_pvec_type_F5BA506141
# error "pvec_type changed. See CHECK_STRUCTS comment in config.h."
#endif
const struct Lisp_Vector *v = XVECTOR (lv);