From 94603790f67ddfd00bdb890c16e28a15df45a02b Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Tue, 20 Aug 2013 03:20:04 +0400 Subject: [PATCH] Clean up and micro-optimize list checking in some x86-64 VOPs. In length/list and values-list, instead of manually checking for LIST, call %test-lowtag, which produces more compact code. --- build-order.lisp-expr | 5 +++-- src/compiler/x86-64/subprim.lisp | 6 ++---- src/compiler/x86-64/values.lisp | 6 ++---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/build-order.lisp-expr b/build-order.lisp-expr index 9a64d39..f86669b 100644 --- a/build-order.lisp-expr +++ b/build-order.lisp-expr @@ -578,8 +578,10 @@ ;; x what the problem is and fix it. #!+(or ppc) :ignore-failure-p) ("src/code/cross-modular" :not-target) - ("src/compiler/target/subprim") + ("src/compiler/target/type-vops") + + ("src/compiler/target/subprim") ("src/compiler/target/debug") ;; src/compiler/sparc/c-call contains a deftransform for ;; %ALIEN-FUNCALL -- CSR @@ -596,7 +598,6 @@ ("src/compiler/generic/array") ("src/compiler/target/pred") - ("src/compiler/target/type-vops") ("src/compiler/generic/late-type-vops") ;; KLUDGE: The assembly files need to be compiled twice: once as diff --git a/src/compiler/x86-64/subprim.lisp b/src/compiler/x86-64/subprim.lisp index 2079764..a779d13 100644 --- a/src/compiler/x86-64/subprim.lisp +++ b/src/compiler/x86-64/subprim.lisp @@ -25,6 +25,7 @@ (:policy :fast-safe) (:vop-var vop) (:save-p :compute-only) + (:ignore eax) (:generator 40 ;; Move OBJECT into a temp we can bash on, and initialize the count. (move ptr object) @@ -43,10 +44,7 @@ (inst jmp :e DONE) ;; Otherwise, check to see whether we hit the end of a dotted list. If ;; not, loop back for more. - (move eax (make-dword-tn ptr)) - (inst and al-tn lowtag-mask) - (inst cmp al-tn list-pointer-lowtag) - (inst jmp :e LOOP) + (%test-lowtag ptr LOOP nil list-pointer-lowtag) ;; It's dotted all right. Flame out. (error-call vop 'object-not-list-error ptr) ;; We be done. diff --git a/src/compiler/x86-64/values.lisp b/src/compiler/x86-64/values.lisp index bea46f9..624483b 100644 --- a/src/compiler/x86-64/values.lisp +++ b/src/compiler/x86-64/values.lisp @@ -76,6 +76,7 @@ (count :scs (any-reg))) (:temporary (:sc descriptor-reg :from (:argument 0) :to (:result 1)) list) (:temporary (:sc dword-reg :offset eax-offset :to (:result 1)) eax) + (:ignore eax) (:vop-var vop) (:save-p :compute-only) (:generator 0 @@ -87,10 +88,7 @@ (inst jmp :e DONE) (pushw list cons-car-slot list-pointer-lowtag) (loadw list list cons-cdr-slot list-pointer-lowtag) - (inst mov eax (make-dword-tn list)) - (inst and al-tn lowtag-mask) - (inst cmp al-tn list-pointer-lowtag) - (inst jmp :e LOOP) + (%test-lowtag list LOOP nil list-pointer-lowtag) (error-call vop 'bogus-arg-to-values-list-error list) DONE -- 1.7.10.4