From fdbdf3da7f0dc09bb04a919b1840652b327b64b4 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Sat, 13 Jul 2019 17:24:44 +0200 Subject: [PATCH] symbol-value +1 test --- lisp/emacs-lisp/comp.el | 9 ++++++--- test/src/comp-tests.el | 16 ++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 712cade3829..2f3c6899337 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -37,6 +37,8 @@ (defconst comp-debug t) +(defvar comp-speed 2) + (defconst comp-passes '(comp-recuparate-lap comp-limplify) "Passes to be executed in order.") @@ -268,15 +270,16 @@ VAL is known at compile time." (comp-pop 1)) ('byte-dup (comp-push-slot-n (comp-sp))) + ('byte-symbol-value + (comp-emit-set-call `(call Fsymbol_value ,(comp-slot)))) ('byte-varref (comp-push-call `(call Fsymbol_value ,(make-comp-mvar :const-vld t :constant (cadr inst))))) ('byte-varset (comp-emit `(call set_internal - ,(make-comp-mvar - :const-vld t - :constant (cadr inst)) + ,(make-comp-mvar :const-vld t + :constant (cadr inst)) ,(comp-slot)))) ('byte-constant (comp-push-const (cadr inst))) diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 00bb2e09321..1030900752d 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -123,14 +123,14 @@ (should (= (comp-tests-aref-aset-f) 100))) -;; (ert-deftest comp-tests-symbol-value () -;; "Testing aref and aset." -;; (defvar comp-tests-var2 3) -;; (defun comp-tests-symbol-value-f () -;; (symbol-value 'comp-tests-var2)) -;; (native-compile #'comp-tests-symbol-value-f) - -;; (should (= (comp-tests-symbol-value-f) 3))) +(ert-deftest comp-tests-symbol-value () + "Testing aref and aset." + (defvar comp-tests-var2 3) + (defun comp-tests-symbol-value-f () + (symbol-value 'comp-tests-var2)) + (native-compile #'comp-tests-symbol-value-f) + + (should (= (comp-tests-symbol-value-f) 3))) ;; (ert-deftest comp-tests-concat () ;; "Testing concatX opcodes." -- 2.39.5