diff options
Diffstat (limited to 'src/comp.c')
| -rw-r--r-- | src/comp.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/comp.c b/src/comp.c index 8b38adec252..ab27b17b410 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -468,7 +468,7 @@ load_gccjit_if_necessary (bool mandatory) | |||
| 468 | 468 | ||
| 469 | 469 | ||
| 470 | /* Increase this number to force a new Vcomp_abi_hash to be generated. */ | 470 | /* Increase this number to force a new Vcomp_abi_hash to be generated. */ |
| 471 | #define ABI_VERSION "9" | 471 | #define ABI_VERSION "10" |
| 472 | 472 | ||
| 473 | /* Length of the hashes used for eln file naming. */ | 473 | /* Length of the hashes used for eln file naming. */ |
| 474 | #define HASH_LENGTH 8 | 474 | #define HASH_LENGTH 8 |
| @@ -2682,6 +2682,12 @@ emit_static_object (const char *name, Lisp_Object obj) | |||
| 2682 | specbind (intern_c_string ("print-quoted"), Qt); | 2682 | specbind (intern_c_string ("print-quoted"), Qt); |
| 2683 | specbind (intern_c_string ("print-gensym"), Qt); | 2683 | specbind (intern_c_string ("print-gensym"), Qt); |
| 2684 | specbind (intern_c_string ("print-circle"), Qt); | 2684 | specbind (intern_c_string ("print-circle"), Qt); |
| 2685 | /* Bind print-number-table and print-continuous-numbering so comp--#$ | ||
| 2686 | prints as #$. */ | ||
| 2687 | Lisp_Object print_number_table = CALLN (Fmake_hash_table, QCtest, Qeq); | ||
| 2688 | Fputhash (Vcomp__hashdollar, build_string ("#$") , print_number_table); | ||
| 2689 | specbind (intern_c_string ("print-number-table"), print_number_table); | ||
| 2690 | specbind (intern_c_string ("print-continuous-numbering"), Qt); | ||
| 2685 | Lisp_Object str = Fprin1_to_string (obj, Qnil, Qnil); | 2691 | Lisp_Object str = Fprin1_to_string (obj, Qnil, Qnil); |
| 2686 | unbind_to (count, Qnil); | 2692 | unbind_to (count, Qnil); |
| 2687 | 2693 | ||
| @@ -5145,18 +5151,25 @@ typedef char *(*comp_lit_str_func) (void); | |||
| 5145 | static Lisp_Object | 5151 | static Lisp_Object |
| 5146 | load_static_obj (struct Lisp_Native_Comp_Unit *comp_u, const char *name) | 5152 | load_static_obj (struct Lisp_Native_Comp_Unit *comp_u, const char *name) |
| 5147 | { | 5153 | { |
| 5154 | specpdl_ref count = SPECPDL_INDEX (); | ||
| 5148 | static_obj_t *blob = | 5155 | static_obj_t *blob = |
| 5149 | dynlib_sym (comp_u->handle, format_string ("%s_blob", name)); | 5156 | dynlib_sym (comp_u->handle, format_string ("%s_blob", name)); |
| 5157 | /* Special value so we can recognize #$, which is used for entries in | ||
| 5158 | the static vector that must be overwritten at load time. This is a | ||
| 5159 | specific string that contains "#$", which is not EQ to any | ||
| 5160 | legitimate object returned by Fread. */ | ||
| 5161 | specbind (intern_c_string ("load-file-name"), | ||
| 5162 | Vcomp__hashdollar); | ||
| 5150 | if (blob) | 5163 | if (blob) |
| 5151 | /* New blob format. */ | 5164 | /* New blob format. */ |
| 5152 | return Fread (make_string (blob->data, blob->len)); | 5165 | return unbind_to (count, Fread (make_string (blob->data, blob->len))); |
| 5153 | 5166 | ||
| 5154 | static_obj_t *(*f)(void) = dynlib_sym (comp_u->handle, name); | 5167 | static_obj_t *(*f)(void) = dynlib_sym (comp_u->handle, name); |
| 5155 | if (!f) | 5168 | if (!f) |
| 5156 | xsignal1 (Qnative_lisp_file_inconsistent, comp_u->file); | 5169 | xsignal1 (Qnative_lisp_file_inconsistent, comp_u->file); |
| 5157 | 5170 | ||
| 5158 | blob = f (); | 5171 | blob = f (); |
| 5159 | return Fread (make_string (blob->data, blob->len)); | 5172 | return unbind_to (count, Fread (make_string (blob->data, blob->len))); |
| 5160 | 5173 | ||
| 5161 | } | 5174 | } |
| 5162 | 5175 | ||
| @@ -5173,7 +5186,7 @@ check_comp_unit_relocs (struct Lisp_Native_Comp_Unit *comp_u) | |||
| 5173 | for (ptrdiff_t i = 0; i < d_vec_len; i++) | 5186 | for (ptrdiff_t i = 0; i < d_vec_len; i++) |
| 5174 | { | 5187 | { |
| 5175 | Lisp_Object x = data_relocs[i]; | 5188 | Lisp_Object x = data_relocs[i]; |
| 5176 | if (EQ (x, Q__lambda_fixup)) | 5189 | if (EQ (x, Vcomp__hashdollar)) |
| 5177 | return false; | 5190 | return false; |
| 5178 | else if (NATIVE_COMP_FUNCTIONP (x)) | 5191 | else if (NATIVE_COMP_FUNCTIONP (x)) |
| 5179 | { | 5192 | { |
| @@ -5622,7 +5635,6 @@ natively-compiled one. */); | |||
| 5622 | DEFSYM (Qfixnum, "fixnum"); | 5635 | DEFSYM (Qfixnum, "fixnum"); |
| 5623 | DEFSYM (Qscratch, "scratch"); | 5636 | DEFSYM (Qscratch, "scratch"); |
| 5624 | DEFSYM (Qlate, "late"); | 5637 | DEFSYM (Qlate, "late"); |
| 5625 | DEFSYM (Q__lambda_fixup, "--lambda-fixup"); | ||
| 5626 | DEFSYM (Qgccjit, "gccjit"); | 5638 | DEFSYM (Qgccjit, "gccjit"); |
| 5627 | DEFSYM (Qcomp_subr_trampoline_install, "comp-subr-trampoline-install"); | 5639 | DEFSYM (Qcomp_subr_trampoline_install, "comp-subr-trampoline-install"); |
| 5628 | DEFSYM (Qnative_comp_warning_on_missing_source, | 5640 | DEFSYM (Qnative_comp_warning_on_missing_source, |
| @@ -5804,6 +5816,10 @@ This is intended to be used only for development and | |||
| 5804 | verification of the native compiler. */); | 5816 | verification of the native compiler. */); |
| 5805 | comp_sanitizer_active = false; | 5817 | comp_sanitizer_active = false; |
| 5806 | 5818 | ||
| 5819 | DEFVAR_LISP ("comp--#$", Vcomp__hashdollar, | ||
| 5820 | doc: /* Special value which will print as "#$". */); | ||
| 5821 | Vcomp__hashdollar = build_string ("#$"); | ||
| 5822 | |||
| 5807 | Fprovide (intern_c_string ("native-compile"), Qnil); | 5823 | Fprovide (intern_c_string ("native-compile"), Qnil); |
| 5808 | #endif /* #ifdef HAVE_NATIVE_COMP */ | 5824 | #endif /* #ifdef HAVE_NATIVE_COMP */ |
| 5809 | 5825 | ||