From 1dff970a3514e323517d3ddd876821cc5e381d69 Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Sat, 30 Nov 2013 20:12:22 +0400 Subject: [PATCH] Micro-optimize vector creation. transform-make-array-vector expanded into (allocate-vector typecode (the index length) (ceiling length x)) but the transform applied to CEILING before it was known that LENGTH is of type INDEX was producing bad results, (ceiling (truly-the index length) x) solves that. --- src/compiler/array-tran.lisp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/compiler/array-tran.lisp b/src/compiler/array-tran.lisp index 3403ac3..14b2fa5 100644 --- a/src/compiler/array-tran.lisp +++ b/src/compiler/array-tran.lisp @@ -414,12 +414,13 @@ (t (let ((n-elements-per-word (/ sb!vm:n-word-bits n-bits))) (declare (type index n-elements-per-word)) ; i.e., not RATIO - `(ceiling ,padded-length-form ,n-elements-per-word))))))) + `(ceiling (truly-the index ,padded-length-form) + ,n-elements-per-word))))))) (result-spec `(simple-array ,(sb!vm:saetp-specifier saetp) (,(or c-length '*)))) (alloc-form - `(truly-the ,result-spec - (allocate-vector ,typecode (the index length) ,n-words-form)))) + `(truly-the ,result-spec + (allocate-vector ,typecode (the index length) ,n-words-form)))) (cond ((and initial-element initial-contents) (abort-ir1-transform "Both ~S and ~S specified." :initial-contents :initial-element)) -- 1.7.10.4