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 (defparameter *full-calls-to-warn-about
*
13 '(;mask-signed-field ;; Too many to fix
16 ;;; Set of function names whose definition will never be seen in make-host-2,
17 ;;; as they are deferred until warm load.
18 ;;; The table is populated later in this file.
19 (defparameter *undefined-fun-whitelist
* (make-hash-table :test
'equal
))
21 (export '*symbol-values-for-genesis
*)
22 (let ((pathname "output/init-symbol-values.lisp-expr"))
23 (defvar *symbol-values-for-genesis
*
24 (and (probe-file pathname
) (read-from-file pathname
)))
25 (defun save-initial-symbol-values ()
26 (with-open-file (f pathname
:direction
:output
:if-exists
:supersede
)
27 (declare (special *symbol-values-for-genesis
*)) ; non-toplevel DEFVAR
28 (write *symbol-values-for-genesis
* :stream f
:readably t
))))
30 ;;; Either load or compile-then-load the cross-compiler into the
31 ;;; cross-compilation host Common Lisp.
32 (defun load-or-cload-xcompiler (load-or-cload-stem)
34 (declare (type function load-or-cload-stem
))
36 ;; The running-in-the-host-Lisp Python cross-compiler defines its
37 ;; own versions of a number of functions which should not overwrite
38 ;; host-Lisp functions. Instead we put them in a special package.
40 ;; The common theme of the functions, macros, constants, and so
41 ;; forth in this package is that they run in the host and affect the
42 ;; compilation of the target.
43 (let ((package-name "SB-XC"))
44 (make-package package-name
:use nil
:nicknames nil
)
45 (dolist (name '(;; the constants (except for T and NIL which have
46 ;; a specially hacked correspondence between
47 ;; cross-compilation host Lisp and target Lisp)
48 "ARRAY-DIMENSION-LIMIT"
50 "ARRAY-TOTAL-SIZE-LIMIT"
67 "CALL-ARGUMENTS-LIMIT"
70 "DOUBLE-FLOAT-EPSILON"
71 "DOUBLE-FLOAT-NEGATIVE-EPSILON"
72 "INTERNAL-TIME-UNITS-PER-SECOND"
73 "LAMBDA-LIST-KEYWORDS"
74 "LAMBDA-PARAMETERS-LIMIT"
75 "LEAST-NEGATIVE-DOUBLE-FLOAT"
76 "LEAST-NEGATIVE-LONG-FLOAT"
77 "LEAST-NEGATIVE-NORMALIZED-DOUBLE-FLOAT"
78 "LEAST-NEGATIVE-NORMALIZED-LONG-FLOAT"
79 "LEAST-NEGATIVE-NORMALIZED-SHORT-FLOAT"
80 "LEAST-NEGATIVE-NORMALIZED-SINGLE-FLOAT"
81 "LEAST-NEGATIVE-SHORT-FLOAT"
82 "LEAST-NEGATIVE-SINGLE-FLOAT"
83 "LEAST-POSITIVE-DOUBLE-FLOAT"
84 "LEAST-POSITIVE-LONG-FLOAT"
85 "LEAST-POSITIVE-NORMALIZED-DOUBLE-FLOAT"
86 "LEAST-POSITIVE-NORMALIZED-LONG-FLOAT"
87 "LEAST-POSITIVE-NORMALIZED-SHORT-FLOAT"
88 "LEAST-POSITIVE-NORMALIZED-SINGLE-FLOAT"
89 "LEAST-POSITIVE-SHORT-FLOAT"
90 "LEAST-POSITIVE-SINGLE-FLOAT"
92 "LONG-FLOAT-NEGATIVE-EPSILON"
93 "MOST-NEGATIVE-DOUBLE-FLOAT"
94 "MOST-NEGATIVE-FIXNUM"
95 "MOST-NEGATIVE-LONG-FLOAT"
96 "MOST-NEGATIVE-SHORT-FLOAT"
97 "MOST-NEGATIVE-SINGLE-FLOAT"
98 "MOST-POSITIVE-DOUBLE-FLOAT"
99 "MOST-POSITIVE-FIXNUM"
100 "MOST-POSITIVE-LONG-FLOAT"
101 "MOST-POSITIVE-SHORT-FLOAT"
102 "MOST-POSITIVE-SINGLE-FLOAT"
103 "MULTIPLE-VALUES-LIMIT"
105 "SHORT-FLOAT-EPSILON"
106 "SHORT-FLOAT-NEGATIVE-EPSILON"
107 "SINGLE-FLOAT-EPSILON"
108 "SINGLE-FLOAT-NEGATIVE-EPSILON"
110 ;; everything else which needs a separate
111 ;; existence in xc and target
113 "BOOLE-CLR" "BOOLE-SET" "BOOLE-1" "BOOLE-2"
114 "BOOLE-C1" "BOOLE-C2" "BOOLE-AND" "BOOLE-IOR"
115 "BOOLE-XOR" "BOOLE-EQV" "BOOLE-NAND" "BOOLE-NOR"
116 "BOOLE-ANDC1" "BOOLE-ANDC2" "BOOLE-ORC1" "BOOLE-ORC2"
118 "BYTE" "BYTE-POSITION" "BYTE-SIZE"
120 "CLASS" "CLASS-NAME" "CLASS-OF"
123 "COMPILE-FILE-PATHNAME"
124 "*COMPILE-FILE-PATHNAME*"
125 "*COMPILE-FILE-TRUENAME*"
128 "COMPILER-MACRO-FUNCTION"
131 "DEFINE-MODIFY-MACRO"
132 "DEFINE-SETF-EXPANDER"
133 "DEFMACRO" "DEFSETF" "DEFSTRUCT" "DEFTYPE"
134 "DEPOSIT-FIELD" "DPB"
135 "FBOUNDP" "FDEFINITION" "FMAKUNBOUND"
137 "GENSYM" "*GENSYM-COUNTER*"
140 "LISP-IMPLEMENTATION-TYPE" "LISP-IMPLEMENTATION-VERSION"
142 "MACROEXPAND" "MACROEXPAND-1" "*MACROEXPAND-HOOK*"
144 "MAKE-LOAD-FORM-SAVING-SLOTS"
152 "UPGRADED-ARRAY-ELEMENT-TYPE"
153 "UPGRADED-COMPLEX-PART-TYPE"
154 "WITH-COMPILATION-UNIT"))
155 (export (intern name package-name
) package-name
)))
156 ;; Symbols that can't be entered into the whitelist
157 ;; until this function executes.
158 (setf (gethash (intern "MAKE-LOAD-FORM" "SB-XC")
159 *undefined-fun-whitelist
*) t
)
161 (dolist (package (list-all-packages))
162 (when (= (mismatch (package-name package
) "SB!") 3)
164 (mapcar (lambda (name) (find-symbol name
"SB-XC"))
165 '("BYTE" "BYTE-POSITION" "BYTE-SIZE"
166 "DPB" "LDB" "LDB-TEST"
167 "DEPOSIT-FIELD" "MASK-FIELD"
170 "BOOLE-CLR" "BOOLE-SET" "BOOLE-1" "BOOLE-2"
171 "BOOLE-C1" "BOOLE-C2" "BOOLE-AND" "BOOLE-IOR"
172 "BOOLE-XOR" "BOOLE-EQV" "BOOLE-NAND" "BOOLE-NOR"
173 "BOOLE-ANDC1" "BOOLE-ANDC2" "BOOLE-ORC1" "BOOLE-ORC2"))
176 ;; Build a version of Python to run in the host Common Lisp, to be
177 ;; used only in cross-compilation.
179 ;; Note that files which are marked :ASSEM, to cause them to be
180 ;; processed with SB!C:ASSEMBLE-FILE when we're running under the
181 ;; cross-compiler or the target lisp, are still processed here, just
182 ;; with the ordinary Lisp compiler, and this is intentional, in
183 ;; order to make the compiler aware of the definitions of assembly
185 (do-stems-and-flags (stem flags
)
186 (unless (find :not-host flags
)
187 (funcall load-or-cload-stem stem flags
)
188 #!+sb-show
(warn-when-cl-snapshot-diff *cl-snapshot
*)))
190 ;; If the cross-compilation host is SBCL itself, we can use the
191 ;; PURIFY extension to freeze everything in place, reducing the
192 ;; amount of work done on future GCs. In machines with limited
193 ;; memory, this could help, by reducing the amount of memory which
194 ;; needs to be juggled in a full GC. And it can hardly hurt, since
195 ;; (in the ordinary build procedure anyway) essentially everything
196 ;; which is reachable at this point will remain reachable for the
199 ;; (Except that purifying actually slows down GENCGC). -- JES, 2006-05-30
200 #+(and sbcl
(not gencgc
))
205 ;; Keep these in order by package, then symbol.
210 compute-applicable-methods
213 sb
!kernel
:profile-deinit
)
214 ;; CLOS implementation
215 '(sb!mop
:class-finalized-p
216 sb
!mop
:class-prototype
217 sb
!mop
:eql-specializer-object
218 sb
!mop
:finalize-inheritance
219 sb
!pcl
::%force-cache-flushes
220 sb
!pcl
::check-wrapper-validity
221 sb
!pcl
::class-has-a-forward-referenced-superclass-p
222 sb
!pcl
::class-wrapper
223 sb
!pcl
::compute-gf-ftype
224 sb
!pcl
::definition-source
225 sb
!pcl
:ensure-class-finalized
226 sb
!pcl
::get-instance-hash-code
)
227 ;; CLOS-based packages
228 '(sb!gray
:stream-clear-input
229 sb
!gray
:stream-clear-output
230 sb
!gray
:stream-file-position
231 sb
!gray
:stream-finish-output
232 sb
!gray
:stream-force-output
233 sb
!gray
:stream-fresh-line
234 sb
!gray
:stream-line-column
235 sb
!gray
:stream-line-length
236 sb
!gray
:stream-listen
237 sb
!gray
:stream-peek-char
238 sb
!gray
:stream-read-byte
239 sb
!gray
:stream-read-char
240 sb
!gray
:stream-read-char-no-hang
241 sb
!gray
:stream-read-line
242 sb
!gray
:stream-read-sequence
243 sb
!gray
:stream-terpri
244 sb
!gray
:stream-unread-char
245 sb
!gray
:stream-write-byte
246 sb
!gray
:stream-write-char
247 sb
!gray
:stream-write-sequence
248 sb
!gray
:stream-write-string
249 sb
!sequence
:concatenate
253 sb
!sequence
:count-if-not
255 sb
!sequence
:delete-duplicates
256 sb
!sequence
:delete-if
257 sb
!sequence
:delete-if-not
258 (setf sb
!sequence
:elt
)
264 sb
!sequence
:find-if-not
265 (setf sb
!sequence
:iterator-element
)
266 sb
!sequence
:iterator-endp
267 sb
!sequence
:iterator-step
269 sb
!sequence
:make-sequence-iterator
270 sb
!sequence
:make-sequence-like
275 sb
!sequence
:nsubstitute
276 sb
!sequence
:nsubstitute-if
277 sb
!sequence
:nsubstitute-if-not
279 sb
!sequence
:position-if
280 sb
!sequence
:position-if-not
283 sb
!sequence
:remove-duplicates
284 sb
!sequence
:remove-if
285 sb
!sequence
:remove-if-not
290 sb
!sequence
:stable-sort
292 sb
!sequence
:substitute
293 sb
!sequence
:substitute-if
294 sb
!sequence
:substitute-if-not
)
297 '(sb!interpreter
:%fun-type
298 sb
!interpreter
:env-policy
299 sb
!interpreter
:eval-in-environment
300 sb
!interpreter
:find-lexical-fun
301 sb
!interpreter
:find-lexical-var
302 sb
!interpreter
::flush-everything
303 sb
!interpreter
::fun-lexically-notinline-p
304 sb
!interpreter
:lexenv-from-env
305 sb
!interpreter
:list-locals
306 sb
!interpreter
:prepare-for-compile
307 sb
!interpreter
::reconstruct-syntactic-closure-env
)
309 '(sb!debug
::find-interrupted-name-and-frame
310 sb
!impl
::encapsulate-generic-function
311 sb
!impl
::encapsulated-generic-function-p
312 sb
!impl
::get-processes-status-changes
315 sb
!impl
::unencapsulate-generic-function
)))
316 (setf (gethash sym
*undefined-fun-whitelist
*) t
))