diff options
| author | Andrea Corallo | 2020-04-26 09:11:33 +0100 |
|---|---|---|
| committer | Andrea Corallo | 2020-04-26 10:10:17 +0100 |
| commit | bb4cf13c47a1a24ce83233cc7b77dc87fc274d52 (patch) | |
| tree | 2ae6445e1d524a04d1103171f0086883a5d96813 | |
| parent | 2878624980a116550e8b07acc76a24c373eab342 (diff) | |
| download | emacs-bb4cf13c47a1a24ce83233cc7b77dc87fc274d52.tar.gz emacs-bb4cf13c47a1a24ce83233cc7b77dc87fc274d52.zip | |
Convert before final function doc hash into a vector.
* lisp/emacs-lisp/comp.el (comp-finalize-relocs): Convert doc hash
table into vector befor final.
(comp-emit-for-top-level): Rename `comp-ctxt-doc-index-h' ->
`comp-ctxt-function-docs'.
(comp-ctxt): Likewise.
* src/comp.c (native_function_doc): Update logic for documentation
being a vector.
(emit_ctxt_code): Update for 'comp-ctxt-doc-index-h' slot rename.
* src/comp.h (struct Lisp_Native_Comp_Unit): Rename 'data_fdoc_h'
into data_fdoc_v.
* src/pdumper.c (dump_native_comp_unit): Likewise.
| -rw-r--r-- | lisp/emacs-lisp/comp.el | 14 | ||||
| -rw-r--r-- | src/comp.c | 16 | ||||
| -rw-r--r-- | src/comp.h | 2 | ||||
| -rw-r--r-- | src/pdumper.c | 2 |
4 files changed, 20 insertions, 14 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 5096a143a0f..f8e30f0047a 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el | |||
| @@ -216,7 +216,7 @@ Can be one of: 'd-default', 'd-impure' or 'd-ephemeral'. See `comp-ctxt'.") | |||
| 216 | (sym-to-c-name-h (make-hash-table :test #'eq) :type hash-table | 216 | (sym-to-c-name-h (make-hash-table :test #'eq) :type hash-table |
| 217 | :documentation "symbol-function -> c-name. | 217 | :documentation "symbol-function -> c-name. |
| 218 | This is only for optimizing intra CU calls at speed 3.") | 218 | This is only for optimizing intra CU calls at speed 3.") |
| 219 | (doc-index-h (make-hash-table :test #'eql) :type hash-table | 219 | (function-docs (make-hash-table :test #'eql) :type (or hash-table vector) |
| 220 | :documentation "Documentation index -> documentation") | 220 | :documentation "Documentation index -> documentation") |
| 221 | (d-default (make-comp-data-container) :type comp-data-container | 221 | (d-default (make-comp-data-container) :type comp-data-container |
| 222 | :documentation "Standard data relocated in use by functions.") | 222 | :documentation "Standard data relocated in use by functions.") |
| @@ -1218,7 +1218,7 @@ the annotation emission." | |||
| 1218 | (make-comp-mvar :constant c-name) | 1218 | (make-comp-mvar :constant c-name) |
| 1219 | (make-comp-mvar | 1219 | (make-comp-mvar |
| 1220 | :constant | 1220 | :constant |
| 1221 | (let* ((h (comp-ctxt-doc-index-h comp-ctxt)) | 1221 | (let* ((h (comp-ctxt-function-docs comp-ctxt)) |
| 1222 | (i (hash-table-count h))) | 1222 | (i (hash-table-count h))) |
| 1223 | (puthash i (comp-func-doc f) h) | 1223 | (puthash i (comp-func-doc f) h) |
| 1224 | i)) | 1224 | i)) |
| @@ -2103,7 +2103,15 @@ Update all insn accordingly." | |||
| 2103 | do (remhash obj d-ephemeral-idx)) | 2103 | do (remhash obj d-ephemeral-idx)) |
| 2104 | ;; Fix-up indexes in each relocation class and fill corresponding | 2104 | ;; Fix-up indexes in each relocation class and fill corresponding |
| 2105 | ;; reloc lists. | 2105 | ;; reloc lists. |
| 2106 | (mapc #'comp-finalize-container (list d-default d-impure d-ephemeral)))) | 2106 | (mapc #'comp-finalize-container (list d-default d-impure d-ephemeral)) |
| 2107 | ;; Make a vector from the function documentation hash table. | ||
| 2108 | (cl-loop with h = (comp-ctxt-function-docs comp-ctxt) | ||
| 2109 | with v = (make-vector (hash-table-count h) nil) | ||
| 2110 | for idx being each hash-keys of h | ||
| 2111 | for doc = (gethash idx h) | ||
| 2112 | do (setf (aref v idx) doc) | ||
| 2113 | finally | ||
| 2114 | do (setf (comp-ctxt-function-docs comp-ctxt) v)))) | ||
| 2107 | 2115 | ||
| 2108 | (defun comp-compile-ctxt-to-file (name) | 2116 | (defun comp-compile-ctxt-to-file (name) |
| 2109 | "Compile as native code the current context naming it NAME. | 2117 | "Compile as native code the current context naming it NAME. |
diff --git a/src/comp.c b/src/comp.c index b33ef92f72b..d021be479b0 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -2102,7 +2102,7 @@ emit_ctxt_code (void) | |||
| 2102 | emit_static_object (TEXT_OPTIM_QLY_SYM, Flist (2, opt_qly)); | 2102 | emit_static_object (TEXT_OPTIM_QLY_SYM, Flist (2, opt_qly)); |
| 2103 | 2103 | ||
| 2104 | emit_static_object (TEXT_FDOC_SYM, | 2104 | emit_static_object (TEXT_FDOC_SYM, |
| 2105 | CALL1I (comp-ctxt-doc-index-h, Vcomp_ctxt)); | 2105 | CALL1I (comp-ctxt-function-docs, Vcomp_ctxt)); |
| 2106 | 2106 | ||
| 2107 | comp.current_thread_ref = | 2107 | comp.current_thread_ref = |
| 2108 | gcc_jit_lvalue_as_rvalue ( | 2108 | gcc_jit_lvalue_as_rvalue ( |
| @@ -3677,14 +3677,12 @@ native_function_doc (Lisp_Object function) | |||
| 3677 | struct Lisp_Native_Comp_Unit *cu = | 3677 | struct Lisp_Native_Comp_Unit *cu = |
| 3678 | XNATIVE_COMP_UNIT (Fsubr_native_comp_unit (function)); | 3678 | XNATIVE_COMP_UNIT (Fsubr_native_comp_unit (function)); |
| 3679 | 3679 | ||
| 3680 | if (NILP (cu->data_fdoc_h)) | 3680 | if (NILP (cu->data_fdoc_v)) |
| 3681 | cu->data_fdoc_h = load_static_obj (cu, TEXT_FDOC_SYM); | 3681 | cu->data_fdoc_v = load_static_obj (cu, TEXT_FDOC_SYM); |
| 3682 | 3682 | if (!VECTORP (cu->data_fdoc_v)) | |
| 3683 | eassert (!NILP (cu->data_fdoc_h)); | 3683 | xsignal2 (Qnative_lisp_file_inconsistent, cu->file, |
| 3684 | 3684 | build_string ("missing documentation vector")); | |
| 3685 | return Fgethash (make_fixnum (XSUBR (function)->doc), | 3685 | return AREF (cu->data_fdoc_v, XSUBR (function)->doc); |
| 3686 | cu->data_fdoc_h, | ||
| 3687 | Qnil); | ||
| 3688 | } | 3686 | } |
| 3689 | 3687 | ||
| 3690 | DEFUN ("comp--register-subr", Fcomp__register_subr, Scomp__register_subr, | 3688 | DEFUN ("comp--register-subr", Fcomp__register_subr, Scomp__register_subr, |
diff --git a/src/comp.h b/src/comp.h index 73baa27276e..cbdcaccd5fe 100644 --- a/src/comp.h +++ b/src/comp.h | |||
| @@ -38,7 +38,7 @@ struct Lisp_Native_Comp_Unit | |||
| 38 | Lisp_Object file; | 38 | Lisp_Object file; |
| 39 | Lisp_Object optimize_qualities; | 39 | Lisp_Object optimize_qualities; |
| 40 | /* Hash doc-idx -> function documentaiton. */ | 40 | /* Hash doc-idx -> function documentaiton. */ |
| 41 | Lisp_Object data_fdoc_h; | 41 | Lisp_Object data_fdoc_v; |
| 42 | /* Analogous to the constant vector but per compilation unit. */ | 42 | /* Analogous to the constant vector but per compilation unit. */ |
| 43 | Lisp_Object data_vec; | 43 | Lisp_Object data_vec; |
| 44 | /* Same but for data that cannot be moved to pure space. | 44 | /* Same but for data that cannot be moved to pure space. |
diff --git a/src/pdumper.c b/src/pdumper.c index c9015d503cd..f837dfc38d2 100644 --- a/src/pdumper.c +++ b/src/pdumper.c | |||
| @@ -2982,7 +2982,7 @@ dump_native_comp_unit (struct dump_context *ctx, | |||
| 2982 | struct Lisp_Native_Comp_Unit *comp_u) | 2982 | struct Lisp_Native_Comp_Unit *comp_u) |
| 2983 | { | 2983 | { |
| 2984 | /* Have function documentation always lazy loaded to optimize load-time. */ | 2984 | /* Have function documentation always lazy loaded to optimize load-time. */ |
| 2985 | comp_u->data_fdoc_h = Qnil; | 2985 | comp_u->data_fdoc_v = Qnil; |
| 2986 | START_DUMP_PVEC (ctx, &comp_u->header, struct Lisp_Native_Comp_Unit, out); | 2986 | START_DUMP_PVEC (ctx, &comp_u->header, struct Lisp_Native_Comp_Unit, out); |
| 2987 | dump_pseudovector_lisp_fields (ctx, &out->header, &comp_u->header); | 2987 | dump_pseudovector_lisp_fields (ctx, &out->header, &comp_u->header); |
| 2988 | out->handle = NULL; | 2988 | out->handle = NULL; |