1 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; This software is derived from the CMU CL system, which was
5 ;;;; written at Carnegie Mellon University and released into the
6 ;;;; public domain. The software is in the public domain and is
7 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
8 ;;;; files for more information.
10 (in-package "SB-COLD")
12 ;;; Either load or compile-then-load the cross-compiler into the
13 ;;; cross-compilation host Common Lisp.
14 (defun load-or-cload-xcompiler (load-or-cload-stem)
16 (declare (type function load-or-cload-stem
))
18 ;; The running-in-the-host-Lisp Python cross-compiler defines its
19 ;; own versions of a number of functions which should not overwrite
20 ;; host-Lisp functions. Instead we put them in a special package.
22 ;; The common theme of the functions, macros, constants, and so
23 ;; forth in this package is that they run in the host and affect the
24 ;; compilation of the target.
25 (let ((package-name "SB-XC"))
26 (make-package package-name
:use nil
:nicknames nil
)
27 (dolist (name '(;; the constants (except for T and NIL which have
28 ;; a specially hacked correspondence between
29 ;; cross-compilation host Lisp and target Lisp)
30 "ARRAY-DIMENSION-LIMIT"
32 "ARRAY-TOTAL-SIZE-LIMIT"
49 "CALL-ARGUMENTS-LIMIT"
51 "DOUBLE-FLOAT-EPSILON"
52 "DOUBLE-FLOAT-NEGATIVE-EPSILON"
53 "INTERNAL-TIME-UNITS-PER-SECOND"
54 "LAMBDA-LIST-KEYWORDS"
55 "LAMBDA-PARAMETERS-LIMIT"
56 "LEAST-NEGATIVE-DOUBLE-FLOAT"
57 "LEAST-NEGATIVE-LONG-FLOAT"
58 "LEAST-NEGATIVE-NORMALIZED-DOUBLE-FLOAT"
59 "LEAST-NEGATIVE-NORMALIZED-LONG-FLOAT"
60 "LEAST-NEGATIVE-NORMALIZED-SHORT-FLOAT"
61 "LEAST-NEGATIVE-NORMALIZED-SINGLE-FLOAT"
62 "LEAST-NEGATIVE-SHORT-FLOAT"
63 "LEAST-NEGATIVE-SINGLE-FLOAT"
64 "LEAST-POSITIVE-DOUBLE-FLOAT"
65 "LEAST-POSITIVE-LONG-FLOAT"
66 "LEAST-POSITIVE-NORMALIZED-DOUBLE-FLOAT"
67 "LEAST-POSITIVE-NORMALIZED-LONG-FLOAT"
68 "LEAST-POSITIVE-NORMALIZED-SHORT-FLOAT"
69 "LEAST-POSITIVE-NORMALIZED-SINGLE-FLOAT"
70 "LEAST-POSITIVE-SHORT-FLOAT"
71 "LEAST-POSITIVE-SINGLE-FLOAT"
73 "LONG-FLOAT-NEGATIVE-EPSILON"
74 "MOST-NEGATIVE-DOUBLE-FLOAT"
75 "MOST-NEGATIVE-FIXNUM"
76 "MOST-NEGATIVE-LONG-FLOAT"
77 "MOST-NEGATIVE-SHORT-FLOAT"
78 "MOST-NEGATIVE-SINGLE-FLOAT"
79 "MOST-POSITIVE-DOUBLE-FLOAT"
80 "MOST-POSITIVE-FIXNUM"
81 "MOST-POSITIVE-LONG-FLOAT"
82 "MOST-POSITIVE-SHORT-FLOAT"
83 "MOST-POSITIVE-SINGLE-FLOAT"
84 "MULTIPLE-VALUES-LIMIT"
87 "SHORT-FLOAT-NEGATIVE-EPSILON"
88 "SINGLE-FLOAT-EPSILON"
89 "SINGLE-FLOAT-NEGATIVE-EPSILON"
91 ;; everything else which needs a separate
92 ;; existence in xc and target
94 "BOOLE-CLR" "BOOLE-SET" "BOOLE-1" "BOOLE-2"
95 "BOOLE-C1" "BOOLE-C2" "BOOLE-AND" "BOOLE-IOR"
96 "BOOLE-XOR" "BOOLE-EQV" "BOOLE-NAND" "BOOLE-NOR"
97 "BOOLE-ANDC1" "BOOLE-ANDC2" "BOOLE-ORC1" "BOOLE-ORC2"
99 "BYTE" "BYTE-POSITION" "BYTE-SIZE"
101 "CLASS" "CLASS-NAME" "CLASS-OF"
104 "COMPILE-FILE-PATHNAME"
105 "*COMPILE-FILE-PATHNAME*"
106 "*COMPILE-FILE-TRUENAME*"
109 "COMPILER-MACRO-FUNCTION"
112 "DEFINE-MODIFY-MACRO"
113 "DEFINE-SETF-EXPANDER"
114 "DEFMACRO" "DEFSETF" "DEFSTRUCT" "DEFTYPE"
115 "DEPOSIT-FIELD" "DPB"
116 "FBOUNDP" "FDEFINITION" "FMAKUNBOUND"
118 "GENSYM" "*GENSYM-COUNTER*"
121 "LISP-IMPLEMENTATION-TYPE" "LISP-IMPLEMENTATION-VERSION"
123 "MACROEXPAND" "MACROEXPAND-1" "*MACROEXPAND-HOOK*"
125 "MAKE-LOAD-FORM-SAVING-SLOTS"
134 "UPGRADED-ARRAY-ELEMENT-TYPE"
135 "UPGRADED-COMPLEX-PART-TYPE"
136 "WITH-COMPILATION-UNIT"))
137 (export (intern name package-name
) package-name
)))
139 (dolist (package (list-all-packages))
140 (when (= (mismatch (package-name package
) "SB!") 3)
142 (mapcar (lambda (name) (find-symbol name
"SB-XC"))
143 '("BYTE" "BYTE-POSITION" "BYTE-SIZE"
144 "DPB" "LDB" "LDB-TEST"
145 "DEPOSIT-FIELD" "MASK-FIELD"
148 "BOOLE-CLR" "BOOLE-SET" "BOOLE-1" "BOOLE-2"
149 "BOOLE-C1" "BOOLE-C2" "BOOLE-AND" "BOOLE-IOR"
150 "BOOLE-XOR" "BOOLE-EQV" "BOOLE-NAND" "BOOLE-NOR"
151 "BOOLE-ANDC1" "BOOLE-ANDC2" "BOOLE-ORC1" "BOOLE-ORC2"))
154 ;; Build a version of Python to run in the host Common Lisp, to be
155 ;; used only in cross-compilation.
157 ;; Note that files which are marked :ASSEM, to cause them to be
158 ;; processed with SB!C:ASSEMBLE-FILE when we're running under the
159 ;; cross-compiler or the target lisp, are still processed here, just
160 ;; with the ordinary Lisp compiler, and this is intentional, in
161 ;; order to make the compiler aware of the definitions of assembly
163 (do-stems-and-flags (stem flags
)
164 (unless (find :not-host flags
)
165 (funcall load-or-cload-stem stem flags
)
166 #!+sb-show
(warn-when-cl-snapshot-diff *cl-snapshot
*)))
168 ;; If the cross-compilation host is SBCL itself, we can use the
169 ;; PURIFY extension to freeze everything in place, reducing the
170 ;; amount of work done on future GCs. In machines with limited
171 ;; memory, this could help, by reducing the amount of memory which
172 ;; needs to be juggled in a full GC. And it can hardly hurt, since
173 ;; (in the ordinary build procedure anyway) essentially everything
174 ;; which is reachable at this point will remain reachable for the
177 ;; (Except that purifying actually slows down GENCGC). -- JES, 2006-05-30
178 #+(and sbcl
(not gencgc
))