diff options
| author | Andrea Corallo | 2019-07-13 15:48:02 +0200 |
|---|---|---|
| committer | Andrea Corallo | 2020-01-01 11:33:52 +0100 |
| commit | 73cb29c3fb6d56f32f77ec201f9b61ac77e57290 (patch) | |
| tree | 24b08129fdf8fce7d8d07a2f300ec93be5b57c94 /src/comp.c | |
| parent | 973a7b149f1362c4201d38bffeabbf857e7bb6d5 (diff) | |
| download | emacs-73cb29c3fb6d56f32f77ec201f9b61ac77e57290.tar.gz emacs-73cb29c3fb6d56f32f77ec201f9b61ac77e57290.zip | |
varset support 5 test passing
Diffstat (limited to 'src/comp.c')
| -rw-r--r-- | src/comp.c | 79 |
1 files changed, 58 insertions, 21 deletions
diff --git a/src/comp.c b/src/comp.c index cbbc5f03782..25598aa20c1 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -966,6 +966,58 @@ emit_mvar_val (Lisp_Object mvar) | |||
| 966 | return emit_lisp_obj_from_ptr (FUNCALL1 (comp-mvar-constant, mvar)); | 966 | return emit_lisp_obj_from_ptr (FUNCALL1 (comp-mvar-constant, mvar)); |
| 967 | } | 967 | } |
| 968 | 968 | ||
| 969 | static gcc_jit_rvalue * | ||
| 970 | emit_limple_call (Lisp_Object arg1) | ||
| 971 | { | ||
| 972 | char *calle = (char *) SDATA (SYMBOL_NAME (SECOND (arg1))); | ||
| 973 | Lisp_Object call_args = XCDR (XCDR (arg1)); | ||
| 974 | int i = 0; | ||
| 975 | |||
| 976 | if (calle[0] == 'F') | ||
| 977 | { | ||
| 978 | /* | ||
| 979 | Ex: (= #s(comp-mvar 6 1 nil nil nil) | ||
| 980 | (call Fcar #s(comp-mvar 4 0 nil nil nil))) | ||
| 981 | |||
| 982 | Ex: (= #s(comp-mvar 5 0 nil nil cons) | ||
| 983 | (call Fcons #s(comp-mvar 3 0 t 1 nil) | ||
| 984 | #s(comp-mvar 4 nil t nil nil))) | ||
| 985 | */ | ||
| 986 | |||
| 987 | ptrdiff_t nargs = list_length (call_args); | ||
| 988 | gcc_jit_rvalue *gcc_args[nargs]; | ||
| 989 | FOR_EACH_TAIL (call_args) | ||
| 990 | gcc_args[i++] = emit_mvar_val (XCAR (call_args)); | ||
| 991 | |||
| 992 | return emit_call (calle, comp.lisp_obj_type, nargs, gcc_args); | ||
| 993 | } | ||
| 994 | else if (!strcmp (calle, "set_internal")) | ||
| 995 | { | ||
| 996 | /* | ||
| 997 | Ex: (set #s(comp-mvar 8 1 nil nil nil) | ||
| 998 | (call set_internal | ||
| 999 | #s(comp-mvar 7 nil t xxx nil) | ||
| 1000 | #s(comp-mvar 6 1 t 3 nil))) | ||
| 1001 | */ | ||
| 1002 | /* TODO: Inline the most common case. */ | ||
| 1003 | eassert (list_length (call_args) == 2); | ||
| 1004 | gcc_jit_rvalue *gcc_args[4]; | ||
| 1005 | FOR_EACH_TAIL (call_args) | ||
| 1006 | gcc_args[i++] = emit_mvar_val (XCAR (call_args)); | ||
| 1007 | gcc_args[2] = emit_lisp_obj_from_ptr (Qnil); | ||
| 1008 | gcc_args[3] = gcc_jit_context_new_rvalue_from_int (comp.ctxt, | ||
| 1009 | comp.int_type, | ||
| 1010 | SET_INTERNAL_SET); | ||
| 1011 | gcc_jit_block_add_eval ( | ||
| 1012 | comp.block, | ||
| 1013 | NULL, | ||
| 1014 | emit_call ("set_internal", comp.void_type , 4, gcc_args)); | ||
| 1015 | |||
| 1016 | return NULL; | ||
| 1017 | } | ||
| 1018 | error ("LIMPLE inconsiste call"); | ||
| 1019 | } | ||
| 1020 | |||
| 969 | static void | 1021 | static void |
| 970 | emit_limple_inst (Lisp_Object inst) | 1022 | emit_limple_inst (Lisp_Object inst) |
| 971 | { | 1023 | { |
| @@ -1000,23 +1052,7 @@ emit_limple_inst (Lisp_Object inst) | |||
| 1000 | } | 1052 | } |
| 1001 | else if (EQ (FIRST (arg1), Qcall)) | 1053 | else if (EQ (FIRST (arg1), Qcall)) |
| 1002 | { | 1054 | { |
| 1003 | /* | 1055 | res = emit_limple_call (arg1); |
| 1004 | Ex: (= #s(comp-mvar 6 1 nil nil nil) | ||
| 1005 | (call Fcar #s(comp-mvar 4 0 nil nil nil))) | ||
| 1006 | |||
| 1007 | Ex: (= #s(comp-mvar 5 0 nil nil cons) | ||
| 1008 | (call Fcons #s(comp-mvar 3 0 t 1 nil) | ||
| 1009 | #s(comp-mvar 4 nil t nil nil))) | ||
| 1010 | */ | ||
| 1011 | |||
| 1012 | char *calle = (char *) SDATA (SYMBOL_NAME (SECOND (arg1))); | ||
| 1013 | Lisp_Object call_args = XCDR (XCDR (arg1)); | ||
| 1014 | ptrdiff_t nargs = list_length (call_args); | ||
| 1015 | gcc_jit_rvalue *gcc_args[nargs]; | ||
| 1016 | int i = 0; | ||
| 1017 | FOR_EACH_TAIL (call_args) | ||
| 1018 | gcc_args[i++] = emit_mvar_val (XCAR (call_args)); | ||
| 1019 | res = emit_call (calle, comp.lisp_obj_type, nargs, gcc_args); | ||
| 1020 | } | 1056 | } |
| 1021 | else if (EQ (FIRST (arg1), Qcallref)) | 1057 | else if (EQ (FIRST (arg1), Qcallref)) |
| 1022 | { | 1058 | { |
| @@ -1038,10 +1074,11 @@ emit_limple_inst (Lisp_Object inst) | |||
| 1038 | { | 1074 | { |
| 1039 | error ("LIMPLE inconsistent arg1 for op ="); | 1075 | error ("LIMPLE inconsistent arg1 for op ="); |
| 1040 | } | 1076 | } |
| 1041 | gcc_jit_block_add_assignment (comp.block, | 1077 | if (res) |
| 1042 | NULL, | 1078 | gcc_jit_block_add_assignment (comp.block, |
| 1043 | comp.frame[slot_n], | 1079 | NULL, |
| 1044 | res); | 1080 | comp.frame[slot_n], |
| 1081 | res); | ||
| 1045 | } | 1082 | } |
| 1046 | else if (EQ (op, Qsetpar)) | 1083 | else if (EQ (op, Qsetpar)) |
| 1047 | { | 1084 | { |