aboutsummaryrefslogtreecommitdiffstats
path: root/src/jit.c
diff options
context:
space:
mode:
authorEli Zaretskii2018-08-29 19:58:20 +0300
committerEli Zaretskii2018-08-29 19:58:20 +0300
commit9efa35eea067199a4cd0a773da6dd1304410daba (patch)
tree8a33bd2f1786101ac70a887217e471b38c8b8c80 /src/jit.c
parentf6c33b45185727c3b50c8d9b0075c5c213b1b1be (diff)
downloademacs-9efa35eea067199a4cd0a773da6dd1304410daba.tar.gz
emacs-9efa35eea067199a4cd0a773da6dd1304410daba.zip
Fix types of Lisp objects in values and function calls
* src/jit.c (car_or_cdr, compile): Use lisp_object_type for Lisp objects. (init_jit): Define internal_catch_signature. (compile): Use internal_catch_signature for 'internal_catch', as ternary_signature doesn't fit.
Diffstat (limited to 'src/jit.c')
-rw-r--r--src/jit.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/jit.c b/src/jit.c
index c561bfefb20..6813f291de5 100644
--- a/src/jit.c
+++ b/src/jit.c
@@ -348,10 +348,11 @@ static jit_type_t void_void_signature;
348static jit_type_t lisp_void_signature; 348static jit_type_t lisp_void_signature;
349static jit_type_t push_handler_signature; 349static jit_type_t push_handler_signature;
350static jit_type_t setjmp_signature; 350static jit_type_t setjmp_signature;
351static jit_type_t internal_catch_signature;
351 352
352static jit_type_t subr_signature[SUBR_MAX_ARGS]; 353static jit_type_t subr_signature[SUBR_MAX_ARGS];
353 354
354static jit_type_t ptrdiff_t_type; 355static jit_type_t ptrdiff_t_type, lisp_object_type;
355 356
356 357
357/* Make a pointer constant. */ 358/* Make a pointer constant. */
@@ -717,7 +718,7 @@ car_or_cdr (jit_function_t func, jit_value_t val, off_t offset,
717 /* Is a cons. */ 718 /* Is a cons. */
718 tem = untag (func, val, Lisp_Cons); 719 tem = untag (func, val, Lisp_Cons);
719 tem = jit_insn_load_relative (func, tem, offset, 720 tem = jit_insn_load_relative (func, tem, offset,
720 jit_type_void_ptr); 721 lisp_object_type);
721 jit_insn_store (func, val, tem); 722 jit_insn_store (func, val, tem);
722 jit_insn_branch (func, next_insn); 723 jit_insn_branch (func, next_insn);
723 724
@@ -1086,19 +1087,19 @@ compile (ptrdiff_t bytestr_length, unsigned char *bytestr_data,
1086 } 1087 }
1087 1088
1088 for (int i = 0; i < stack_depth; ++i) 1089 for (int i = 0; i < stack_depth; ++i)
1089 stack[i] = jit_value_create (func, jit_type_void_ptr); 1090 stack[i] = jit_value_create (func, lisp_object_type);
1090 1091
1091 /* This is a placeholder; once we know how much space we'll need, we 1092 /* This is a placeholder; once we know how much space we'll need, we
1092 will allocate it and move it into place at the start of the 1093 will allocate it and move it into place at the start of the
1093 function. */ 1094 function. */
1094 jit_value_t scratch = jit_value_create (func, jit_type_void_ptr); 1095 jit_value_t scratch = jit_value_create (func, lisp_object_type);
1095 int scratch_slots_needed = 0; 1096 int scratch_slots_needed = 0;
1096 1097
1097 /* State needed if we need to emit a call to 1098 /* State needed if we need to emit a call to
1098 wrong_type_argument. */ 1099 wrong_type_argument. */
1099 bool called_wtype = false; 1100 bool called_wtype = false;
1100 jit_label_t wtype_label = jit_label_undefined; 1101 jit_label_t wtype_label = jit_label_undefined;
1101 jit_value_t wtype_arg = jit_value_create (func, jit_type_void_ptr); 1102 jit_value_t wtype_arg = jit_value_create (func, lisp_object_type);
1102 1103
1103 jit_label_t argfail = jit_label_undefined; 1104 jit_label_t argfail = jit_label_undefined;
1104 bool need_argfail = false; 1105 bool need_argfail = false;
@@ -1148,7 +1149,7 @@ compile (ptrdiff_t bytestr_length, unsigned char *bytestr_data,
1148 { 1149 {
1149 jit_value_t loaded 1150 jit_value_t loaded
1150 = jit_insn_load_relative (func, arg_vec, i * sizeof (Lisp_Object), 1151 = jit_insn_load_relative (func, arg_vec, i * sizeof (Lisp_Object),
1151 jit_type_void_ptr); 1152 lisp_object_type);
1152 jit_insn_store (func, stack[i], loaded); 1153 jit_insn_store (func, stack[i], loaded);
1153 } 1154 }
1154 1155
@@ -1177,7 +1178,7 @@ compile (ptrdiff_t bytestr_length, unsigned char *bytestr_data,
1177 jit_value_t loaded 1178 jit_value_t loaded
1178 = jit_insn_load_relative (func, arg_vec, 1179 = jit_insn_load_relative (func, arg_vec,
1179 i * sizeof (Lisp_Object), 1180 i * sizeof (Lisp_Object),
1180 jit_type_void_ptr); 1181 lisp_object_type);
1181 jit_insn_store (func, stack[i], loaded); 1182 jit_insn_store (func, stack[i], loaded);
1182 } 1183 }
1183 1184
@@ -1204,7 +1205,7 @@ compile (ptrdiff_t bytestr_length, unsigned char *bytestr_data,
1204 1205
1205 jit_value_t vec_addr 1206 jit_value_t vec_addr
1206 = jit_insn_load_elem_address (func, arg_vec, nonrest_val, 1207 = jit_insn_load_elem_address (func, arg_vec, nonrest_val,
1207 jit_type_void_ptr); 1208 lisp_object_type);
1208 jit_value_t new_args 1209 jit_value_t new_args
1209 = jit_insn_sub (func, n_args, nonrest_val); 1210 = jit_insn_sub (func, n_args, nonrest_val);
1210 1211
@@ -1627,7 +1628,7 @@ compile (ptrdiff_t bytestr_length, unsigned char *bytestr_data,
1627 /* FIXME this lies about the signature. */ 1628 /* FIXME this lies about the signature. */
1628 jit_value_t result = jit_insn_call_native (func, "internal_catch", 1629 jit_value_t result = jit_insn_call_native (func, "internal_catch",
1629 internal_catch, 1630 internal_catch,
1630 ternary_signature, 1631 internal_catch_signature,
1631 args, 3, 1632 args, 3,
1632 JIT_CALL_NOTHROW); 1633 JIT_CALL_NOTHROW);
1633 PUSH (result); 1634 PUSH (result);
@@ -1676,7 +1677,7 @@ compile (ptrdiff_t bytestr_length, unsigned char *bytestr_data,
1676 jit_value_t val 1677 jit_value_t val
1677 = jit_insn_load_relative (func, hlist, 1678 = jit_insn_load_relative (func, hlist,
1678 offsetof (struct handler, val), 1679 offsetof (struct handler, val),
1679 jit_type_void_ptr); 1680 lisp_object_type);
1680 1681
1681 PUSH (val); 1682 PUSH (val);
1682 PUSH_PC (handler_pc); 1683 PUSH_PC (handler_pc);
@@ -2652,7 +2653,7 @@ init_jit (void)
2652{ 2653{
2653#define LEN SUBR_MAX_ARGS 2654#define LEN SUBR_MAX_ARGS
2654 2655
2655 jit_type_t params[LEN], lisp_object_type; 2656 jit_type_t params[LEN];
2656 int i; 2657 int i;
2657 2658
2658#ifdef WINDOWSNT 2659#ifdef WINDOWSNT
@@ -2756,6 +2757,11 @@ init_jit (void)
2756 jit_type_void_ptr, 2757 jit_type_void_ptr,
2757 params, 2, 1); 2758 params, 2, 1);
2758 2759
2760 params[1] = jit_type_void_ptr;
2761 internal_catch_signature = jit_type_create_signature (jit_abi_cdecl,
2762 lisp_object_type,
2763 params, 3, 1);
2764
2759 emacs_jit_initialized = true; 2765 emacs_jit_initialized = true;
2760} 2766}
2761 2767