stack-allocatable fill-initialized specialized arrays, part tres
authorNikodemus Siivola <nikodemus@random-state.net>
Thu, 29 Dec 2011 18:32:31 +0000 (20:32 +0200)
committerNikodemus Siivola <nikodemus@random-state.net>
Thu, 29 Dec 2011 18:40:46 +0000 (20:40 +0200)
 lp#902351

 Mark %CHECK-BOUND as DX-SAFE, so that vectors of unknown size can be stack
 allocated.

NEWS
src/compiler/fndb.lisp
tests/dynamic-extent.impure.lisp

diff --git a/NEWS b/NEWS
index 9bf52bd..b9cffdf 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -37,7 +37,7 @@ changes relative to sbcl-1.0.54:
   * enhancement: better disassembly of segment-prefixes on x86 and other
     instruction prefixes (e.g. LOCK) on x86 and x86-64.
   * optimization: FIND and POSITION on bit-vectors are orders of magnitude
-    faster (assuming KEY and TEST are not used, or are sufficiently trivial).
+    faster (assuming KEY and TEST are not used, or are sufficiently trivial.)
   * optimization: SUBSEQ on vectors of unknown element type is substantially
     faster. (lp#902537)
   * optimization: specialized arrays with non-zero :INITIAL-ELEMENT can
index 7f76e3c..9ce8a8c 100644 (file)
 (defknown (%dpb %deposit-field) (integer bit-index bit-index integer) integer
   (movable foldable flushable explicit-check))
 (defknown %negate (number) number (movable foldable flushable explicit-check))
-(defknown %check-bound (array index fixnum) index (movable foldable flushable))
+(defknown %check-bound (array index fixnum) index
+  (movable foldable flushable dx-safe))
 (defknown data-vector-ref (simple-array index) t
   (foldable explicit-check always-translatable))
 (defknown data-vector-ref-with-offset (simple-array index fixnum) t
index 9b167c7..bd26fa2 100644 (file)
     (true v)
     nil))
 
+(defun-with-dx make-array-on-stack-11 ()
+  (let ((v (make-array (the integer (opaque-identity 3)) :initial-element 12.0d0 :element-type 'double-float)))
+    (declare (sb-int:truly-dynamic-extent v))
+    (true v)
+    (true v)
+    nil))
+
 (defun-with-dx vector-on-stack (x y)
   (let ((v (vector 1 x 2 y 3)))
     (declare (sb-int:truly-dynamic-extent v))
   (assert-no-consing (make-array-on-stack-7))
   (assert-no-consing (make-array-on-stack-8))
   (assert-no-consing (make-array-on-stack-9))
-  (assert-no-consing (make-array-on-stack-10)))
+  (assert-no-consing (make-array-on-stack-10))
+  (assert-no-consing (make-array-on-stack-11)))
 
 (with-test (:name (:no-consing :dx-raw-instances) :skipped-on '(or (not :raw-instance-init-vops)
                                                                    (not (and :gencgc :c-stack-is-control-stack))))