X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Farray-tran.lisp;h=ffc9dda7fd7d384bc10287b22786b5b3cf8fef7a;hb=35f870eecfcaaba496d54e0f290b09e63884f74c;hp=05df30b0958ad74113614e436904d129c1a369b0;hpb=51e63f301624e39febdd85b5feba19b7c980f307;p=sbcl.git diff --git a/src/compiler/array-tran.lisp b/src/compiler/array-tran.lisp index 05df30b..ffc9dda 100644 --- a/src/compiler/array-tran.lisp +++ b/src/compiler/array-tran.lisp @@ -209,8 +209,7 @@ ,@(mapcar (lambda (el) (once-only ((n-val el)) `(locally (declare (optimize (safety 0))) - (setf (svref ,n-vec ,(incf n)) - ,n-val)))) + (setf (svref ,n-vec ,(incf n)) ,n-val)))) elements) ,n-vec)))) @@ -748,11 +747,24 @@ (deftransform aref ((array &rest indices)) (with-row-major-index (array indices index) (hairy-data-vector-ref array index))) + (deftransform %aset ((array &rest stuff)) (let ((indices (butlast stuff))) (with-row-major-index (array indices index new-value) (hairy-data-vector-set array index new-value))))) +(deftransform aref ((array index) ((or simple-vector + simple-unboxed-array) + index)) + (let ((type (lvar-type array))) + (unless (array-type-p type) + ;; Not an exactly specified one-dimensional simple array -> punt + ;; to the complex version. + (give-up-ir1-transform))) + `(data-vector-ref array (%check-bound array + (array-dimension array 0) + index))) + ;;; Just convert into a HAIRY-DATA-VECTOR-REF (or ;;; HAIRY-DATA-VECTOR-SET) after checking that the index is inside the ;;; array total size.