diff options
| author | Pip Cet | 2024-08-20 19:09:14 +0000 |
|---|---|---|
| committer | Stefan Kangas | 2024-12-12 22:48:12 +0100 |
| commit | bd2b59f07337c4f5980666875207bf877634b1b3 (patch) | |
| tree | eede555689a96c95d5014dc71bda674834b657c7 /src | |
| parent | 69fea4f29a1390912e4140a3ebacc50b7338db6f (diff) | |
| download | emacs-bd2b59f07337c4f5980666875207bf877634b1b3.tar.gz emacs-bd2b59f07337c4f5980666875207bf877634b1b3.zip | |
Pure storage removal: Adjust nativecomp code
* lisp/emacs-lisp/comp.el (comp-curr-allocation-class, comp-ctxt)
(comp--emit-for-top-level, comp--emit-lambda-for-top-level)
(comp--finalize-relocs): Remove 'd-impure' allocation class.
* src/comp.c (PURE_RELOC_SYM, DATA_RELOC_IMPURE_SYM)
(TEXT_DATA_RELOC_IMPURE_SYM): Remove definitions.
(comp_t): Remove 'pure_ptr', 'check_impure', 'data_relocs_impure',
'd_impure_idx'.
(helper_link_table): Remove 'pure_write_error'.
(obj_to_reloc): Adjust to removal of 'data_relocs_impure'.
(emit_PURE_P): Remove function.
(declare_imported_data, declare_runtime_imported_funcs)
(emit_ctxt_code): Adjust to removed fields.
(define_setcar_setcdr): Don't call 'CHECK_IMPURE'.
(define_CHECK_IMPURE): Remove function.
(Fcomp__compile_ctxt_to_file0, check_comp_unit_relocs, load_comp_unit)
(Fcomp__register_lambda): Adjust to removed allocation class 'd-impure'.
(syms_of_comp): Don't define 'd-impure'.
* src/comp.h (struct Lisp_Native_Comp_Unit): Drop support for allocation
class 'd-impure'.
* src/lisp.h (allocate_native_comp_unit):
* src/pdumper.c (dump_do_dump_relocation): Adjust to struct change.
Diffstat (limited to 'src')
| -rw-r--r-- | src/comp.c | 145 | ||||
| -rw-r--r-- | src/comp.h | 10 | ||||
| -rw-r--r-- | src/lisp.h | 2 | ||||
| -rw-r--r-- | src/pdumper.c | 4 |
4 files changed, 12 insertions, 149 deletions
diff --git a/src/comp.c b/src/comp.c index e43732f369e..5e8b49f7ffc 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -476,16 +476,13 @@ load_gccjit_if_necessary (bool mandatory) | |||
| 476 | /* C symbols emitted for the load relocation mechanism. */ | 476 | /* C symbols emitted for the load relocation mechanism. */ |
| 477 | #define CURRENT_THREAD_RELOC_SYM "current_thread_reloc" | 477 | #define CURRENT_THREAD_RELOC_SYM "current_thread_reloc" |
| 478 | #define F_SYMBOLS_WITH_POS_ENABLED_RELOC_SYM "f_symbols_with_pos_enabled_reloc" | 478 | #define F_SYMBOLS_WITH_POS_ENABLED_RELOC_SYM "f_symbols_with_pos_enabled_reloc" |
| 479 | #define PURE_RELOC_SYM "pure_reloc" | ||
| 480 | #define DATA_RELOC_SYM "d_reloc" | 479 | #define DATA_RELOC_SYM "d_reloc" |
| 481 | #define DATA_RELOC_IMPURE_SYM "d_reloc_imp" | ||
| 482 | #define DATA_RELOC_EPHEMERAL_SYM "d_reloc_eph" | 480 | #define DATA_RELOC_EPHEMERAL_SYM "d_reloc_eph" |
| 483 | 481 | ||
| 484 | #define FUNC_LINK_TABLE_SYM "freloc_link_table" | 482 | #define FUNC_LINK_TABLE_SYM "freloc_link_table" |
| 485 | #define LINK_TABLE_HASH_SYM "freloc_hash" | 483 | #define LINK_TABLE_HASH_SYM "freloc_hash" |
| 486 | #define COMP_UNIT_SYM "comp_unit" | 484 | #define COMP_UNIT_SYM "comp_unit" |
| 487 | #define TEXT_DATA_RELOC_SYM "text_data_reloc" | 485 | #define TEXT_DATA_RELOC_SYM "text_data_reloc" |
| 488 | #define TEXT_DATA_RELOC_IMPURE_SYM "text_data_reloc_imp" | ||
| 489 | #define TEXT_DATA_RELOC_EPHEMERAL_SYM "text_data_reloc_eph" | 486 | #define TEXT_DATA_RELOC_EPHEMERAL_SYM "text_data_reloc_eph" |
| 490 | 487 | ||
| 491 | #define TEXT_OPTIM_QLY_SYM "text_optim_qly" | 488 | #define TEXT_OPTIM_QLY_SYM "text_optim_qly" |
| @@ -619,7 +616,6 @@ typedef struct { | |||
| 619 | gcc_jit_type *thread_state_ptr_type; | 616 | gcc_jit_type *thread_state_ptr_type; |
| 620 | gcc_jit_rvalue *current_thread_ref; | 617 | gcc_jit_rvalue *current_thread_ref; |
| 621 | /* Other globals. */ | 618 | /* Other globals. */ |
| 622 | gcc_jit_rvalue *pure_ptr; | ||
| 623 | #ifndef LIBGCCJIT_HAVE_gcc_jit_context_new_bitcast | 619 | #ifndef LIBGCCJIT_HAVE_gcc_jit_context_new_bitcast |
| 624 | /* This version of libgccjit has really limited support for casting | 620 | /* This version of libgccjit has really limited support for casting |
| 625 | therefore this union will be used for the scope. */ | 621 | therefore this union will be used for the scope. */ |
| @@ -651,7 +647,6 @@ typedef struct { | |||
| 651 | gcc_jit_function *setcar; | 647 | gcc_jit_function *setcar; |
| 652 | gcc_jit_function *setcdr; | 648 | gcc_jit_function *setcdr; |
| 653 | gcc_jit_function *check_type; | 649 | gcc_jit_function *check_type; |
| 654 | gcc_jit_function *check_impure; | ||
| 655 | gcc_jit_function *maybe_gc_or_quit; | 650 | gcc_jit_function *maybe_gc_or_quit; |
| 656 | Lisp_Object func_blocks_h; /* blk_name -> gcc_block. */ | 651 | Lisp_Object func_blocks_h; /* blk_name -> gcc_block. */ |
| 657 | Lisp_Object exported_funcs_h; /* c-func-name -> gcc_jit_function *. */ | 652 | Lisp_Object exported_funcs_h; /* c-func-name -> gcc_jit_function *. */ |
| @@ -659,8 +654,6 @@ typedef struct { | |||
| 659 | Lisp_Object emitter_dispatcher; | 654 | Lisp_Object emitter_dispatcher; |
| 660 | /* Synthesized struct holding data relocs. */ | 655 | /* Synthesized struct holding data relocs. */ |
| 661 | reloc_array_t data_relocs; | 656 | reloc_array_t data_relocs; |
| 662 | /* Same as before but can't go in pure space. */ | ||
| 663 | reloc_array_t data_relocs_impure; | ||
| 664 | /* Same as before but content does not survive load phase. */ | 657 | /* Same as before but content does not survive load phase. */ |
| 665 | reloc_array_t data_relocs_ephemeral; | 658 | reloc_array_t data_relocs_ephemeral; |
| 666 | /* Global structure holding function relocations. */ | 659 | /* Global structure holding function relocations. */ |
| @@ -670,7 +663,6 @@ typedef struct { | |||
| 670 | gcc_jit_lvalue *func_relocs_local; | 663 | gcc_jit_lvalue *func_relocs_local; |
| 671 | gcc_jit_function *memcpy; | 664 | gcc_jit_function *memcpy; |
| 672 | Lisp_Object d_default_idx; | 665 | Lisp_Object d_default_idx; |
| 673 | Lisp_Object d_impure_idx; | ||
| 674 | Lisp_Object d_ephemeral_idx; | 666 | Lisp_Object d_ephemeral_idx; |
| 675 | } comp_t; | 667 | } comp_t; |
| 676 | 668 | ||
| @@ -708,7 +700,6 @@ helper_sanitizer_assert (Lisp_Object, Lisp_Object); | |||
| 708 | static void *helper_link_table[] = | 700 | static void *helper_link_table[] = |
| 709 | { wrong_type_argument, | 701 | { wrong_type_argument, |
| 710 | helper_PSEUDOVECTOR_TYPEP_XUNTAG, | 702 | helper_PSEUDOVECTOR_TYPEP_XUNTAG, |
| 711 | pure_write_error, | ||
| 712 | push_handler, | 703 | push_handler, |
| 713 | record_unwind_protect_excursion, | 704 | record_unwind_protect_excursion, |
| 714 | helper_unbind_n, | 705 | helper_unbind_n, |
| @@ -939,13 +930,6 @@ obj_to_reloc (Lisp_Object obj) | |||
| 939 | goto found; | 930 | goto found; |
| 940 | } | 931 | } |
| 941 | 932 | ||
| 942 | idx = Fgethash (obj, comp.d_impure_idx, Qnil); | ||
| 943 | if (!NILP (idx)) | ||
| 944 | { | ||
| 945 | reloc.array = comp.data_relocs_impure; | ||
| 946 | goto found; | ||
| 947 | } | ||
| 948 | |||
| 949 | idx = Fgethash (obj, comp.d_ephemeral_idx, Qnil); | 933 | idx = Fgethash (obj, comp.d_ephemeral_idx, Qnil); |
| 950 | if (!NILP (idx)) | 934 | if (!NILP (idx)) |
| 951 | { | 935 | { |
| @@ -1987,28 +1971,6 @@ emit_XSETCDR (gcc_jit_rvalue *c, gcc_jit_rvalue *n) | |||
| 1987 | NULL), | 1971 | NULL), |
| 1988 | n); | 1972 | n); |
| 1989 | } | 1973 | } |
| 1990 | |||
| 1991 | static gcc_jit_rvalue * | ||
| 1992 | emit_PURE_P (gcc_jit_rvalue *ptr) | ||
| 1993 | { | ||
| 1994 | |||
| 1995 | emit_comment ("PURE_P"); | ||
| 1996 | |||
| 1997 | return | ||
| 1998 | gcc_jit_context_new_comparison ( | ||
| 1999 | comp.ctxt, | ||
| 2000 | NULL, | ||
| 2001 | GCC_JIT_COMPARISON_LE, | ||
| 2002 | emit_binary_op ( | ||
| 2003 | GCC_JIT_BINARY_OP_MINUS, | ||
| 2004 | comp.uintptr_type, | ||
| 2005 | ptr, | ||
| 2006 | comp.pure_ptr), | ||
| 2007 | gcc_jit_context_new_rvalue_from_int (comp.ctxt, | ||
| 2008 | comp.uintptr_type, | ||
| 2009 | PURESIZE)); | ||
| 2010 | } | ||
| 2011 | |||
| 2012 | 1974 | ||
| 2013 | /*************************************/ | 1975 | /*************************************/ |
| 2014 | /* Code emitted by LIMPLE statemes. */ | 1976 | /* Code emitted by LIMPLE statemes. */ |
| @@ -2925,10 +2887,6 @@ declare_imported_data (void) | |||
| 2925 | declare_imported_data_relocs (CALL1I (comp-ctxt-d-default, Vcomp_ctxt), | 2887 | declare_imported_data_relocs (CALL1I (comp-ctxt-d-default, Vcomp_ctxt), |
| 2926 | DATA_RELOC_SYM, | 2888 | DATA_RELOC_SYM, |
| 2927 | TEXT_DATA_RELOC_SYM); | 2889 | TEXT_DATA_RELOC_SYM); |
| 2928 | comp.data_relocs_impure = | ||
| 2929 | declare_imported_data_relocs (CALL1I (comp-ctxt-d-impure, Vcomp_ctxt), | ||
| 2930 | DATA_RELOC_IMPURE_SYM, | ||
| 2931 | TEXT_DATA_RELOC_IMPURE_SYM); | ||
| 2932 | comp.data_relocs_ephemeral = | 2890 | comp.data_relocs_ephemeral = |
| 2933 | declare_imported_data_relocs (CALL1I (comp-ctxt-d-ephemeral, Vcomp_ctxt), | 2891 | declare_imported_data_relocs (CALL1I (comp-ctxt-d-ephemeral, Vcomp_ctxt), |
| 2934 | DATA_RELOC_EPHEMERAL_SYM, | 2892 | DATA_RELOC_EPHEMERAL_SYM, |
| @@ -2962,8 +2920,6 @@ declare_runtime_imported_funcs (void) | |||
| 2962 | args[1] = comp.int_type; | 2920 | args[1] = comp.int_type; |
| 2963 | ADD_IMPORTED (helper_PSEUDOVECTOR_TYPEP_XUNTAG, comp.bool_type, 2, args); | 2921 | ADD_IMPORTED (helper_PSEUDOVECTOR_TYPEP_XUNTAG, comp.bool_type, 2, args); |
| 2964 | 2922 | ||
| 2965 | ADD_IMPORTED (pure_write_error, comp.void_type, 1, NULL); | ||
| 2966 | |||
| 2967 | args[0] = comp.lisp_obj_type; | 2923 | args[0] = comp.lisp_obj_type; |
| 2968 | args[1] = comp.int_type; | 2924 | args[1] = comp.int_type; |
| 2969 | ADD_IMPORTED (push_handler, comp.handler_ptr_type, 2, args); | 2925 | ADD_IMPORTED (push_handler, comp.handler_ptr_type, 2, args); |
| @@ -3039,15 +2995,6 @@ emit_ctxt_code (void) | |||
| 3039 | comp.bool_ptr_type, | 2995 | comp.bool_ptr_type, |
| 3040 | F_SYMBOLS_WITH_POS_ENABLED_RELOC_SYM)); | 2996 | F_SYMBOLS_WITH_POS_ENABLED_RELOC_SYM)); |
| 3041 | 2997 | ||
| 3042 | comp.pure_ptr = | ||
| 3043 | gcc_jit_lvalue_as_rvalue ( | ||
| 3044 | gcc_jit_context_new_global ( | ||
| 3045 | comp.ctxt, | ||
| 3046 | NULL, | ||
| 3047 | GCC_JIT_GLOBAL_EXPORTED, | ||
| 3048 | comp.void_ptr_type, | ||
| 3049 | PURE_RELOC_SYM)); | ||
| 3050 | |||
| 3051 | gcc_jit_context_new_global ( | 2998 | gcc_jit_context_new_global ( |
| 3052 | comp.ctxt, | 2999 | comp.ctxt, |
| 3053 | NULL, | 3000 | NULL, |
| @@ -3709,19 +3656,6 @@ define_setcar_setcdr (void) | |||
| 3709 | /* CHECK_CONS (cell); */ | 3656 | /* CHECK_CONS (cell); */ |
| 3710 | emit_CHECK_CONS (gcc_jit_param_as_rvalue (cell)); | 3657 | emit_CHECK_CONS (gcc_jit_param_as_rvalue (cell)); |
| 3711 | 3658 | ||
| 3712 | /* CHECK_IMPURE (cell, XCONS (cell)); */ | ||
| 3713 | gcc_jit_rvalue *args[] = | ||
| 3714 | { gcc_jit_param_as_rvalue (cell), | ||
| 3715 | emit_XCONS (gcc_jit_param_as_rvalue (cell)) }; | ||
| 3716 | |||
| 3717 | gcc_jit_block_add_eval (entry_block, | ||
| 3718 | NULL, | ||
| 3719 | gcc_jit_context_new_call (comp.ctxt, | ||
| 3720 | NULL, | ||
| 3721 | comp.check_impure, | ||
| 3722 | 2, | ||
| 3723 | args)); | ||
| 3724 | |||
| 3725 | /* XSETCDR (cell, newel); */ | 3659 | /* XSETCDR (cell, newel); */ |
| 3726 | if (!i) | 3660 | if (!i) |
| 3727 | emit_XSETCAR (gcc_jit_param_as_rvalue (cell), | 3661 | emit_XSETCAR (gcc_jit_param_as_rvalue (cell), |
| @@ -4026,52 +3960,6 @@ static void define_SYMBOL_WITH_POS_SYM (void) | |||
| 4026 | } | 3960 | } |
| 4027 | 3961 | ||
| 4028 | static void | 3962 | static void |
| 4029 | define_CHECK_IMPURE (void) | ||
| 4030 | { | ||
| 4031 | gcc_jit_param *param[] = | ||
| 4032 | { gcc_jit_context_new_param (comp.ctxt, | ||
| 4033 | NULL, | ||
| 4034 | comp.lisp_obj_type, | ||
| 4035 | "obj"), | ||
| 4036 | gcc_jit_context_new_param (comp.ctxt, | ||
| 4037 | NULL, | ||
| 4038 | comp.void_ptr_type, | ||
| 4039 | "ptr") }; | ||
| 4040 | comp.check_impure = | ||
| 4041 | gcc_jit_context_new_function (comp.ctxt, NULL, | ||
| 4042 | GCC_JIT_FUNCTION_INTERNAL, | ||
| 4043 | comp.void_type, | ||
| 4044 | "CHECK_IMPURE", | ||
| 4045 | 2, | ||
| 4046 | param, | ||
| 4047 | 0); | ||
| 4048 | |||
| 4049 | DECL_BLOCK (entry_block, comp.check_impure); | ||
| 4050 | DECL_BLOCK (err_block, comp.check_impure); | ||
| 4051 | DECL_BLOCK (ok_block, comp.check_impure); | ||
| 4052 | |||
| 4053 | comp.block = entry_block; | ||
| 4054 | comp.func = comp.check_impure; | ||
| 4055 | |||
| 4056 | emit_cond_jump (emit_PURE_P (gcc_jit_param_as_rvalue (param[0])), /* FIXME */ | ||
| 4057 | err_block, | ||
| 4058 | ok_block); | ||
| 4059 | gcc_jit_block_end_with_void_return (ok_block, NULL); | ||
| 4060 | |||
| 4061 | gcc_jit_rvalue *pure_write_error_arg = | ||
| 4062 | gcc_jit_param_as_rvalue (param[0]); | ||
| 4063 | |||
| 4064 | comp.block = err_block; | ||
| 4065 | gcc_jit_block_add_eval (comp.block, | ||
| 4066 | NULL, | ||
| 4067 | emit_call (intern_c_string ("pure_write_error"), | ||
| 4068 | comp.void_type, 1,&pure_write_error_arg, | ||
| 4069 | false)); | ||
| 4070 | |||
| 4071 | gcc_jit_block_end_with_void_return (err_block, NULL); | ||
| 4072 | } | ||
| 4073 | |||
| 4074 | static void | ||
| 4075 | define_maybe_gc_or_quit (void) | 3963 | define_maybe_gc_or_quit (void) |
| 4076 | { | 3964 | { |
| 4077 | 3965 | ||
| @@ -4948,8 +4836,6 @@ DEFUN ("comp--compile-ctxt-to-file0", Fcomp__compile_ctxt_to_file0, | |||
| 4948 | 4836 | ||
| 4949 | comp.d_default_idx = | 4837 | comp.d_default_idx = |
| 4950 | CALL1I (comp-data-container-idx, CALL1I (comp-ctxt-d-default, Vcomp_ctxt)); | 4838 | CALL1I (comp-data-container-idx, CALL1I (comp-ctxt-d-default, Vcomp_ctxt)); |
| 4951 | comp.d_impure_idx = | ||
| 4952 | CALL1I (comp-data-container-idx, CALL1I (comp-ctxt-d-impure, Vcomp_ctxt)); | ||
| 4953 | comp.d_ephemeral_idx = | 4839 | comp.d_ephemeral_idx = |
| 4954 | CALL1I (comp-data-container-idx, CALL1I (comp-ctxt-d-ephemeral, Vcomp_ctxt)); | 4840 | CALL1I (comp-data-container-idx, CALL1I (comp-ctxt-d-ephemeral, Vcomp_ctxt)); |
| 4955 | 4841 | ||
| @@ -5281,17 +5167,12 @@ check_comp_unit_relocs (struct Lisp_Native_Comp_Unit *comp_u) | |||
| 5281 | { | 5167 | { |
| 5282 | dynlib_handle_ptr handle = comp_u->handle; | 5168 | dynlib_handle_ptr handle = comp_u->handle; |
| 5283 | Lisp_Object *data_relocs = dynlib_sym (handle, DATA_RELOC_SYM); | 5169 | Lisp_Object *data_relocs = dynlib_sym (handle, DATA_RELOC_SYM); |
| 5284 | Lisp_Object *data_imp_relocs = dynlib_sym (handle, DATA_RELOC_IMPURE_SYM); | ||
| 5285 | 5170 | ||
| 5286 | EMACS_INT d_vec_len = XFIXNUM (Flength (comp_u->data_vec)); | 5171 | EMACS_INT d_vec_len = XFIXNUM (Flength (comp_u->data_vec)); |
| 5287 | for (ptrdiff_t i = 0; i < d_vec_len; i++) | ||
| 5288 | if (!EQ (data_relocs[i], AREF (comp_u->data_vec, i))) | ||
| 5289 | return false; | ||
| 5290 | 5172 | ||
| 5291 | d_vec_len = XFIXNUM (Flength (comp_u->data_impure_vec)); | ||
| 5292 | for (ptrdiff_t i = 0; i < d_vec_len; i++) | 5173 | for (ptrdiff_t i = 0; i < d_vec_len; i++) |
| 5293 | { | 5174 | { |
| 5294 | Lisp_Object x = data_imp_relocs[i]; | 5175 | Lisp_Object x = data_relocs[i]; |
| 5295 | if (EQ (x, Qlambda_fixup)) | 5176 | if (EQ (x, Qlambda_fixup)) |
| 5296 | return false; | 5177 | return false; |
| 5297 | else if (NATIVE_COMP_FUNCTIONP (x)) | 5178 | else if (NATIVE_COMP_FUNCTIONP (x)) |
| @@ -5299,7 +5180,7 @@ check_comp_unit_relocs (struct Lisp_Native_Comp_Unit *comp_u) | |||
| 5299 | if (NILP (Fgethash (x, comp_u->lambda_gc_guard_h, Qnil))) | 5180 | if (NILP (Fgethash (x, comp_u->lambda_gc_guard_h, Qnil))) |
| 5300 | return false; | 5181 | return false; |
| 5301 | } | 5182 | } |
| 5302 | else if (!EQ (x, AREF (comp_u->data_impure_vec, i))) | 5183 | else if (!EQ (x, AREF (comp_u->data_vec, i))) |
| 5303 | return false; | 5184 | return false; |
| 5304 | } | 5185 | } |
| 5305 | return true; | 5186 | return true; |
| @@ -5363,7 +5244,7 @@ load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u, bool loading_dump, | |||
| 5363 | 5244 | ||
| 5364 | /* Always set data_imp_relocs pointer in the compilation unit (in can be | 5245 | /* Always set data_imp_relocs pointer in the compilation unit (in can be |
| 5365 | used in 'dump_do_dump_relocation'). */ | 5246 | used in 'dump_do_dump_relocation'). */ |
| 5366 | comp_u->data_imp_relocs = dynlib_sym (handle, DATA_RELOC_IMPURE_SYM); | 5247 | comp_u->data_relocs = dynlib_sym (handle, DATA_RELOC_SYM); |
| 5367 | 5248 | ||
| 5368 | if (!comp_u->loaded_once) | 5249 | if (!comp_u->loaded_once) |
| 5369 | { | 5250 | { |
| @@ -5371,16 +5252,12 @@ load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u, bool loading_dump, | |||
| 5371 | dynlib_sym (handle, CURRENT_THREAD_RELOC_SYM); | 5252 | dynlib_sym (handle, CURRENT_THREAD_RELOC_SYM); |
| 5372 | bool **f_symbols_with_pos_enabled_reloc = | 5253 | bool **f_symbols_with_pos_enabled_reloc = |
| 5373 | dynlib_sym (handle, F_SYMBOLS_WITH_POS_ENABLED_RELOC_SYM); | 5254 | dynlib_sym (handle, F_SYMBOLS_WITH_POS_ENABLED_RELOC_SYM); |
| 5374 | void **pure_reloc = dynlib_sym (handle, PURE_RELOC_SYM); | 5255 | Lisp_Object *data_relocs = comp_u->data_relocs; |
| 5375 | Lisp_Object *data_relocs = dynlib_sym (handle, DATA_RELOC_SYM); | ||
| 5376 | Lisp_Object *data_imp_relocs = comp_u->data_imp_relocs; | ||
| 5377 | void **freloc_link_table = dynlib_sym (handle, FUNC_LINK_TABLE_SYM); | 5256 | void **freloc_link_table = dynlib_sym (handle, FUNC_LINK_TABLE_SYM); |
| 5378 | 5257 | ||
| 5379 | if (!(current_thread_reloc | 5258 | if (!(current_thread_reloc |
| 5380 | && f_symbols_with_pos_enabled_reloc | 5259 | && f_symbols_with_pos_enabled_reloc |
| 5381 | && pure_reloc | ||
| 5382 | && data_relocs | 5260 | && data_relocs |
| 5383 | && data_imp_relocs | ||
| 5384 | && data_eph_relocs | 5261 | && data_eph_relocs |
| 5385 | && freloc_link_table | 5262 | && freloc_link_table |
| 5386 | && top_level_run) | 5263 | && top_level_run) |
| @@ -5390,7 +5267,6 @@ load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u, bool loading_dump, | |||
| 5390 | 5267 | ||
| 5391 | *current_thread_reloc = ¤t_thread; | 5268 | *current_thread_reloc = ¤t_thread; |
| 5392 | *f_symbols_with_pos_enabled_reloc = &symbols_with_pos_enabled; | 5269 | *f_symbols_with_pos_enabled_reloc = &symbols_with_pos_enabled; |
| 5393 | *pure_reloc = pure; | ||
| 5394 | 5270 | ||
| 5395 | /* Imported functions. */ | 5271 | /* Imported functions. */ |
| 5396 | *freloc_link_table = freloc.link_table; | 5272 | *freloc_link_table = freloc.link_table; |
| @@ -5401,21 +5277,11 @@ load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u, bool loading_dump, | |||
| 5401 | comp_u->optimize_qualities = | 5277 | comp_u->optimize_qualities = |
| 5402 | load_static_obj (comp_u, TEXT_OPTIM_QLY_SYM); | 5278 | load_static_obj (comp_u, TEXT_OPTIM_QLY_SYM); |
| 5403 | comp_u->data_vec = load_static_obj (comp_u, TEXT_DATA_RELOC_SYM); | 5279 | comp_u->data_vec = load_static_obj (comp_u, TEXT_DATA_RELOC_SYM); |
| 5404 | comp_u->data_impure_vec = | ||
| 5405 | load_static_obj (comp_u, TEXT_DATA_RELOC_IMPURE_SYM); | ||
| 5406 | |||
| 5407 | if (!NILP (Vpurify_flag)) | ||
| 5408 | /* Non impure can be copied into pure space. */ | ||
| 5409 | comp_u->data_vec = Fpurecopy (comp_u->data_vec); | ||
| 5410 | } | 5280 | } |
| 5411 | 5281 | ||
| 5412 | EMACS_INT d_vec_len = XFIXNUM (Flength (comp_u->data_vec)); | 5282 | EMACS_INT d_vec_len = XFIXNUM (Flength (comp_u->data_vec)); |
| 5413 | for (EMACS_INT i = 0; i < d_vec_len; i++) | 5283 | for (EMACS_INT i = 0; i < d_vec_len; i++) |
| 5414 | data_relocs[i] = AREF (comp_u->data_vec, i); | 5284 | data_relocs[i] = AREF (comp_u->data_vec, i); |
| 5415 | |||
| 5416 | d_vec_len = XFIXNUM (Flength (comp_u->data_impure_vec)); | ||
| 5417 | for (EMACS_INT i = 0; i < d_vec_len; i++) | ||
| 5418 | data_imp_relocs[i] = AREF (comp_u->data_impure_vec, i); | ||
| 5419 | } | 5285 | } |
| 5420 | 5286 | ||
| 5421 | if (!loading_dump) | 5287 | if (!loading_dump) |
| @@ -5567,7 +5433,7 @@ This gets called by top_level_run during the load phase. */) | |||
| 5567 | eassert (NILP (Fgethash (c_name, cu->lambda_c_name_idx_h, Qnil))); | 5433 | eassert (NILP (Fgethash (c_name, cu->lambda_c_name_idx_h, Qnil))); |
| 5568 | Fputhash (c_name, reloc_idx, cu->lambda_c_name_idx_h); | 5434 | Fputhash (c_name, reloc_idx, cu->lambda_c_name_idx_h); |
| 5569 | /* Do the real relocation fixup. */ | 5435 | /* Do the real relocation fixup. */ |
| 5570 | cu->data_imp_relocs[XFIXNUM (reloc_idx)] = tem; | 5436 | cu->data_relocs[XFIXNUM (reloc_idx)] = tem; |
| 5571 | 5437 | ||
| 5572 | return tem; | 5438 | return tem; |
| 5573 | } | 5439 | } |
| @@ -5749,7 +5615,6 @@ natively-compiled one. */); | |||
| 5749 | 5615 | ||
| 5750 | /* Allocation classes. */ | 5616 | /* Allocation classes. */ |
| 5751 | DEFSYM (Qd_default, "d-default"); | 5617 | DEFSYM (Qd_default, "d-default"); |
| 5752 | DEFSYM (Qd_impure, "d-impure"); | ||
| 5753 | DEFSYM (Qd_ephemeral, "d-ephemeral"); | 5618 | DEFSYM (Qd_ephemeral, "d-ephemeral"); |
| 5754 | 5619 | ||
| 5755 | /* Others. */ | 5620 | /* Others. */ |
diff --git a/src/comp.h b/src/comp.h index 158ed0b46df..2a60cb38955 100644 --- a/src/comp.h +++ b/src/comp.h | |||
| @@ -35,17 +35,15 @@ struct Lisp_Native_Comp_Unit | |||
| 35 | /* Guard anonymous lambdas against Garbage Collection and serve | 35 | /* Guard anonymous lambdas against Garbage Collection and serve |
| 36 | sanity checks. */ | 36 | sanity checks. */ |
| 37 | Lisp_Object lambda_gc_guard_h; | 37 | Lisp_Object lambda_gc_guard_h; |
| 38 | /* Hash c_name -> d_reloc_imp index. */ | 38 | /* Hash c_name -> d_reloc index. */ |
| 39 | Lisp_Object lambda_c_name_idx_h; | 39 | Lisp_Object lambda_c_name_idx_h; |
| 40 | /* Hash doc-idx -> function documentation. */ | 40 | /* Hash doc-idx -> function documentation. */ |
| 41 | Lisp_Object data_fdoc_v; | 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. Must be |
| 43 | last. */ | ||
| 43 | Lisp_Object data_vec; | 44 | Lisp_Object data_vec; |
| 44 | /* 'data_impure_vec' must be last (see allocate_native_comp_unit). | ||
| 45 | Same as data_vec but for data that cannot be moved to pure space. */ | ||
| 46 | Lisp_Object data_impure_vec; | ||
| 47 | /* STUFFS WE DO NOT DUMP!! */ | 45 | /* STUFFS WE DO NOT DUMP!! */ |
| 48 | Lisp_Object *data_imp_relocs; | 46 | Lisp_Object *data_relocs; |
| 49 | bool loaded_once; | 47 | bool loaded_once; |
| 50 | bool load_ongoing; | 48 | bool load_ongoing; |
| 51 | dynlib_handle_ptr handle; | 49 | dynlib_handle_ptr handle; |
diff --git a/src/lisp.h b/src/lisp.h index 5ebbe4f9860..695d5f200ea 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -5498,7 +5498,7 @@ INLINE struct Lisp_Native_Comp_Unit * | |||
| 5498 | allocate_native_comp_unit (void) | 5498 | allocate_native_comp_unit (void) |
| 5499 | { | 5499 | { |
| 5500 | return ALLOCATE_ZEROED_PSEUDOVECTOR (struct Lisp_Native_Comp_Unit, | 5500 | return ALLOCATE_ZEROED_PSEUDOVECTOR (struct Lisp_Native_Comp_Unit, |
| 5501 | data_impure_vec, PVEC_NATIVE_COMP_UNIT); | 5501 | data_vec, PVEC_NATIVE_COMP_UNIT); |
| 5502 | } | 5502 | } |
| 5503 | #else | 5503 | #else |
| 5504 | INLINE bool | 5504 | INLINE bool |
diff --git a/src/pdumper.c b/src/pdumper.c index 5bd0d8ca44a..40798ff48e9 100644 --- a/src/pdumper.c +++ b/src/pdumper.c | |||
| @@ -5498,12 +5498,12 @@ dump_do_dump_relocation (const uintptr_t dump_base, | |||
| 5498 | if (!NILP (lambda_data_idx)) | 5498 | if (!NILP (lambda_data_idx)) |
| 5499 | { | 5499 | { |
| 5500 | /* This is an anonymous lambda. | 5500 | /* This is an anonymous lambda. |
| 5501 | We must fixup d_reloc_imp so the lambda can be referenced | 5501 | We must fixup d_reloc so the lambda can be referenced |
| 5502 | by code. */ | 5502 | by code. */ |
| 5503 | Lisp_Object tem; | 5503 | Lisp_Object tem; |
| 5504 | XSETSUBR (tem, subr); | 5504 | XSETSUBR (tem, subr); |
| 5505 | Lisp_Object *fixup = | 5505 | Lisp_Object *fixup = |
| 5506 | &(comp_u->data_imp_relocs[XFIXNUM (lambda_data_idx)]); | 5506 | &(comp_u->data_relocs[XFIXNUM (lambda_data_idx)]); |
| 5507 | eassert (EQ (*fixup, Qlambda_fixup)); | 5507 | eassert (EQ (*fixup, Qlambda_fixup)); |
| 5508 | *fixup = tem; | 5508 | *fixup = tem; |
| 5509 | Fputhash (tem, Qt, comp_u->lambda_gc_guard_h); | 5509 | Fputhash (tem, Qt, comp_u->lambda_gc_guard_h); |