aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrea Corallo2019-08-11 10:14:57 +0200
committerAndrea Corallo2020-01-01 11:33:58 +0100
commit5dda07d22c8d974b31e196a802414c267fac5cc9 (patch)
tree1a4098c8c6900d171b9de968e0a7daef136be128 /src
parent9901f47ef77e777ebe0183624024527ce691256d (diff)
downloademacs-5dda07d22c8d974b31e196a802414c267fac5cc9.tar.gz
emacs-5dda07d22c8d974b31e196a802414c267fac5cc9.zip
dipatcher support for helper_unwind_protect record_unwind_current_buffer
Diffstat (limited to 'src')
-rw-r--r--src/comp.c48
1 files changed, 31 insertions, 17 deletions
diff --git a/src/comp.c b/src/comp.c
index e101666cb6b..42186e7ea5d 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -246,7 +246,7 @@ declare_block (Lisp_Object block_name)
246} 246}
247 247
248static void 248static void
249register_dispatch (Lisp_Object key, void *func) 249register_emitter (Lisp_Object key, void *func)
250{ 250{
251 Lisp_Object value = make_mint_ptr (func); 251 Lisp_Object value = make_mint_ptr (func);
252 Fputhash (key, value, comp.emitter_dispatcher); 252 Fputhash (key, value, comp.emitter_dispatcher);
@@ -1082,14 +1082,8 @@ emit_limple_ncall_prolog (EMACS_UINT n)
1082/* This is for a regular function with arguments as m-var. */ 1082/* This is for a regular function with arguments as m-var. */
1083 1083
1084static gcc_jit_rvalue * 1084static gcc_jit_rvalue *
1085emit_simple_limple_call (Lisp_Object args) 1085emit_simple_limple_call (Lisp_Object args, gcc_jit_type *ret_type)
1086{ 1086{
1087 /*
1088 Ex: (call Fcar #s(comp-mvar 4 0 nil nil nil))
1089
1090 Ex: (call Fcons #s(comp-mvar 3 0 t 1 nil)
1091 #s(comp-mvar 4 nil t nil nil))
1092 */
1093 int i = 0; 1087 int i = 0;
1094 char *calle = (char *) SDATA (SYMBOL_NAME (FIRST (args))); 1088 char *calle = (char *) SDATA (SYMBOL_NAME (FIRST (args)));
1095 args = XCDR (args); 1089 args = XCDR (args);
@@ -1098,7 +1092,25 @@ emit_simple_limple_call (Lisp_Object args)
1098 FOR_EACH_TAIL (args) 1092 FOR_EACH_TAIL (args)
1099 gcc_args[i++] = emit_mvar_val (XCAR (args)); 1093 gcc_args[i++] = emit_mvar_val (XCAR (args));
1100 1094
1101 return emit_call (calle, comp.lisp_obj_type, nargs, gcc_args); 1095 return emit_call (calle, ret_type, nargs, gcc_args);
1096}
1097
1098static gcc_jit_rvalue *
1099emit_simple_limple_call_lisp_ret (Lisp_Object args)
1100{
1101 /*
1102 Ex: (call Fcar #s(comp-mvar 4 0 nil nil nil))
1103
1104 Ex: (call Fcons #s(comp-mvar 3 0 t 1 nil)
1105 #s(comp-mvar 4 nil t nil nil))
1106 */
1107 return emit_simple_limple_call (args, comp.lisp_obj_type);
1108}
1109
1110static gcc_jit_rvalue *
1111emit_simple_limple_call_void_ret (Lisp_Object args)
1112{
1113 return emit_simple_limple_call (args, comp.void_type);
1102} 1114}
1103 1115
1104/* Entry point to dispatch emitting (call fun ...). */ 1116/* Entry point to dispatch emitting (call fun ...). */
@@ -1117,13 +1129,9 @@ emit_limple_call (Lisp_Object args)
1117 } 1129 }
1118 else if (calle[0] == 'F') 1130 else if (calle[0] == 'F')
1119 { 1131 {
1120 return emit_simple_limple_call (args); 1132 return emit_simple_limple_call_lisp_ret (args);
1121 }
1122 else if (!strcmp (calle, "record_unwind_current_buffer") ||
1123 !strcmp (calle, "helper_unwind_protect"))
1124 {
1125 return emit_call (calle, comp.void_type, 0, NULL);
1126 } 1133 }
1134
1127 error ("LIMPLE call is inconsistent"); 1135 error ("LIMPLE call is inconsistent");
1128} 1136}
1129 1137
@@ -2059,8 +2067,12 @@ DEFUN ("comp-init-ctxt", Fcomp_init_ctxt, Scomp_init_ctxt,
2059 { 2067 {
2060 /* Move this into syms_of_comp the day will be dumpable. */ 2068 /* Move this into syms_of_comp the day will be dumpable. */
2061 comp.emitter_dispatcher = CALLN (Fmake_hash_table); 2069 comp.emitter_dispatcher = CALLN (Fmake_hash_table);
2062 register_dispatch (Qset_internal, emit_set_internal); 2070 register_emitter (Qset_internal, emit_set_internal);
2063 register_dispatch (Qhelper_unbind_n, emit_simple_limple_call); 2071 register_emitter (Qhelper_unbind_n, emit_simple_limple_call_lisp_ret);
2072 register_emitter (Qhelper_unwind_protect,
2073 emit_simple_limple_call_void_ret);
2074 register_emitter (Qrecord_unwind_current_buffer,
2075 emit_simple_limple_call_lisp_ret);
2064 } 2076 }
2065 2077
2066 comp.ctxt = gcc_jit_context_acquire(); 2078 comp.ctxt = gcc_jit_context_acquire();
@@ -2436,7 +2448,9 @@ syms_of_comp (void)
2436 DEFSYM (Qcatcher, "catcher"); 2448 DEFSYM (Qcatcher, "catcher");
2437 DEFSYM (Qentry, "entry"); 2449 DEFSYM (Qentry, "entry");
2438 DEFSYM (Qset_internal, "set_internal"); 2450 DEFSYM (Qset_internal, "set_internal");
2451 DEFSYM (Qrecord_unwind_current_buffer, "record_unwind_current_buffer");
2439 DEFSYM (Qhelper_unbind_n, "helper_unbind_n"); 2452 DEFSYM (Qhelper_unbind_n, "helper_unbind_n");
2453 DEFSYM (Qhelper_unwind_protect, "helper_unwind_protect");
2440 2454
2441 defsubr (&Scomp_init_ctxt); 2455 defsubr (&Scomp_init_ctxt);
2442 defsubr (&Scomp_release_ctxt); 2456 defsubr (&Scomp_release_ctxt);