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 (when (make-host-1-parallelism)
23 #+#.
(cl:if
(cl:find-package
"SB-POSIX") '(and) '(or))
24 (defun parallel-make-host-1 (max-jobs)
25 (let ((subprocess-count 0)
26 (subprocess-list nil
))
28 (multiple-value-bind (pid status
) (sb-posix:wait
)
29 (format t
"~&; Subprocess ~D exit status ~D~%" pid status
)
30 (setq subprocess-list
(delete pid subprocess-list
)))
31 (decf subprocess-count
)))
32 (do-stems-and-flags (stem flags
)
33 (unless (position :not-host flags
)
34 (when (>= subprocess-count max-jobs
)
36 (let ((pid (sb-posix:fork
)))
38 (in-host-compilation-mode
39 (lambda () (compile-stem stem flags
:host-compile
)))
40 ;; FIXME: convey exit code based on COMPILE result.
42 (nth-value 1 (find-symbol "OS-EXIT" :sb-sys
)))
43 `(,(find-symbol "OS-EXIT" :sb-sys
) 0)
44 `(sb-unix:unix-exit
0)))
45 (push pid subprocess-list
)
46 (incf subprocess-count
)
47 ;; Do not wait for the compile to finish. Just load as source.
48 (let ((source (merge-pathnames (stem-remap-target stem
)
49 (make-pathname :type
"lisp"))))
50 (let ((sb-ext:*evaluator-mode
* :interpret
))
51 (in-host-compilation-mode
53 (load source
:verbose t
:print nil
))))))))
54 (loop (if (plusp subprocess-count
) (wait) (return)))))
56 ;; We want to load compiled files, because that's what this function promises.
57 ;; Reloading is tricky because constructors for interned ctypes will construct
58 ;; new objects via their LOAD-TIME-VALUE forms, but globaldb already stored
59 ;; some objects from the interpreted pre-load.
60 ;; So wipe everything out that causes problems down the line.
61 ;; (Or perhaps we could make their effects idempotent)
62 (format t
"~&; Parallel build: Clearing globaldb~%")
64 (when (get s
:sb-xc-globaldb-info
)
65 (remf (symbol-plist s
) :sb-xc-globaldb-info
)))
66 (fill (symbol-value 'sb
!impl
::*info-types
*) nil
)
67 (clrhash (symbol-value 'sb
!kernel
::*forward-referenced-layouts
*))
68 (setf (symbol-value 'sb
!kernel
:*type-system-initialized
*) nil
)
69 (makunbound 'sb
!c
::*backend-primitive-type-names
*)
70 (makunbound 'sb
!c
::*backend-primitive-type-aliases
*)
72 (format t
"~&; Parallel build: Reloading compilation artifacts~%")
73 ;; Now it works to load fasls.
74 (in-host-compilation-mode
76 (handler-bind ((sb-kernel:redefinition-warning
#'muffle-warning
))
77 (do-stems-and-flags (stem flags
)
78 (unless (position :not-host flags
)
79 (load (stem-object-path stem flags
:host-compile
)
80 :verbose t
:print nil
))))))
81 (format t
"~&; Parallel build: Fasl loading complete~%"))
83 ;;; Either load or compile-then-load the cross-compiler into the
84 ;;; cross-compilation host Common Lisp.
85 (defun load-or-cload-xcompiler (load-or-cload-stem)
86 (declare (type function load-or-cload-stem
))
87 ;; Build a version of Python to run in the host Common Lisp, to be
88 ;; used only in cross-compilation.
90 ;; Note that files which are marked :ASSEM, to cause them to be
91 ;; processed with SB!C:ASSEMBLE-FILE when we're running under the
92 ;; cross-compiler or the target lisp, are still processed here, just
93 ;; with the ordinary Lisp compiler, and this is intentional, in
94 ;; order to make the compiler aware of the definitions of assembly
96 (if (and (make-host-1-parallelism)
97 (eq load-or-cload-stem
#'host-cload-stem
))
98 (funcall (intern "PARALLEL-MAKE-HOST-1" 'sb-cold
)
99 (make-host-1-parallelism))
100 (do-stems-and-flags (stem flags
)
101 (unless (find :not-host flags
)
102 (funcall load-or-cload-stem stem flags
)
103 #!+sb-show
(warn-when-cl-snapshot-diff *cl-snapshot
*))))
105 ;; If the cross-compilation host is SBCL itself, we can use the
106 ;; PURIFY extension to freeze everything in place, reducing the
107 ;; amount of work done on future GCs. In machines with limited
108 ;; memory, this could help, by reducing the amount of memory which
109 ;; needs to be juggled in a full GC. And it can hardly hurt, since
110 ;; (in the ordinary build procedure anyway) essentially everything
111 ;; which is reachable at this point will remain reachable for the
114 ;; (Except that purifying actually slows down GENCGC). -- JES, 2006-05-30
115 #+(and sbcl
(not gencgc
))
120 ;; Keep these in order by package, then symbol.
125 compute-applicable-methods
127 make-load-form-saving-slots
129 sb
!vm
::map-allocated-objects
130 sb
!vm
::map-objects-in-range
131 sb
!kernel
::choose-code-component-order
)
132 ;; CLOS implementation
133 '(sb!mop
:class-finalized-p
134 sb
!mop
:class-prototype
136 sb
!mop
:eql-specializer-object
137 sb
!mop
:finalize-inheritance
138 sb
!mop
:generic-function-name
139 sb
!mop
:slot-definition-allocation
140 sb
!mop
:slot-definition-name
141 sb
!pcl
::%force-cache-flushes
142 sb
!pcl
::check-wrapper-validity
143 sb
!pcl
::class-has-a-forward-referenced-superclass-p
144 sb
!pcl
::class-wrapper
145 sb
!pcl
::compute-gf-ftype
146 sb
!pcl
::definition-source
147 sb
!pcl
::ensure-accessor
148 sb
!pcl
:ensure-class-finalized
)
149 ;; CLOS-based packages
150 '(sb!gray
:stream-clear-input
151 sb
!gray
:stream-clear-output
152 sb
!gray
:stream-file-position
153 sb
!gray
:stream-finish-output
154 sb
!gray
:stream-force-output
155 sb
!gray
:stream-fresh-line
156 sb
!gray
:stream-line-column
157 sb
!gray
:stream-line-length
158 sb
!gray
:stream-listen
159 sb
!gray
:stream-peek-char
160 sb
!gray
:stream-read-byte
161 sb
!gray
:stream-read-char
162 sb
!gray
:stream-read-char-no-hang
163 sb
!gray
:stream-read-line
164 sb
!gray
:stream-read-sequence
165 sb
!gray
:stream-terpri
166 sb
!gray
:stream-unread-char
167 sb
!gray
:stream-write-byte
168 sb
!gray
:stream-write-char
169 sb
!gray
:stream-write-sequence
170 sb
!gray
:stream-write-string
171 sb
!sequence
:concatenate
175 sb
!sequence
:count-if-not
177 sb
!sequence
:delete-duplicates
178 sb
!sequence
:delete-if
179 sb
!sequence
:delete-if-not
180 (setf sb
!sequence
:elt
)
186 sb
!sequence
:find-if-not
187 (setf sb
!sequence
:iterator-element
)
188 sb
!sequence
:iterator-endp
189 sb
!sequence
:iterator-step
191 sb
!sequence
:make-sequence-iterator
192 sb
!sequence
:make-sequence-like
197 sb
!sequence
:nsubstitute
198 sb
!sequence
:nsubstitute-if
199 sb
!sequence
:nsubstitute-if-not
201 sb
!sequence
:position-if
202 sb
!sequence
:position-if-not
205 sb
!sequence
:remove-duplicates
206 sb
!sequence
:remove-if
207 sb
!sequence
:remove-if-not
212 sb
!sequence
:stable-sort
214 sb
!sequence
:substitute
215 sb
!sequence
:substitute-if
216 sb
!sequence
:substitute-if-not
)
219 '(sb!interpreter
:%fun-type
220 sb
!interpreter
:env-policy
221 sb
!interpreter
:eval-in-environment
222 sb
!interpreter
:find-lexical-fun
223 sb
!interpreter
:find-lexical-var
224 sb
!interpreter
::flush-everything
225 sb
!interpreter
::fun-lexically-notinline-p
226 sb
!interpreter
:lexenv-from-env
227 sb
!interpreter
::lexically-unlocked-symbol-p
228 sb
!interpreter
:list-locals
229 sb
!interpreter
:prepare-for-compile
230 sb
!interpreter
::reconstruct-syntactic-closure-env
)
232 '(sb!debug
::find-interrupted-name-and-frame
233 sb
!impl
::encapsulate-generic-function
234 sb
!impl
::encapsulated-generic-function-p
235 sb
!impl
::get-processes-status-changes
238 sb
!impl
::stringify-package-designator
239 sb
!impl
::stringify-string-designator
240 sb
!impl
::stringify-string-designators
241 sb
!impl
::unencapsulate-generic-function
)))
242 (setf (gethash sym
*undefined-fun-whitelist
*) t
))