diff options
| author | Andrea Corallo | 2020-01-11 09:50:34 +0100 |
|---|---|---|
| committer | Andrea Corallo | 2020-01-11 14:34:58 +0100 |
| commit | 93ed2c32dfd2e385ab0b75e9cbc0768c29b15b50 (patch) | |
| tree | 12420f140292ae927c10d79a85dab2d8dd8f85c1 /src | |
| parent | a59cc78fcb8df8acbf5139c2b4d2fada55627248 (diff) | |
| download | emacs-93ed2c32dfd2e385ab0b75e9cbc0768c29b15b50.tar.gz emacs-93ed2c32dfd2e385ab0b75e9cbc0768c29b15b50.zip | |
Move function reloc data into pure space during bootstrap
Diffstat (limited to 'src')
| -rw-r--r-- | src/comp.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/src/comp.c b/src/comp.c index bb8b952cf52..0d1f83eb8ff 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -883,7 +883,7 @@ emit_make_fixnum (gcc_jit_rvalue *obj) | |||
| 883 | } | 883 | } |
| 884 | 884 | ||
| 885 | static gcc_jit_rvalue * | 885 | static gcc_jit_rvalue * |
| 886 | emit_const_lisp_obj (Lisp_Object obj) | 886 | emit_const_lisp_obj (Lisp_Object obj, Lisp_Object impure) |
| 887 | { | 887 | { |
| 888 | emit_comment (format_string ("const lisp obj: %s", | 888 | emit_comment (format_string ("const lisp obj: %s", |
| 889 | SSDATA (Fprin1_to_string (obj, Qnil)))); | 889 | SSDATA (Fprin1_to_string (obj, Qnil)))); |
| @@ -895,11 +895,13 @@ emit_const_lisp_obj (Lisp_Object obj) | |||
| 895 | NULL)); | 895 | NULL)); |
| 896 | 896 | ||
| 897 | Lisp_Object d_reloc_idx = CALL1I (comp-ctxt-data-relocs-idx, Vcomp_ctxt); | 897 | Lisp_Object d_reloc_idx = CALL1I (comp-ctxt-data-relocs-idx, Vcomp_ctxt); |
| 898 | ptrdiff_t reloc_fixn = XFIXNUM (Fgethash (obj, d_reloc_idx, Qnil)); | 898 | Lisp_Object packed_obj = Fcons (impure, obj); |
| 899 | Lisp_Object reloc_idx = Fgethash (packed_obj, d_reloc_idx, Qnil); | ||
| 900 | eassert (!NILP (reloc_idx)); | ||
| 899 | gcc_jit_rvalue *reloc_n = | 901 | gcc_jit_rvalue *reloc_n = |
| 900 | gcc_jit_context_new_rvalue_from_int (comp.ctxt, | 902 | gcc_jit_context_new_rvalue_from_int (comp.ctxt, |
| 901 | comp.ptrdiff_type, | 903 | comp.ptrdiff_type, |
| 902 | reloc_fixn); | 904 | XFIXNUM (reloc_idx)); |
| 903 | return | 905 | return |
| 904 | gcc_jit_lvalue_as_rvalue ( | 906 | gcc_jit_lvalue_as_rvalue ( |
| 905 | gcc_jit_context_new_array_access (comp.ctxt, | 907 | gcc_jit_context_new_array_access (comp.ctxt, |
| @@ -912,7 +914,7 @@ static gcc_jit_rvalue * | |||
| 912 | emit_NILP (gcc_jit_rvalue *x) | 914 | emit_NILP (gcc_jit_rvalue *x) |
| 913 | { | 915 | { |
| 914 | emit_comment ("NILP"); | 916 | emit_comment ("NILP"); |
| 915 | return emit_EQ (x, emit_const_lisp_obj (Qnil)); | 917 | return emit_EQ (x, emit_const_lisp_obj (Qnil, Qnil)); |
| 916 | } | 918 | } |
| 917 | 919 | ||
| 918 | static gcc_jit_rvalue * | 920 | static gcc_jit_rvalue * |
| @@ -1015,7 +1017,7 @@ emit_CHECK_CONS (gcc_jit_rvalue *x) | |||
| 1015 | 1017 | ||
| 1016 | gcc_jit_rvalue *args[] = | 1018 | gcc_jit_rvalue *args[] = |
| 1017 | { emit_CONSP (x), | 1019 | { emit_CONSP (x), |
| 1018 | emit_const_lisp_obj (Qconsp), | 1020 | emit_const_lisp_obj (Qconsp, Qnil), |
| 1019 | x }; | 1021 | x }; |
| 1020 | 1022 | ||
| 1021 | gcc_jit_block_add_eval ( | 1023 | gcc_jit_block_add_eval ( |
| @@ -1126,7 +1128,7 @@ emit_mvar_val (Lisp_Object mvar) | |||
| 1126 | return emit_cast (comp.lisp_obj_type, word); | 1128 | return emit_cast (comp.lisp_obj_type, word); |
| 1127 | } | 1129 | } |
| 1128 | /* Other const objects are fetched from the reloc array. */ | 1130 | /* Other const objects are fetched from the reloc array. */ |
| 1129 | return emit_const_lisp_obj (constant); | 1131 | return emit_const_lisp_obj (constant, CALL1I (comp-mvar-impure, mvar)); |
| 1130 | } | 1132 | } |
| 1131 | 1133 | ||
| 1132 | return gcc_jit_lvalue_as_rvalue (get_slot (mvar)); | 1134 | return gcc_jit_lvalue_as_rvalue (get_slot (mvar)); |
| @@ -1161,7 +1163,7 @@ emit_set_internal (Lisp_Object args) | |||
| 1161 | gcc_jit_rvalue *gcc_args[4]; | 1163 | gcc_jit_rvalue *gcc_args[4]; |
| 1162 | FOR_EACH_TAIL (args) | 1164 | FOR_EACH_TAIL (args) |
| 1163 | gcc_args[i++] = emit_mvar_val (XCAR (args)); | 1165 | gcc_args[i++] = emit_mvar_val (XCAR (args)); |
| 1164 | gcc_args[2] = emit_const_lisp_obj (Qnil); | 1166 | gcc_args[2] = emit_const_lisp_obj (Qnil, Qnil); |
| 1165 | gcc_args[3] = gcc_jit_context_new_rvalue_from_int (comp.ctxt, | 1167 | gcc_args[3] = gcc_jit_context_new_rvalue_from_int (comp.ctxt, |
| 1166 | comp.int_type, | 1168 | comp.int_type, |
| 1167 | SET_INTERNAL_SET); | 1169 | SET_INTERNAL_SET); |
| @@ -2360,11 +2362,11 @@ define_CAR_CDR (void) | |||
| 2360 | comp.block = is_nil_b; | 2362 | comp.block = is_nil_b; |
| 2361 | gcc_jit_block_end_with_return (comp.block, | 2363 | gcc_jit_block_end_with_return (comp.block, |
| 2362 | NULL, | 2364 | NULL, |
| 2363 | emit_const_lisp_obj (Qnil)); | 2365 | emit_const_lisp_obj (Qnil, Qnil)); |
| 2364 | 2366 | ||
| 2365 | comp.block = not_nil_b; | 2367 | comp.block = not_nil_b; |
| 2366 | gcc_jit_rvalue *wrong_type_args[] = | 2368 | gcc_jit_rvalue *wrong_type_args[] = |
| 2367 | { emit_const_lisp_obj (Qlistp), c }; | 2369 | { emit_const_lisp_obj (Qlistp, Qnil), c }; |
| 2368 | 2370 | ||
| 2369 | gcc_jit_block_add_eval (comp.block, | 2371 | gcc_jit_block_add_eval (comp.block, |
| 2370 | NULL, | 2372 | NULL, |
| @@ -2373,7 +2375,7 @@ define_CAR_CDR (void) | |||
| 2373 | false)); | 2375 | false)); |
| 2374 | gcc_jit_block_end_with_return (comp.block, | 2376 | gcc_jit_block_end_with_return (comp.block, |
| 2375 | NULL, | 2377 | NULL, |
| 2376 | emit_const_lisp_obj (Qnil)); | 2378 | emit_const_lisp_obj (Qnil, Qnil)); |
| 2377 | } | 2379 | } |
| 2378 | comp.car = func[0]; | 2380 | comp.car = func[0]; |
| 2379 | comp.cdr = func[1]; | 2381 | comp.cdr = func[1]; |
| @@ -2753,12 +2755,12 @@ define_bool_to_lisp_obj (void) | |||
| 2753 | comp.block = ret_t_block; | 2755 | comp.block = ret_t_block; |
| 2754 | gcc_jit_block_end_with_return (ret_t_block, | 2756 | gcc_jit_block_end_with_return (ret_t_block, |
| 2755 | NULL, | 2757 | NULL, |
| 2756 | emit_const_lisp_obj (Qt)); | 2758 | emit_const_lisp_obj (Qt, Qnil)); |
| 2757 | 2759 | ||
| 2758 | comp.block = ret_nil_block; | 2760 | comp.block = ret_nil_block; |
| 2759 | gcc_jit_block_end_with_return (ret_nil_block, | 2761 | gcc_jit_block_end_with_return (ret_nil_block, |
| 2760 | NULL, | 2762 | NULL, |
| 2761 | emit_const_lisp_obj (Qnil)); | 2763 | emit_const_lisp_obj (Qnil, Qnil)); |
| 2762 | 2764 | ||
| 2763 | } | 2765 | } |
| 2764 | 2766 | ||
| @@ -3285,8 +3287,17 @@ load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u, bool loading_dump) | |||
| 3285 | 3287 | ||
| 3286 | EMACS_INT d_vec_len = XFIXNUM (Flength (comp_u->data_vec)); | 3288 | EMACS_INT d_vec_len = XFIXNUM (Flength (comp_u->data_vec)); |
| 3287 | 3289 | ||
| 3290 | if (!loading_dump && !NILP (Vpurify_flag)) | ||
| 3291 | for (EMACS_INT i = 0; i < d_vec_len; i++) | ||
| 3292 | { | ||
| 3293 | Lisp_Object packed_obj = AREF (comp_u->data_vec, i); | ||
| 3294 | if (NILP (XCAR (packed_obj))) | ||
| 3295 | /* If is not impure can be copied into pure space. */ | ||
| 3296 | XSETCDR (packed_obj, Fpurecopy (XCDR (packed_obj))); | ||
| 3297 | } | ||
| 3298 | |||
| 3288 | for (EMACS_INT i = 0; i < d_vec_len; i++) | 3299 | for (EMACS_INT i = 0; i < d_vec_len; i++) |
| 3289 | data_relocs[i] = AREF (comp_u->data_vec, i); | 3300 | data_relocs[i] = XCDR (AREF (comp_u->data_vec, i)); |
| 3290 | 3301 | ||
| 3291 | if (!loading_dump) | 3302 | if (!loading_dump) |
| 3292 | { | 3303 | { |