From: Andrea Corallo Date: Wed, 10 Jul 2019 19:19:40 +0000 (+0200) Subject: fix list X-Git-Tag: emacs-28.0.90~2727^2~1366 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c81aba08e3285d7864c60ea121959972a8584f35;p=emacs.git fix list --- diff --git a/src/comp.c b/src/comp.c index d6e09226cdd..fe868def11d 100644 --- a/src/comp.c +++ b/src/comp.c @@ -984,20 +984,37 @@ emit_limple_inst (Lisp_Object inst) } else if (EQ (op, Qcall_ass)) { - /* Ex: (=call #s(comp-mvar 6 1 nil nil nil) - (call Fcar #s(comp-mvar 4 0 nil nil nil))). */ + /* + Ex: (=call #s(comp-mvar 6 1 nil nil nil) + (call Fcar #s(comp-mvar 4 0 nil nil nil))) + + Ex: (=call #s(comp-mvar 5 0 nil nil cons) + (call Fcons #s(comp-mvar 3 0 t 1 nil) + #s(comp-mvar 4 nil t nil nil))) + */ EMACS_UINT slot_n = XFIXNUM (FUNCALL1 (comp-mvar-slot, arg0)); Lisp_Object arg1 = THIRD (inst); eassert (FIRST (arg1) == Qcall); - char *calle = (char *) SDATA (SYMBOL_NAME (SECOND (arg1))); - gcc_jit_rvalue *args[] = - { retrive_mvar_val (THIRD (arg1)) }; - gcc_jit_rvalue *res = emit_call (calle, comp.lisp_obj_type, 1, args); - - gcc_jit_block_add_assignment (comp.block, - NULL, - comp.frame[slot_n], - res); + if (FIRST (arg1) == Qcall) + { + char *calle = (char *) SDATA (SYMBOL_NAME (SECOND (arg1))); + + Lisp_Object call_args = XCDR (XCDR (arg1)); + ptrdiff_t nargs = list_length (call_args); + gcc_jit_rvalue *gcc_args[nargs]; + int i = 0; + FOR_EACH_TAIL (call_args) + gcc_args[i++] = retrive_mvar_val (XCAR (call_args)); + gcc_jit_rvalue *res = + emit_call (calle, comp.lisp_obj_type, nargs, gcc_args); + + gcc_jit_block_add_assignment (comp.block, + NULL, + comp.frame[slot_n], + res); + } + else + eassert (false); } else if (EQ (op, Qpar_ass)) { diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 33f5ebfdc2e..1d00dea2195 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -43,8 +43,8 @@ (ert-deftest comp-tests-list () "Testing cons car cdr." - ;; (defun comp-tests-list-f () - ;; (list 1 2 3)) + (defun comp-tests-list-f () + (list 1 2 3)) (defun comp-tests-car-f (x) ;; Bcar (car x)) @@ -58,7 +58,7 @@ ;; Bcdr_safe (cdr-safe x)) - ;; (native-compile #'comp-tests-list-f) + (native-compile #'comp-tests-list-f) (native-compile #'comp-tests-car-f) (native-compile #'comp-tests-cdr-f) (native-compile #'comp-tests-car-safe-f)