Fix make-array transforms.
[sbcl.git] / src / code / cross-make-load-form.lisp
1 ;;;; cross-compile-time-only replacements for make-load-form
2 ;;;; machinery.
3
4 ;;;; This software is part of the SBCL system. See the README file for
5 ;;;; more information.
6 ;;;;
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.
12
13 ;;; this probably deserves a word of explanation, as somewhat
14 ;;; unusually we require the behaviour of this function to change
15 ;;; depending on not at what stage we build it but at what stage we
16 ;;; run it. This function will be called both when the host compiler
17 ;;; dumps structures of type structure!object and when the
18 ;;; cross-compiler does likewise; we don't control the dumper for the
19 ;;; host compiler, so we use its own machinery for dumping host fasls,
20 ;;; but we need to use target machinery for target fasls. We therefore
21 ;;; dispatch on the presence of :SB-XC-HOST in the *FEATURES* list for
22 ;;; which mechanism to use. This probably counts as a KLUDGE; a proper
23 ;;; solution might be one or more of:
24 ;;;
25 ;;; * change def!struct to have two make-load-form-funs associated
26 ;;;   with it; one to run when CL:MAKE-LOAD-FORM is called, and one
27 ;;;   for SB!XC:MAKE-LOAD-FORM
28 ;;;
29 ;;; * implement MAKE-LOAD-FORM-SAVING-SLOTS properly rather than have
30 ;;;   this magic value, and use it consistently.
31 ;;;
32 ;;; Also, something along these lines can remove the special case in
33 ;;; EMIT-MAKE-LOAD-FORM in src/compiler/main.lisp.
34
35 (in-package "SB!INT")
36
37 (defun sb!xc:make-load-form-saving-slots (object &rest args
38                                           &key slot-names environment)
39   (declare (ignore environment))
40   (if (member :sb-xc-host *features*)
41       ;; we're still building the cross-compiler, so use the host's
42       ;; mechanism:
43       (apply #'make-load-form-saving-slots object args)
44       ;; we're building cold fasls, so use the target's mechanism:
45       ;;
46       ;; KLUDGE: This is essentially the same definition as for the
47       ;; target's MAKE-LOAD-FORM-SAVING-SLOTS; it would be nice to
48       ;; share code with that if possible. -- CSR, 2002-05-30
49       (if slot-names
50           (bug "MAKE-LOAD-FORM-SAVING-SLOTS ~
51                 called with :SLOT-NAMES argument during cross-compilation")
52           :sb-just-dump-it-normally)))
53