1 ;;;; a hack to suppress array specialization when building under the
4 ;;;; This software is part of the SBCL system. See the README file for
7 ;;;; This software is derived from the CMU CL system, which was
8 ;;;; written at Carnegie Mellon University and released into the
9 ;;;; public domain. The software is in the public domain and is
10 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
11 ;;;; files for more information.
13 (in-package "SB!KERNEL")
18 ;;; It's hard to dump specialized vectors portably, because ANSI
19 ;;; doesn't guarantee much about what specialized vectors exist.
21 ;;; (MAKE-ARRAY 10 :ELEMENT-TYPE '(UNSIGNED-BYTE 4))
22 ;;; in the cross-compilation host, we could easily end up with a
23 ;;; vector of (UNSIGNED-BYTE 8) or of T, and the dumped result would
26 ;;; To reduce the prominence of this issue in cross-compilation, we
27 ;;; can use these types, which expands into a specialized vector type when
28 ;;; building the cross-compiler, and a SIMPLE-VECTOR otherwise.
29 (deftype specializable (type)
30 #+sb-xc-host (declare (ignore type))
33 (deftype specializable-vector (element-type)
34 `(array (specializable ,element-type) 1))
36 ;;; MAKE-SPECIALIZABLE-ARRAY is MAKE-ARRAY, except that in the interests of
37 ;;; being able to dump the result without worrying about nonportable
38 ;;; dependences on what kinds of specialized vectors actually exist in the
39 ;;; cross-compilation host, any :ELEMENT-TYPE argument is discarded when
40 ;;; running under the cross-compilation host ANSI Common Lisp.
42 (defun make-specializable-array (dimensions
48 (if (eq element-type t)
50 (do ((reversed-modified-rest nil))
51 ((null rest) (nreverse reversed-modified-rest))
52 (let ((first (pop rest))
54 (when (eq first :element-type)
56 (push first reversed-modified-rest)
57 (push second reversed-modified-rest))))))
59 (declaim #!-sb-fluid (inline make-specializable-array))
61 (defun make-specializable-array (&rest rest) (apply #'make-array rest))