(comp-emit-block 'entry)
(comp-emit-annotation (concat "Lisp function: "
(symbol-name (comp-func-symbol-name func))))
- (cl-loop for i below (comp-args-min (comp-func-args func))
- do (progn
- (cl-incf (comp-sp))
- (comp-emit `(setpar ,(comp-slot) ,i))))
+ (cl-loop for i below (comp-args-max (comp-func-args func))
+ do (cl-incf (comp-sp))
+ do (comp-emit `(setpar ,(comp-slot) ,i)))
;; Body
(comp-emit-block 'bb_1)
(mapc #'comp-limplify-lap-inst (comp-func-lap func))
char *c_name = (char *) SDATA (FUNCALL1 (comp-func-c-func-name, func));
Lisp_Object args = FUNCALL1 (comp-func-args, func);
EMACS_INT frame_size = XFIXNUM (FUNCALL1 (comp-func-frame-size, func));
- EMACS_INT min_args = XFIXNUM (FUNCALL1 (comp-args-min, args));
- /* EMACS_INT max_args = XFIXNUM (FUNCALL1 (comp-args-max, args)); */
- bool ncall = !NILP (FUNCALL1 (comp-args-ncall-conv, args));
+ /* EMACS_INT min_args = XFIXNUM (FUNCALL1 (comp-args-min, args)); */
+ EMACS_INT max_args = XFIXNUM (FUNCALL1 (comp-args-max, args));
+ bool ncall = !NILP (FUNCALL1 (comp-args-ncall-conv, args));
if (!ncall)
{
comp.func =
- emit_func_declare (c_name, comp.lisp_obj_type, min_args,
+ emit_func_declare (c_name, comp.lisp_obj_type, max_args,
NULL, GCC_JIT_FUNCTION_EXPORTED, false);
}
else
x->s.function.a0 = gcc_jit_result_get_code(gcc_res, c_name);
eassert (x->s.function.a0);
x->s.min_args = XFIXNUM (FUNCALL1 (comp-args-min, args));
- x->s.max_args = XFIXNUM (FUNCALL1 (comp-args-min, args));
+ x->s.max_args = XFIXNUM (FUNCALL1 (comp-args-max, args));
x->s.symbol_name = symbol_name;
defsubr(x);
(should (equal (comp-tests-ffuncall-caller-f) '(1 2 3)))
- ;; (defun comp-tests-ffuncall-callee-optional-f (a b &optional c d)
- ;; (list a b c d))
- ;; (native-compile #'comp-tests-ffuncall-callee-optional-f)
+ (defun comp-tests-ffuncall-callee-optional-f (a b &optional c d)
+ (list a b c d))
+ (native-compile #'comp-tests-ffuncall-callee-optional-f)
- ;; (should (equal (comp-tests-ffuncall-callee-optional-f 1 2 3 4) '(1 2 3 4)))
- ;; (should (equal (comp-tests-ffuncall-callee-optional-f 1 2 3) '(1 2 3 nil)))
- ;; (should (equal (comp-tests-ffuncall-callee-optional-f 1 2) '(1 2 nil nil)))
+ (should (equal (comp-tests-ffuncall-callee-optional-f 1 2 3 4) '(1 2 3 4)))
+ (should (equal (comp-tests-ffuncall-callee-optional-f 1 2 3) '(1 2 3 nil)))
+ (should (equal (comp-tests-ffuncall-callee-optional-f 1 2) '(1 2 nil nil)))
;; (defun comp-tests-ffuncall-callee-rest-f (a b &rest c)
;; (list a b c))