aboutsummaryrefslogtreecommitdiffstats
path: root/src/comp.c
diff options
context:
space:
mode:
authorAndrea Corallo2019-07-01 22:30:08 +0200
committerAndrea Corallo2020-01-01 11:33:48 +0100
commit481062f42e25ea2483593f112794c737698d3d6b (patch)
treefc7536c001b70aa6125ba5113308c1643edf5835 /src/comp.c
parent4311d6e04a3131273197d58cedacd150b35c691a (diff)
downloademacs-481062f42e25ea2483593f112794c737698d3d6b.tar.gz
emacs-481062f42e25ea2483593f112794c737698d3d6b.zip
introduce parsearg
Diffstat (limited to 'src/comp.c')
-rw-r--r--src/comp.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/comp.c b/src/comp.c
index 4d121dc7e66..62ce25f63e3 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -2053,14 +2053,15 @@ compile_f (const char *lisp_f_name, const char *c_f_name,
2053 EMACS_INT stack_depth, Lisp_Object *vectorp, 2053 EMACS_INT stack_depth, Lisp_Object *vectorp,
2054 ptrdiff_t vector_size, Lisp_Object args_template) 2054 ptrdiff_t vector_size, Lisp_Object args_template)
2055{ 2055{
2056 USE_SAFE_ALLOCA;
2056 gcc_jit_rvalue *res; 2057 gcc_jit_rvalue *res;
2057 comp_f_res_t comp_res = { NULL, 0, 0 }; 2058 comp_f_res_t comp_res = { NULL, 0, 0 };
2058 ptrdiff_t pc = 0; 2059 ptrdiff_t pc = 0;
2059 gcc_jit_rvalue *args[MAX_POP]; 2060 gcc_jit_rvalue *args[MAX_POP];
2060 unsigned op; 2061 unsigned op;
2061 unsigned pushhandler_n = 0; 2062 unsigned pushhandler_n = 0;
2062 2063 comp_res.min_args = 0;
2063 USE_SAFE_ALLOCA; 2064 comp_res.max_args = MANY;
2064 2065
2065 /* Meta-stack we use to flat the bytecode written for push and pop 2066 /* Meta-stack we use to flat the bytecode written for push and pop
2066 Emacs VM.*/ 2067 Emacs VM.*/
@@ -2069,6 +2070,7 @@ compile_f (const char *lisp_f_name, const char *c_f_name,
2069 stack = stack_base; 2070 stack = stack_base;
2070 stack_over = stack_base + stack_depth; 2071 stack_over = stack_base + stack_depth;
2071 2072
2073 bool parse_args = true;
2072 if (FIXNUMP (args_template)) 2074 if (FIXNUMP (args_template))
2073 { 2075 {
2074 ptrdiff_t at = XFIXNUM (args_template); 2076 ptrdiff_t at = XFIXNUM (args_template);
@@ -2081,19 +2083,16 @@ compile_f (const char *lisp_f_name, const char *c_f_name,
2081 eassert (!rest); 2083 eassert (!rest);
2082 2084
2083 if (!rest && nonrest < SUBR_MAX_ARGS) 2085 if (!rest && nonrest < SUBR_MAX_ARGS)
2084 comp_res.max_args = nonrest; 2086 {
2087 comp_res.max_args = nonrest;
2088 parse_args = false;
2089 }
2085 } 2090 }
2086 else if (CONSP (args_template))
2087 /* FIXME */
2088 comp_res.min_args = comp_res.max_args = XFIXNUM (Flength (args_template));
2089
2090 else
2091 eassert (SYMBOLP (args_template) && args_template == Qnil);
2092
2093 2091
2094 /* Current function being compiled. */ 2092 eassert (!parse_args);
2095 comp.func = emit_func_declare (c_f_name, comp.lisp_obj_type, comp_res.max_args, 2093 comp.func =
2096 NULL, GCC_JIT_FUNCTION_EXPORTED, false); 2094 emit_func_declare (c_f_name, comp.lisp_obj_type, comp_res.max_args, NULL,
2095 GCC_JIT_FUNCTION_EXPORTED, false);
2097 2096
2098 gcc_jit_lvalue *meta_stack_array = 2097 gcc_jit_lvalue *meta_stack_array =
2099 gcc_jit_function_new_local ( 2098 gcc_jit_function_new_local (