]> git.eshelyaron.com Git - emacs.git/commitdiff
fix list
authorAndrea Corallo <andrea_corallo@yahoo.it>
Wed, 10 Jul 2019 19:19:40 +0000 (21:19 +0200)
committerAndrea Corallo <akrl@sdf.org>
Wed, 1 Jan 2020 10:33:52 +0000 (11:33 +0100)
src/comp.c
test/src/comp-tests.el

index d6e09226cdded02bcbd54808a329507a835d430f..fe868def11de291bbc9e04144bdf42e18b597725 100644 (file)
@@ -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))
     {
index 33f5ebfdc2ef7e1bb0d9f03aa7d2a5f7800e38e1..1d00dea2195c36fe2cc5a922c7b8de91acc2e8f5 100644 (file)
@@ -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)