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")
15 ;;; It's hard to dump specialized vectors portably, because ANSI
16 ;;; doesn't guarantee much about what specialized vectors exist.
18 ;;; (MAKE-ARRAY 10 :ELEMENT-TYPE '(UNSIGNED-BYTE 4))
19 ;;; in the cross-compilation host, we could easily end up with a
20 ;;; vector of (UNSIGNED-BYTE 8) or of T, and the dumped result would
23 ;;; To reduce the prominence of this issue in cross-compilation, we
24 ;;; can use these types, which expands into a specialized vector type when
25 ;;; building the cross-compiler, and a SIMPLE-VECTOR otherwise.
26 (deftype specializable (type)
27 #+sb-xc-host (declare (ignore type))
30 (deftype specializable-vector (element-type)
31 `(array (specializable ,element-type) 1))
33 ;;; MAKE-SPECIALIZABLE-ARRAY is MAKE-ARRAY, except that in the interests of
34 ;;; being able to dump the result without worrying about nonportable
35 ;;; dependences on what kinds of specialized vectors actually exist in the
36 ;;; cross-compilation host, any :ELEMENT-TYPE argument is discarded when
37 ;;; running under the cross-compilation host ANSI Common Lisp.
39 (defun make-specializable-array (dimensions
45 (if (eq element-type t)
47 (do ((reversed-modified-rest nil))
48 ((null rest) (nreverse reversed-modified-rest))
49 (let ((first (pop rest))
51 (when (eq first :element-type)
53 (push first reversed-modified-rest)
54 (push second reversed-modified-rest))))))
56 (declaim #!-sb-fluid (inline make-specializable-array))
58 (defun make-specializable-array (&rest rest) (apply #'make-array rest))