From 69530f59302bf7dc1d3b18c7c15e9508b99ca01f Mon Sep 17 00:00:00 2001 From: Douglas Katzman Date: Mon, 18 Apr 2016 21:35:24 -0400 Subject: [PATCH] x86-64: Skip fixnum test in :fast check-bound Codegen got worse when check-bound performed %test-fixnum if the policy demanded bound checks but no type checks. --- src/compiler/x86-64/array.lisp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/compiler/x86-64/array.lisp b/src/compiler/x86-64/array.lisp index 8928a5c63..97e81418b 100644 --- a/src/compiler/x86-64/array.lisp +++ b/src/compiler/x86-64/array.lisp @@ -153,6 +153,8 @@ (bound :scs (any-reg descriptor-reg)) (index :scs (any-reg descriptor-reg))) ;(:arg-types * positive-fixnum *) + (:variant-vars %test-fixnum) + (:variant t) (:vop-var vop) (:save-p :compute-only) (:generator 5 @@ -161,13 +163,17 @@ (index (if (sc-is index immediate) (fixnumize (tn-value index)) index))) - (unless (integerp index) + (when (and %test-fixnum (not (integerp index))) (%test-fixnum index error t)) (inst cmp bound index) ;; We use below-or-equal even though it's an unsigned test, ;; because negative indexes appear as large unsigned numbers. ;; Therefore, we get the <0 and >=bound test all rolled into one. (inst jmp :be error)))) +(define-vop (check-bound/fast check-bound) + (:policy :fast) + (:variant nil) + (:variant-cost 4)) ;;;; accessors/setters -- 2.11.4.GIT