]> git.eshelyaron.com Git - emacs.git/commitdiff
inline consp
authorAndrea Corallo <andrea_corallo@yahoo.it>
Tue, 11 Jun 2019 17:41:34 +0000 (19:41 +0200)
committerAndrea Corallo <akrl@sdf.org>
Wed, 1 Jan 2020 10:33:41 +0000 (11:33 +0100)
src/comp.c
test/src/comp-tests.el

index 823956e147a5c1e363fe9f59b8e00fc52c1dd06a..93edd4df452cc94660d99b3e997429ff713263c2 100644 (file)
@@ -329,6 +329,12 @@ comp_TAGGEDP (gcc_jit_rvalue *obj, unsigned tag)
   return res;
 }
 
+static gcc_jit_rvalue *
+comp_CONSP (gcc_jit_rvalue *obj)
+{
+  return comp_TAGGEDP(obj, Lisp_Cons);
+}
+
 static gcc_jit_rvalue *
 comp_FIXNUMP (gcc_jit_rvalue *obj)
 {
@@ -1004,7 +1010,15 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
 
        CASE_CALL_NARGS (nth, 2);
        CASE_CALL_NARGS (symbolp, 1);
-       CASE_CALL_NARGS (consp, 1);
+
+       case Bconsp:
+         gcc_jit_block_add_assignment (
+           comp.bblock->gcc_bb,
+           NULL,
+           TOS,
+           comp_CONSP(gcc_jit_lvalue_as_rvalue (TOS)));
+         break;
+
        CASE_CALL_NARGS (stringp, 1);
        CASE_CALL_NARGS (listp, 1);
        CASE_CALL_NARGS (eq, 2);
index 74ed33a43cfd7758d28876024dbc17ae73227261..63dfafafb04d34c77bb8eda8e85166c6af060fab 100644 (file)
     (should (equal (comp-bubble-sort-f list1)
                    (sort list2 #'<)))))
 
+(ert-deftest comp-tests-list-inline ()
+  "Test some inlined list functions."
+  (defun comp-tests-consp-f (x)
+    ;; Bconsp
+    (consp x))
+
+  (should (eq (comp-tests-consp-f '(1)) t))
+  (should (eq (comp-tests-consp-f 1) nil)))
+
 (ert-deftest comp-tests-gc ()
   "Try to do some longer computation to let the gc kick in."
   (dotimes (_ 100000)