summaryrefslogtreecommitdiff
path: root/src/comp.c
diff options
context:
space:
mode:
authorAndrea Corallo <andrea_corallo@yahoo.it>2019-09-05 17:24:02 +0200
committerAndrea Corallo <akrl@sdf.org>2020-01-01 11:37:43 +0100
commitc05d414844f6e1e0af05ef0cbcabe3313f5089d0 (patch)
treead5cdf62a34699668833c7eedc5332d9a42677ac /src/comp.c
parent43172dd01fc7344f71f6e1d92fe051942f360355 (diff)
downloademacs-c05d414844f6e1e0af05ef0cbcabe3313f5089d0.tar.gz
emacs-c05d414844f6e1e0af05ef0cbcabe3313f5089d0.tar.bz2
emacs-c05d414844f6e1e0af05ef0cbcabe3313f5089d0.zip
emit fixnum constants as immediates
Diffstat (limited to 'src/comp.c')
-rw-r--r--src/comp.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/comp.c b/src/comp.c
index 4f40d83f82b..ebc4e8fba0e 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -1013,12 +1013,24 @@ emit_PURE_P (gcc_jit_rvalue *ptr)
static gcc_jit_rvalue *
emit_mvar_val (Lisp_Object mvar)
{
+ Lisp_Object const_vld = FUNCALL1 (comp-mvar-const-vld, mvar);
+ Lisp_Object constant = FUNCALL1 (comp-mvar-constant, mvar);
- if (NILP (FUNCALL1 (comp-mvar-slot, mvar)))
+ if (!NILP (const_vld))
{
- /* If the slot is not specified this must be a constant. */
- eassert (!NILP (FUNCALL1 (comp-mvar-const-vld, mvar)));
- return emit_const_lisp_obj (FUNCALL1 (comp-mvar-constant, mvar));
+ if (FIXNUMP (constant))
+ {
+ /* We can still emit directly objects that are selfcontained in a word
+ read (fixnums). */
+ emit_comment (SSDATA (Fprin1_to_string (constant, Qnil)));
+ gcc_jit_rvalue *word =
+ gcc_jit_context_new_rvalue_from_ptr(comp.ctxt,
+ comp.void_ptr_type,
+ constant);
+ return emit_cast (comp.lisp_obj_type, word);
+ }
+ /* Other const objects are fetched from the reloc array. */
+ return emit_const_lisp_obj (constant);
}
return