Clean up and micro-optimize list checking in some x86-64 VOPs.
authorStas Boukarev <stassats@gmail.com>
Mon, 19 Aug 2013 23:20:04 +0000 (03:20 +0400)
committerStas Boukarev <stassats@gmail.com>
Mon, 19 Aug 2013 23:20:04 +0000 (03:20 +0400)
In length/list and values-list, instead of manually checking for LIST,
call %test-lowtag, which produces more compact code.

build-order.lisp-expr
src/compiler/x86-64/subprim.lisp
src/compiler/x86-64/values.lisp

index 9a64d39..f86669b 100644 (file)
   ;; 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
  ("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
index 2079764..a779d13 100644 (file)
@@ -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)
     (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.
index bea46f9..624483b 100644 (file)
@@ -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
     (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