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.
This commit is contained in:
Andrea Corallo 2020-04-25 16:13:03 +01:00
parent 9c4c0af89d
commit d73e64076e
7 changed files with 31 additions and 16 deletions

View file

@ -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