Update of /cvsroot/sbcl/sbcl/src/compiler
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25174/src/compiler
Permit specialized arrays to be placed in a function's constant
vector, enabling faster access (important in, e.g.,
table-driven crypto algorithms).
RCS file: /cvsroot/sbcl/sbcl/src/compiler/ltn.lisp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- ltn.lisp 19 Jun 2005 06:30:51 -0000 1.36
+++ ltn.lisp 28 Jun 2005 14:56:12 -0000 1.37
@@ -67,13 +67,24 @@
;;; Return true if a constant LEAF is of a type which we can legally
;;; directly reference in code. Named constants with arbitrary pointer
;;; values cannot, since we must preserve EQLness.
+;;; FIXME: why not? The values in a function's constant vector are
+;;; subject to being moved by the garbage collector. Having arbitrary
+;;; values in said vector doesn't seem like a problem.
(defun legal-immediate-constant-p (leaf)
(declare (type constant leaf))
(or (not (leaf-has-source-name-p leaf))
- (typecase (constant-value leaf)
- ((or number character) t)
- (symbol (symbol-package (constant-value leaf)))
- (t nil))))
+ ;; Specialized arrays are legal, too. KLUDGE: this would be
+ ;; *much* cleaner if SIMPLE-UNBOXED-ARRAY was defined on the host.
+ #.(loop for saetp across sb!vm:*specialized-array-element-type-properties*
+ unless (eq t (sb!vm:saetp-specifier saetp))
+ collect `((simple-array ,(sb!vm:saetp-specifier saetp) (*)) t) into cases
+ finally (return
+ `(typecase (constant-value leaf)
+ ((or number character) t)
+ (symbol (symbol-package (constant-value leaf)))
+ (t nil))))))
;;; If LVAR is used only by a REF to a leaf that can be delayed, then
;;; return the leaf, otherwise return NIL.