aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVibhav Pant2023-06-07 21:07:39 +0530
committerVibhav Pant2023-06-07 21:07:39 +0530
commit5bbb573b45d49235ec549ec4b1189a6582aea8da (patch)
treec0013985e85c6f14d63abbecf79c92f009ea2e00
parent49ffcbf86a32a8a217538d4df3736fe069ccf35d (diff)
downloademacs-scratch/comp-static-data.tar.gz
emacs-scratch/comp-static-data.zip
src/comp.c: Compile float_blocks as constants.scratch/comp-static-data
* src/comp.c (push_float_block): Declare float_block globals as consts. (float_block_new_block): Bitcast const float_block to their unqualified type, to avoid libgccjit type errors.
-rw-r--r--src/comp.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/comp.c b/src/comp.c
index dadd5255b72..a87f59be3d8 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -2664,11 +2664,12 @@ push_float_block (void)
2664 char *name 2664 char *name
2665 = format_string ("float_block_%ld", 2665 = format_string ("float_block_%ld",
2666 XFIXNUM (Flength (comp.float_block_list))); 2666 XFIXNUM (Flength (comp.float_block_list)));
2667 gcc_jit_type *float_block_type
2668 = gcc_jit_type_get_const (comp.float_block_aligned_type);
2667 gcc_jit_lvalue *var 2669 gcc_jit_lvalue *var
2668 = gcc_jit_context_new_global (comp.ctxt, NULL, 2670 = gcc_jit_context_new_global (comp.ctxt, NULL,
2669 GCC_JIT_GLOBAL_INTERNAL, 2671 GCC_JIT_GLOBAL_INTERNAL,
2670 comp.float_block_aligned_type, 2672 float_block_type, name);
2671 name);
2672 Lisp_Object entry 2673 Lisp_Object entry
2673 = CALLN (Fvector, make_mint_ptr (var), make_fixnum (-1), 2674 = CALLN (Fvector, make_mint_ptr (var), make_fixnum (-1),
2674 Fmake_vector (make_fixnum (float_block_floats_length), 2675 Fmake_vector (make_fixnum (float_block_floats_length),
@@ -2891,12 +2892,17 @@ float_block_new_float (gcc_jit_rvalue *init_val)
2891 alloc_block_set_last_idx (block, idx); 2892 alloc_block_set_last_idx (block, idx);
2892 alloc_block_put_cons (block, init_val, idx); 2893 alloc_block_put_cons (block, init_val, idx);
2893 2894
2894 gcc_jit_lvalue *var = alloc_block_var (block); 2895 gcc_jit_rvalue *block_rval = gcc_jit_lvalue_as_rvalue (alloc_block_var (block));
2895 gcc_jit_lvalue *floats 2896 block_rval
2896 = gcc_jit_lvalue_access_field (var, NULL, 2897 = gcc_jit_context_new_bitcast (comp.ctxt, NULL, block_rval,
2898 gcc_jit_type_unqualified (
2899 gcc_jit_rvalue_get_type (
2900 block_rval)));
2901 gcc_jit_rvalue *floats
2902 = gcc_jit_rvalue_access_field (block_rval, NULL,
2897 comp.float_block_floats); 2903 comp.float_block_floats);
2898 return gcc_jit_context_new_array_access ( 2904 return gcc_jit_context_new_array_access (
2899 comp.ctxt, NULL, gcc_jit_lvalue_as_rvalue (floats), 2905 comp.ctxt, NULL, floats,
2900 gcc_jit_context_new_rvalue_from_int (comp.ctxt, comp.ptrdiff_type, 2906 gcc_jit_context_new_rvalue_from_int (comp.ctxt, comp.ptrdiff_type,
2901 idx)); 2907 idx));
2902} 2908}