From: Nikodemus Siivola Date: Thu, 29 Dec 2011 18:32:31 +0000 (+0200) Subject: stack-allocatable fill-initialized specialized arrays, part tres X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=ddc81e75502cdc07a7f846644c2ae8e64a31b6d8;p=sbcl.git stack-allocatable fill-initialized specialized arrays, part tres lp#902351 Mark %CHECK-BOUND as DX-SAFE, so that vectors of unknown size can be stack allocated. --- diff --git a/NEWS b/NEWS index 9bf52bd..b9cffdf 100644 --- 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 diff --git a/src/compiler/fndb.lisp b/src/compiler/fndb.lisp index 7f76e3c..9ce8a8c 100644 --- a/src/compiler/fndb.lisp +++ b/src/compiler/fndb.lisp @@ -1449,7 +1449,8 @@ (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 diff --git a/tests/dynamic-extent.impure.lisp b/tests/dynamic-extent.impure.lisp index 9b167c7..bd26fa2 100644 --- a/tests/dynamic-extent.impure.lisp +++ b/tests/dynamic-extent.impure.lisp @@ -252,6 +252,13 @@ (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)) @@ -584,7 +591,8 @@ (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))))