]> git.eshelyaron.com Git - emacs.git/commitdiff
introduce parsearg
authorAndrea Corallo <andrea_corallo@yahoo.it>
Mon, 1 Jul 2019 20:30:08 +0000 (22:30 +0200)
committerAndrea Corallo <akrl@sdf.org>
Wed, 1 Jan 2020 10:33:48 +0000 (11:33 +0100)
src/comp.c

index 4d121dc7e663927db0615191f85e9e8f52c64d77..62ce25f63e36fc9b893e233a32cdc1cb2d21d1b2 100644 (file)
@@ -2053,14 +2053,15 @@ compile_f (const char *lisp_f_name, const char *c_f_name,
           EMACS_INT stack_depth, Lisp_Object *vectorp,
           ptrdiff_t vector_size, Lisp_Object args_template)
 {
+  USE_SAFE_ALLOCA;
   gcc_jit_rvalue *res;
   comp_f_res_t comp_res = { NULL, 0, 0 };
   ptrdiff_t pc = 0;
   gcc_jit_rvalue *args[MAX_POP];
   unsigned op;
-  unsigned pushhandler_n  = 0;
-
-  USE_SAFE_ALLOCA;
+  unsigned pushhandler_n = 0;
+  comp_res.min_args = 0;
+  comp_res.max_args = MANY;
 
   /* Meta-stack we use to flat the bytecode written for push and pop
      Emacs VM.*/
@@ -2069,6 +2070,7 @@ compile_f (const char *lisp_f_name, const char *c_f_name,
   stack = stack_base;
   stack_over = stack_base + stack_depth;
 
+  bool parse_args = true;
   if (FIXNUMP (args_template))
     {
       ptrdiff_t at = XFIXNUM (args_template);
@@ -2081,19 +2083,16 @@ compile_f (const char *lisp_f_name, const char *c_f_name,
       eassert (!rest);
 
       if (!rest && nonrest < SUBR_MAX_ARGS)
-       comp_res.max_args = nonrest;
+       {
+         comp_res.max_args = nonrest;
+         parse_args = false;
+       }
     }
-  else if (CONSP (args_template))
-    /* FIXME */
-    comp_res.min_args = comp_res.max_args = XFIXNUM (Flength (args_template));
-
-  else
-    eassert (SYMBOLP (args_template) && args_template == Qnil);
-
 
-  /* Current function being compiled.  */
-  comp.func = emit_func_declare (c_f_name, comp.lisp_obj_type, comp_res.max_args,
-                                NULL, GCC_JIT_FUNCTION_EXPORTED, false);
+  eassert (!parse_args);
+  comp.func =
+    emit_func_declare (c_f_name, comp.lisp_obj_type, comp_res.max_args, NULL,
+                      GCC_JIT_FUNCTION_EXPORTED, false);
 
   gcc_jit_lvalue *meta_stack_array =
     gcc_jit_function_new_local (