From d73e64076e08cf0bcb81ea9d161fb7409e1bf896 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Sat, 25 Apr 2020 16:13:03 +0100 Subject: Store function documentations in a hash table. * 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. --- lisp/emacs-lisp/comp.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index e96de273359..5096a143a0f 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -216,6 +216,8 @@ Can be one of: 'd-default', 'd-impure' or 'd-ephemeral'. See `comp-ctxt'.") (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 @@ -1214,7 +1216,12 @@ the annotation emission." (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 -- cgit v1.2.3