Eliminate style-warning about undefined type GLOBAL-VAR
[sbcl.git] / src / cold / defun-load-or-cload-xcompiler.lisp
blobd1bc0f4d46717076358eac4d4ccc992558096064
1 ;;;; This software is part of the SBCL system. See the README file for
2 ;;;; more information.
3 ;;;;
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"
40 "ARRAY-RANK-LIMIT"
41 "ARRAY-TOTAL-SIZE-LIMIT"
42 "BOOLE-1"
43 "BOOLE-2"
44 "BOOLE-AND"
45 "BOOLE-ANDC1"
46 "BOOLE-ANDC2"
47 "BOOLE-C1"
48 "BOOLE-C2"
49 "BOOLE-CLR"
50 "BOOLE-EQV"
51 "BOOLE-IOR"
52 "BOOLE-NAND"
53 "BOOLE-NOR"
54 "BOOLE-ORC1"
55 "BOOLE-ORC2"
56 "BOOLE-SET"
57 "BOOLE-XOR"
58 "CALL-ARGUMENTS-LIMIT"
59 "CHAR-CODE-LIMIT"
60 "DEFMETHOD"
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"
82 "LONG-FLOAT-EPSILON"
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"
95 "PI"
96 "SHORT-FLOAT-EPSILON"
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
103 "BOOLE"
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"
108 "BUILT-IN-CLASS"
109 "BYTE" "BYTE-POSITION" "BYTE-SIZE"
110 "CHAR-CODE"
111 "CLASS" "CLASS-NAME" "CLASS-OF"
112 "CODE-CHAR"
113 "COMPILE-FILE"
114 "COMPILE-FILE-PATHNAME"
115 "*COMPILE-FILE-PATHNAME*"
116 "*COMPILE-FILE-TRUENAME*"
117 "*COMPILE-PRINT*"
118 "*COMPILE-VERBOSE*"
119 "COMPILER-MACRO-FUNCTION"
120 "CONSTANTP"
121 "DEFCONSTANT"
122 "DEFINE-MODIFY-MACRO"
123 "DEFINE-SETF-EXPANDER"
124 "DEFMACRO" "DEFSETF" "DEFSTRUCT" "DEFTYPE"
125 "DEPOSIT-FIELD" "DPB"
126 "FBOUNDP" "FDEFINITION" "FMAKUNBOUND"
127 "FIND-CLASS"
128 "GENSYM" "*GENSYM-COUNTER*"
129 "GET-SETF-EXPANSION"
130 "LDB" "LDB-TEST"
131 "LISP-IMPLEMENTATION-TYPE" "LISP-IMPLEMENTATION-VERSION"
132 "MACRO-FUNCTION"
133 "MACROEXPAND" "MACROEXPAND-1" "*MACROEXPAND-HOOK*"
134 "MAKE-LOAD-FORM"
135 "MAKE-LOAD-FORM-SAVING-SLOTS"
136 "MASK-FIELD"
137 "PROCLAIM"
138 "SPECIAL-OPERATOR-P"
139 "STANDARD-CLASS"
140 "STRUCTURE-CLASS"
141 "SUBTYPEP"
142 "TYPE-OF" "TYPEP"
143 "UPGRADED-ARRAY-ELEMENT-TYPE"
144 "UPGRADED-COMPLEX-PART-TYPE"
145 "WITH-COMPILATION-UNIT"))
146 (export (intern name package-name) package-name)))
147 ;; don't watch:
148 (dolist (package (list-all-packages))
149 (when (= (mismatch (package-name package) "SB!") 3)
150 (shadowing-import
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"
156 "BOOLE"
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"))
161 package)))
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
171 ;; routines.
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
184 ;; entire run.
186 ;; (Except that purifying actually slows down GENCGC). -- JES, 2006-05-30
187 #+(and sbcl (not gencgc))
188 (sb-ext:purify)
190 (values))