1.0.4.66: Undo D-X changes in 1.0.4.63
authorNathan Froyd <froydnj@cs.rice.edu>
Wed, 11 Apr 2007 20:51:56 +0000 (20:51 +0000)
committerNathan Froyd <froydnj@cs.rice.edu>
Wed, 11 Apr 2007 20:51:56 +0000 (20:51 +0000)
NEWS
OPTIMIZATIONS
src/compiler/x86-64/alloc.lisp
src/compiler/x86/alloc.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 5f7e573..0923c86 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -18,8 +18,6 @@ changes in sbcl-1.0.5 relative to sbcl-1.0.4:
     variants no longer cons.
   * optimization: Direct calls to CHAR-{EQUAL,LESSP,GREATERP} and
     their NOT- variants no longer cons.
-  * optimization: Stack allocation of arrays containing unboxed
-    elements is slightly more efficient on x86 and x86-64.
   * enhancement: XREF information is now collected to references made
     to global variables using SYMBOL-VALUE and a constant argument.
   * enhancement: SIGINT now causes a specific condition
index 623e433..631501c 100644 (file)
@@ -220,13 +220,16 @@ SBCL cannot derive upper bound for I and uses generic arithmetic here:
 should know the connection between an NLE and its CLEANUP.)
 --------------------------------------------------------------------------------
 #27
-(We always zeroize stack-allocated arrays of boxed elements.  The
-previous note here suggested that we could avoid that step on
-platforms with conservative GC; it's not clear to me (NJF) that
-doing so is a wise idea.)
-
-x86 and x86-64 do not zeroize stack-allocated arrays of unboxed
-elements; other platforms could copy what they do.
+Initialization of stack-allocated arrays is inefficient: we always
+fill the vector with zeroes, even when it is not needed (as for
+platforms with conservative GC or for arrays of unboxed objectes) and
+is performed later explicitely.
+
+(This is harder than it might look at first glance, as MAKE-ARRAY is smart
+enough to eliminate something like ':initial-element 0'.  Such an optimization
+is valid if the vector is being allocated in the heap, but not if it is being
+allocated on the stack.  You could remove this optimization, but that makes
+the heap-allocated case somewhat slower...)
 --------------------------------------------------------------------------------
 #28
 a. Accessing raw slots in structure instances is more inefficient than
index 707a459..76bad49 100644 (file)
@@ -96,7 +96,7 @@
       (storew length result vector-length-slot other-pointer-lowtag))))
 
 (define-vop (allocate-vector-on-stack)
-  (:args (type :scs (unsigned-reg immediate))
+  (:args (type :scs (unsigned-reg))
          (length :scs (any-reg))
          (words :scs (any-reg) :target ecx))
   (:temporary (:sc any-reg :offset ecx-offset :from (:argument 2)) ecx)
   (:policy :fast-safe)
   (:node-var node)
   (:generator 100
-    (when (sc-is type immediate)
-      (aver (typep (tn-value type) '(unsigned-byte 8))))
-    (let ((unboxed-elements-p (and (sc-is type immediate)
-                                   (/= (tn-value type)
-                                       simple-vector-widetag))))
-      (inst lea result (make-ea :byte :base words :disp
-                                (+ (1- (ash 1 n-lowtag-bits))
-                                   (* vector-data-offset n-word-bytes))))
-      (inst and result (lognot lowtag-mask))
-      ;; FIXME: It would be good to check for stack overflow here.
-      (move ecx words)
-      (inst shr ecx n-fixnum-tag-bits)
-      (allocation result result node t)
-      (unless unboxed-elements-p
-        (inst cld))
-      (inst lea res
-            (make-ea :byte :base result :disp (* vector-data-offset n-word-bytes)))
-      (inst lea result (make-ea :byte :base result :disp other-pointer-lowtag))
-      (storew type result 0 other-pointer-lowtag)
-      (storew length result vector-length-slot other-pointer-lowtag)
-      (unless unboxed-elements-p
-        (zeroize zero)
-        (inst rep)
-        (inst stos zero)))))
+    (inst lea result (make-ea :byte :base words :disp
+                              (+ (1- (ash 1 n-lowtag-bits))
+                                 (* vector-data-offset n-word-bytes))))
+    (inst and result (lognot lowtag-mask))
+    ;; FIXME: It would be good to check for stack overflow here.
+    (move ecx words)
+    (inst shr ecx n-fixnum-tag-bits)
+    (allocation result result node t)
+    (inst cld)
+    (inst lea res
+          (make-ea :byte :base result :disp (* vector-data-offset n-word-bytes)))
+    (inst lea result (make-ea :byte :base result :disp other-pointer-lowtag))
+    (storew type result 0 other-pointer-lowtag)
+    (storew length result vector-length-slot other-pointer-lowtag)
+    (zeroize zero)
+    (inst rep)
+    (inst stos zero)))
 
 (in-package "SB!C")
 
index e7fc391..8bc9c86 100644 (file)
   (:policy :fast-safe)
   (:node-var node)
   (:generator 100
-    (let ((unboxed-elements-p (and (sc-is type immediate)
-                                   (/= (tn-value type)
-                                       simple-vector-widetag))))
-      (inst lea result (make-ea :byte :base words :disp
-                                (+ (1- (ash 1 n-lowtag-bits))
-                                   (* vector-data-offset n-word-bytes))))
-      (inst and result (lognot lowtag-mask))
-      ;; FIXME: It would be good to check for stack overflow here.
-      (move ecx words)
-      (inst shr ecx n-fixnum-tag-bits)
-      (allocation result result node t)
-      (unless unboxed-elements-p
-        (inst cld))
-      (inst lea res
-            (make-ea :byte :base result :disp (* vector-data-offset n-word-bytes)))
-      (inst lea result (make-ea :byte :base result :disp other-pointer-lowtag))
-      (sc-case type
-        (immediate
-         (aver (typep (tn-value type) '(unsigned-byte 8)))
-         (storeb (tn-value type) result 0 other-pointer-lowtag))
-        (t
-         (storew type result 0 other-pointer-lowtag)))
-      (storew length result vector-length-slot other-pointer-lowtag)
-      (unless unboxed-elements-p
-        (inst xor zero zero)
-        (inst rep)
-        (inst stos zero)))))
+    (inst lea result (make-ea :byte :base words :disp
+                              (+ (1- (ash 1 n-lowtag-bits))
+                                 (* vector-data-offset n-word-bytes))))
+    (inst and result (lognot lowtag-mask))
+    ;; FIXME: It would be good to check for stack overflow here.
+    (move ecx words)
+    (inst shr ecx n-fixnum-tag-bits)
+    (allocation result result node t)
+    (inst cld)
+    (inst lea res
+          (make-ea :byte :base result :disp (* vector-data-offset n-word-bytes)))
+    (inst lea result (make-ea :byte :base result :disp other-pointer-lowtag))
+    (sc-case type
+      (immediate
+       (aver (typep (tn-value type) '(unsigned-byte 8)))
+       (storeb (tn-value type) result 0 other-pointer-lowtag))
+      (t
+       (storew type result 0 other-pointer-lowtag)))
+    (storew length result vector-length-slot other-pointer-lowtag)
+    (inst xor zero zero)
+    (inst rep)
+    (inst stos zero)))
 
 (in-package "SB!C")
 
index d9ef92b..558c78e 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.4.65"
+"1.0.4.66"