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 (export '*symbol-values-for-genesis
*)
13 (let ((pathname "output/init-symbol-values.lisp-expr"))
14 (defvar *symbol-values-for-genesis
*
15 (and (probe-file pathname
) (read-from-file pathname
)))
16 (defun save-initial-symbol-values ()
17 (with-open-file (f pathname
:direction
:output
:if-exists
:supersede
)
18 (declare (special *symbol-values-for-genesis
*)) ; non-toplevel DEFVAR
19 (write *symbol-values-for-genesis
* :stream f
:readably t
))))
21 ;;; Either load or compile-then-load the cross-compiler into the
22 ;;; cross-compilation host Common Lisp.
23 (defun load-or-cload-xcompiler (load-or-cload-stem)
25 (declare (type function load-or-cload-stem
))
27 ;; The running-in-the-host-Lisp Python cross-compiler defines its
28 ;; own versions of a number of functions which should not overwrite
29 ;; host-Lisp functions. Instead we put them in a special package.
31 ;; The common theme of the functions, macros, constants, and so
32 ;; forth in this package is that they run in the host and affect the
33 ;; compilation of the target.
34 (let ((package-name "SB-XC"))
35 (make-package package-name
:use nil
:nicknames nil
)
36 (dolist (name '(;; the constants (except for T and NIL which have
37 ;; a specially hacked correspondence between
38 ;; cross-compilation host Lisp and target Lisp)
39 "ARRAY-DIMENSION-LIMIT"
41 "ARRAY-TOTAL-SIZE-LIMIT"
58 "CALL-ARGUMENTS-LIMIT"
61 "DOUBLE-FLOAT-EPSILON"
62 "DOUBLE-FLOAT-NEGATIVE-EPSILON"
63 "INTERNAL-TIME-UNITS-PER-SECOND"
64 "LAMBDA-LIST-KEYWORDS"
65 "LAMBDA-PARAMETERS-LIMIT"
66 "LEAST-NEGATIVE-DOUBLE-FLOAT"
67 "LEAST-NEGATIVE-LONG-FLOAT"
68 "LEAST-NEGATIVE-NORMALIZED-DOUBLE-FLOAT"
69 "LEAST-NEGATIVE-NORMALIZED-LONG-FLOAT"
70 "LEAST-NEGATIVE-NORMALIZED-SHORT-FLOAT"
71 "LEAST-NEGATIVE-NORMALIZED-SINGLE-FLOAT"
72 "LEAST-NEGATIVE-SHORT-FLOAT"
73 "LEAST-NEGATIVE-SINGLE-FLOAT"
74 "LEAST-POSITIVE-DOUBLE-FLOAT"
75 "LEAST-POSITIVE-LONG-FLOAT"
76 "LEAST-POSITIVE-NORMALIZED-DOUBLE-FLOAT"
77 "LEAST-POSITIVE-NORMALIZED-LONG-FLOAT"
78 "LEAST-POSITIVE-NORMALIZED-SHORT-FLOAT"
79 "LEAST-POSITIVE-NORMALIZED-SINGLE-FLOAT"
80 "LEAST-POSITIVE-SHORT-FLOAT"
81 "LEAST-POSITIVE-SINGLE-FLOAT"
83 "LONG-FLOAT-NEGATIVE-EPSILON"
84 "MOST-NEGATIVE-DOUBLE-FLOAT"
85 "MOST-NEGATIVE-FIXNUM"
86 "MOST-NEGATIVE-LONG-FLOAT"
87 "MOST-NEGATIVE-SHORT-FLOAT"
88 "MOST-NEGATIVE-SINGLE-FLOAT"
89 "MOST-POSITIVE-DOUBLE-FLOAT"
90 "MOST-POSITIVE-FIXNUM"
91 "MOST-POSITIVE-LONG-FLOAT"
92 "MOST-POSITIVE-SHORT-FLOAT"
93 "MOST-POSITIVE-SINGLE-FLOAT"
94 "MULTIPLE-VALUES-LIMIT"
97 "SHORT-FLOAT-NEGATIVE-EPSILON"
98 "SINGLE-FLOAT-EPSILON"
99 "SINGLE-FLOAT-NEGATIVE-EPSILON"
101 ;; everything else which needs a separate
102 ;; existence in xc and target
104 "BOOLE-CLR" "BOOLE-SET" "BOOLE-1" "BOOLE-2"
105 "BOOLE-C1" "BOOLE-C2" "BOOLE-AND" "BOOLE-IOR"
106 "BOOLE-XOR" "BOOLE-EQV" "BOOLE-NAND" "BOOLE-NOR"
107 "BOOLE-ANDC1" "BOOLE-ANDC2" "BOOLE-ORC1" "BOOLE-ORC2"
109 "BYTE" "BYTE-POSITION" "BYTE-SIZE"
111 "CLASS" "CLASS-NAME" "CLASS-OF"
114 "COMPILE-FILE-PATHNAME"
115 "*COMPILE-FILE-PATHNAME*"
116 "*COMPILE-FILE-TRUENAME*"
119 "COMPILER-MACRO-FUNCTION"
122 "DEFINE-MODIFY-MACRO"
123 "DEFINE-SETF-EXPANDER"
124 "DEFMACRO" "DEFSETF" "DEFSTRUCT" "DEFTYPE"
125 "DEPOSIT-FIELD" "DPB"
126 "FBOUNDP" "FDEFINITION" "FMAKUNBOUND"
128 "GENSYM" "*GENSYM-COUNTER*"
131 "LISP-IMPLEMENTATION-TYPE" "LISP-IMPLEMENTATION-VERSION"
133 "MACROEXPAND" "MACROEXPAND-1" "*MACROEXPAND-HOOK*"
135 "MAKE-LOAD-FORM-SAVING-SLOTS"
143 "UPGRADED-ARRAY-ELEMENT-TYPE"
144 "UPGRADED-COMPLEX-PART-TYPE"
145 "WITH-COMPILATION-UNIT"))
146 (export (intern name package-name
) package-name
)))
148 (dolist (package (list-all-packages))
149 (when (= (mismatch (package-name package
) "SB!") 3)
151 (mapcar (lambda (name) (find-symbol name
"SB-XC"))
152 '("BYTE" "BYTE-POSITION" "BYTE-SIZE"
153 "DPB" "LDB" "LDB-TEST"
154 "DEPOSIT-FIELD" "MASK-FIELD"
157 "BOOLE-CLR" "BOOLE-SET" "BOOLE-1" "BOOLE-2"
158 "BOOLE-C1" "BOOLE-C2" "BOOLE-AND" "BOOLE-IOR"
159 "BOOLE-XOR" "BOOLE-EQV" "BOOLE-NAND" "BOOLE-NOR"
160 "BOOLE-ANDC1" "BOOLE-ANDC2" "BOOLE-ORC1" "BOOLE-ORC2"))
163 ;; Build a version of Python to run in the host Common Lisp, to be
164 ;; used only in cross-compilation.
166 ;; Note that files which are marked :ASSEM, to cause them to be
167 ;; processed with SB!C:ASSEMBLE-FILE when we're running under the
168 ;; cross-compiler or the target lisp, are still processed here, just
169 ;; with the ordinary Lisp compiler, and this is intentional, in
170 ;; order to make the compiler aware of the definitions of assembly
172 (do-stems-and-flags (stem flags
)
173 (unless (find :not-host flags
)
174 (funcall load-or-cload-stem stem flags
)
175 #!+sb-show
(warn-when-cl-snapshot-diff *cl-snapshot
*)))
177 ;; If the cross-compilation host is SBCL itself, we can use the
178 ;; PURIFY extension to freeze everything in place, reducing the
179 ;; amount of work done on future GCs. In machines with limited
180 ;; memory, this could help, by reducing the amount of memory which
181 ;; needs to be juggled in a full GC. And it can hardly hurt, since
182 ;; (in the ordinary build procedure anyway) essentially everything
183 ;; which is reachable at this point will remain reachable for the
186 ;; (Except that purifying actually slows down GENCGC). -- JES, 2006-05-30
187 #+(and sbcl
(not gencgc
))