From b3d858da8d577449e2ab40572422fdd1bdf8b538 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Tue, 11 Jun 2019 19:41:34 +0200 Subject: [PATCH] inline consp --- src/comp.c | 16 +++++++++++++++- test/src/comp-tests.el | 9 +++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/comp.c b/src/comp.c index 823956e147a..93edd4df452 100644 --- a/src/comp.c +++ b/src/comp.c @@ -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); diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 74ed33a43cf..63dfafafb04 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -272,6 +272,15 @@ (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) -- 2.39.5