1 ;;;; stuff which is not specific to any particular build phase, but
2 ;;;; used by most of them
4 ;;;; Note: It's specifically not used when bootstrapping PCL, because
5 ;;;; we do SAVE-LISP after that, and we don't want to save extraneous
6 ;;;; bootstrapping machinery into the frozen image which will
7 ;;;; subsequently be used as the mother of all Lisp sessions.
9 ;;;; This software is part of the SBCL system. See the README file for
10 ;;;; more information.
12 ;;;; This software is derived from the CMU CL system, which was
13 ;;;; written at Carnegie Mellon University and released into the
14 ;;;; public domain. The software is in the public domain and is
15 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
16 ;;;; files for more information.
18 ;;; SB-COLD holds stuff used to build the initial SBCL core file
19 ;;; (including not only the final construction of the core file, but
20 ;;; also the preliminary steps like e.g. building the cross-compiler
21 ;;; and running the cross-compiler to produce target FASL files).
22 (defpackage "SB-COLD" (:use
"CL"))
24 (in-package "SB-COLD")
26 (defun parse-make-host-parallelism (str)
27 (multiple-value-bind (value1 end
) (parse-integer str
:junk-allowed t
)
29 (let ((value2 (if (and value1
30 (< end
(1- (length str
))) ; ~ /,[\d]+/
31 (eql (char str end
) #\
,))
32 (parse-integer str
:start
(1+ end
)))))
33 ;; If only 1 integer, assume same parallelism for both passes.
36 ;; 0 means no parallelism. 1 means use at most one subjob,
37 ;; just in case you want to test the controlling loop.
38 (when (eql value1
0) (setq value1 nil
))
39 (when (eql value2
0) (setq value2 nil
))
40 ;; Parallelism on pass 1 works only if LOAD does not compile.
41 ;; Otherwise it's slower than compiling serially.
42 ;; (And this has only been tested with sb-fasteval, not sb-eval.)
43 (cons (and (find-package "SB-INTERPRETER") value1
)
46 (defvar *make-host-parallelism
*
48 (let ((envvar (sb-ext:posix-getenv
"SBCL_MAKE_PARALLEL")))
51 (parse-make-host-parallelism envvar
)))))
53 (defun make-host-1-parallelism () (car *make-host-parallelism
*))
54 (defun make-host-2-parallelism () (cdr *make-host-parallelism
*))
57 (let ((f (multiple-value-bind (sym access
) (find-symbol "OS-EXIT" "SB-SYS")
58 (if (eq access
:external
) sym
'sb-unix
:unix-exit
))))
59 (defun exit-process (arg) (funcall f arg
)))
61 ;;; If TRUE, then COMPILE-FILE is being invoked only to process
62 ;;; :COMPILE-TOPLEVEL forms, not to produce an output file.
63 ;;; This is part of the implementation of parallelized make-host-2.
64 (defvar *compile-for-effect-only
* nil
)
66 ;;; prefixes for filename stems when cross-compiling. These are quite arbitrary
67 ;;; (although of course they shouldn't collide with anything we don't want to
68 ;;; write over). In particular, they can be either relative path names (e.g.
69 ;;; "host-objects/" or absolute pathnames (e.g. "/tmp/sbcl-xc-host-objects/").
71 ;;; The cross-compilation process will force the creation of these directories
72 ;;; by executing CL:ENSURE-DIRECTORIES-EXIST (on the xc host Common Lisp).
73 (defvar *host-obj-prefix
*)
74 (defvar *target-obj-prefix
*)
76 (defvar *target-obj-suffix
*
77 ;; Target fasl files are LOADed (actually only quasi-LOADed, in
78 ;; GENESIS) only by SBCL code, and it doesn't care about particular
79 ;; extensions, so we can use something arbitrary.
81 (defvar *target-assem-obj-suffix
*
82 ;; Target fasl files from SB!C:ASSEMBLE-FILE are LOADed via GENESIS.
83 ;; The source files are compiled once as assembly files and once as
84 ;; normal lisp files. In the past, they were kept separate by
85 ;; clever symlinking in the source tree, but that became less clean
86 ;; as ports to host environments without symlinks started appearing.
87 ;; In order to keep them separate, we have the assembled versions
88 ;; with a separate suffix.
91 ;;; a function of one functional argument, which calls its functional argument
92 ;;; in an environment suitable for compiling the target. (This environment
93 ;;; includes e.g. a suitable *FEATURES* value.)
94 (declaim (type function
*in-target-compilation-mode-fn
*))
95 (defvar *in-target-compilation-mode-fn
*)
97 ;;; a function with the same calling convention as CL:COMPILE-FILE, to be
98 ;;; used to translate ordinary Lisp source files into target object files
99 (declaim (type function
*target-compile-file
*))
100 (defvar *target-compile-file
*)
102 ;;; designator for a function with the same calling convention as
103 ;;; SB-C:ASSEMBLE-FILE, to be used to translate assembly files into target
105 (defvar *target-assemble-file
*)
109 ;;; Take the file named X and make it into a file named Y. Sorta like
110 ;;; UNIX, and unlike Common Lisp's bare RENAME-FILE, we don't allow
111 ;;; information from the original filename to influence the final
112 ;;; filename. (The reason that it's only sorta like UNIX is that in
113 ;;; UNIX "mv foo bar/" will work, but the analogous
114 ;;; (RENAME-FILE-A-LA-UNIX "foo" "bar/") should fail.)
116 ;;; (This is a workaround for the weird behavior of Debian CMU CL
117 ;;; 2.4.6, where (RENAME-FILE "dir/x" "dir/y") tries to create a file
118 ;;; called "dir/dir/y". If that behavior goes away, then we should be
119 ;;; able to get rid of this function and use plain RENAME-FILE in the
120 ;;; COMPILE-STEM function above. -- WHN 19990321
121 (defun rename-file-a-la-unix (x y
)
123 (let ((path ;; (Note that the TRUENAME expression here is lifted from an
124 ;; example in the ANSI spec for TRUENAME.)
125 (with-open-file (stream y
:direction
:output
)
127 ;; From the ANSI spec: "In this case, the file is closed
128 ;; when the truename is tried, so the truename
129 ;; information is reliable."
132 (rename-file x path
)))
133 (compile 'rename-file-a-la-unix
)
135 (export '(prepend-genfile-path read-from-file
*generated-sources-root
*))
136 (defvar *generated-sources-root
* "")
138 ;;; See remark in COMPILE-STEM about strings vs. The Common Lisp Way
139 (defun prepend-genfile-path (namestring)
141 ;; if exact match to "output/", or mismatch at the next character
142 (if (member (mismatch "output/" namestring
) '(nil 7))
143 *generated-sources-root
*
146 (compile 'prepend-genfile-path
) ; seems in vogue to compile everything in this file
148 ;;; Return an expression read from the file named NAMESTRING.
149 ;;; For user-supplied inputs, protect against more than one expression
150 ;;; appearing in the file. With trusted inputs we needn't bother.
151 (defun read-from-file (namestring)
152 (with-open-file (s (prepend-genfile-path namestring
))
153 (let* ((result (read s
))
154 (eof-result (cons nil nil
)))
155 (when (string= (pathname-name namestring
) "build-order")
156 ;; build-order uses both host and target conditionals.
157 ;; Our sanity checks during make-host-1 would complain
158 ;; about #+feature when reading the second expression in the file
159 ;; whenever such feature is also a possible target feature.
160 (return-from read-from-file result
))
161 (unless (eq (read s nil eof-result
) eof-result
)
162 (error "more than one expression in file ~S" namestring
))
164 (compile 'read-from-file
)
166 ;;; Try to minimize/conceal any non-standardness of the host Common Lisp.
167 #-sbcl
(load "src/cold/ansify.lisp")
169 ;;;; Do not put SBCL-specific things in 'ansify'. Put them here.
170 ;;;; And there had better not be a reason that SBCL needs ansification.
173 (setq *compile-print
* nil
)
174 (load "src/cold/muffler.lisp")
175 ;; Let's just say we never care to see these.
176 (declaim (sb-ext:muffle-conditions
177 (satisfies unable-to-optimize-note-p
)
178 (satisfies optional
+key-style-warning-p
)
179 sb-ext
:code-deletion-note
)))
181 ;;;; special read-macros for building the cold system (and even for
182 ;;;; building some of our tools for building the cold system)
184 (load "src/cold/shebang.lisp")
186 ;;; When cross-compiling, the *FEATURES* set for the target Lisp is
187 ;;; not in general the same as the *FEATURES* set for the host Lisp.
188 ;;; In order to refer to target features specifically, we refer to
189 ;;; *SHEBANG-FEATURES* instead of *FEATURES*, and use the #!+ and #!-
190 ;;; readmacros instead of the ordinary #+ and #- readmacros.
191 (setf *shebang-features
*
192 (let* ((default-features
195 (read-from-file "local-target-features.lisp-expr"))
196 (read-from-file "base-target-features.lisp-expr")))
197 (customizer-file-name "customize-target-features.lisp")
198 (customizer (if (probe-file customizer-file-name
)
200 (read-from-file customizer-file-name
))
202 (funcall customizer default-features
)))
204 (defvar *shebang-backend-subfeatures
*
205 (let* ((default-subfeatures nil
)
206 (customizer-file-name "customize-backend-subfeatures.lisp")
207 (customizer (if (probe-file customizer-file-name
)
209 (read-from-file customizer-file-name
))
211 (funcall customizer default-subfeatures
)))
213 ;;; Call for effect of signaling an error if no target picked.
214 (target-platform-name)
216 ;;; You can get all the way through make-host-1 without either one of these
217 ;;; features, but then 'bit-bash' will fail to cross-compile.
218 (unless (intersection '(:big-endian
:little-endian
) *shebang-features
*)
219 (warn "You'll have bad time without either endian-ness defined"))
221 ;;; Some feature combinations simply don't work, and sometimes don't
222 ;;; fail until quite a ways into the build. Pick off the more obvious
223 ;;; combinations now, and provide a description of what the actual
224 ;;; failure is (not always obvious from when the build fails).
225 (let ((feature-compatibility-tests
226 '(("(and sb-thread (not gencgc))"
227 ":SB-THREAD requires :GENCGC")
228 ("(and sb-thread (not (or ppc x86 x86-64 arm64)))"
229 ":SB-THREAD not supported on selected architecture")
230 ("(and gencgc cheneygc)"
231 ":GENCGC and :CHENEYGC are incompatible")
232 ("(and cheneygc (not (or alpha arm hppa mips ppc sparc)))"
233 ":CHENEYGC not supported on selected architecture")
234 ("(and gencgc (not (or sparc ppc x86 x86-64 arm arm64)))"
235 ":GENCGC not supported on selected architecture")
236 ("(not (or gencgc cheneygc))"
237 "One of :GENCGC or :CHENEYGC must be enabled")
238 ("(and sb-safepoint (not (or arm64 ppc x86 x86-64)))"
239 ":SB-SAFEPOINT not supported on selected architecture")
240 ("(and sb-safepoint-strictly (not sb-safepoint))"
241 ":SB-SAFEPOINT-STRICTLY requires :SB-SAFEPOINT")
242 ("(and sb-dynamic-core (not linkage-table))"
243 ":SB-DYNAMIC-CORE requires :LINKAGE-TABLE")
244 ("(and relocatable-heap (or cheneygc win32))"
245 "Relocatable heap requires gencgc + not win32")
246 ("(and sb-linkable-runtime (not sb-dynamic-core))"
247 ":SB-LINKABLE-RUNTIME requires :SB-DYNAMIC-CORE")
248 ("(and sb-linkable-runtime (not (or x86 x86-64)))"
249 ":SB-LINKABLE-RUNTIME not supported on selected architecture")
250 ("(and sb-linkable-runtime (not (or darwin linux win32)))"
251 ":SB-LINKABLE-RUNTIME not supported on selected operating system")
252 ("(and sb-eval sb-fasteval)"
253 ;; It sorta kinda works to have both, but there should be no need,
254 ;; and it's not really supported.
255 "At most one interpreter can be selected")
256 ("(and immobile-space (not x86-64))"
257 ":IMMOBILE-SPACE is supported only on x86-64")
258 ("(and compact-instance-header (not immobile-space))"
259 ":COMPACT-INSTANCE-HEADER requires :IMMOBILE-SPACE feature")
260 ("(and immobile-code (not immobile-space))"
261 ":IMMOBILE-CODE requires :IMMOBILE-SPACE feature")
262 ("(and immobile-symbols (not immobile-space))"
263 ":IMMOBILE-SYMBOLS requires :IMMOBILE-SPACE feature")
264 ;; There is still hope to make multithreading on DragonFly x86-64
265 ("(and sb-thread x86 dragonfly)"
266 ":SB-THREAD not supported on selected architecture")))
267 (failed-test-descriptions nil
))
268 (dolist (test feature-compatibility-tests
)
269 (let ((*features
* *shebang-features
*))
270 (when (read-from-string (concatenate 'string
"#+" (first test
) "T NIL"))
271 (push (second test
) failed-test-descriptions
))))
272 (when failed-test-descriptions
273 (error "Feature compatibility check failed, ~S"
274 failed-test-descriptions
)))
276 ;;;; cold-init-related PACKAGE and SYMBOL tools
278 ;;; Once we're done with possibly ANSIfying the COMMON-LISP package,
279 ;;; it's probably a mistake if we change it (beyond changing the
280 ;;; values of special variables such as *** and +, anyway). Set up
281 ;;; machinery to warn us when/if we change it.
283 ;;; All code depending on this is itself dependent on #!+SB-SHOW.
286 (load "src/cold/snapshot.lisp")
287 (defvar *cl-snapshot
* (take-snapshot "COMMON-LISP")))
289 ;;;; master list of source files and their properties
291 ;;; flags which can be used to describe properties of source files
293 *expected-stem-flags
*
294 '(;; meaning: This file is needed to generate C headers if doing so
295 ;; independently of make-host-1
297 ;; meaning: This file is not to be compiled when building the
298 ;; cross-compiler which runs on the host ANSI Lisp. ("not host
299 ;; code", i.e. does not execute on host -- but may still be
300 ;; cross-compiled by the host, so that it executes on the target)
302 ;; meaning: This file is not to be compiled as part of the target
303 ;; SBCL. ("not target code" -- but still presumably host code,
304 ;; used to support the cross-compilation process)
306 ;; meaning: This file must always be compiled by 'slam.lisp' even if
307 ;; the object is not out of date with respect to its source.
308 ;; Necessary if there are compile-time-too effects that are not
309 ;; reflected into make-host-2 by load-time actions of make-host-1.
311 ;; meaning: The #'COMPILE-STEM argument :TRACE-FILE should be T.
312 ;; When the compiler is SBCL's COMPILE-FILE or something like it,
313 ;; compiling "foo.lisp" will generate "foo.trace" which contains lots
314 ;; of exciting low-level information about representation selection,
315 ;; VOPs used by the compiler, and bits of assembly.
317 ;; meaning: This file is to be processed with the SBCL assembler,
318 ;; not COMPILE-FILE. (Note that this doesn't make sense unless
319 ;; :NOT-HOST is also set, since the SBCL assembler doesn't exist
320 ;; while the cross-compiler is being built in the host ANSI Lisp.)
322 ;; meaning: The #'COMPILE-STEM argument called :IGNORE-FAILURE-P
323 ;; should be true. (This is a KLUDGE: I'd like to get rid of it.
324 ;; For now, it exists so that compilation can proceed through the
325 ;; legacy warnings in src/compiler/x86/array.lisp, which I've
326 ;; never figured out but which were apparently acceptable in CMU
327 ;; CL. Eventually, it would be great to just get rid of all
328 ;; warnings and remove support for this flag. -- WHN 19990323)
330 ;; meaning: Build this file, but don't put it on the list for
331 ;; genesis to include in the cold core.
334 (defvar *array-to-specialization
* (make-hash-table :test
#'eq
))
336 (defmacro do-stems-and-flags
((stem flags
) &body body
)
337 (let ((stem-and-flags (gensym "STEM-AND-FLAGS")))
338 `(dolist (,stem-and-flags
(get-stems-and-flags))
339 (let ((,stem
(first ,stem-and-flags
))
340 (,flags
(rest ,stem-and-flags
)))
342 (clrhash *array-to-specialization
*)))))
344 ;;; Given a STEM, remap the path component "/target/" to a suitable
345 ;;; target directory.
346 (defun stem-remap-target (stem)
347 (let ((position (search "/target/" stem
)))
350 (subseq stem
0 (1+ position
))
351 (target-platform-name)
352 (subseq stem
(+ position
7)))
354 (compile 'stem-remap-target
)
356 ;;; Determine the source path for a stem by remapping from the abstract name
357 ;;; if it contains "/target/" and appending a ".lisp" suffix.
358 ;;; Assume that STEM is source-tree-relative unless it starts with "output/"
359 ;;; in which case it could be elsewhere, if you prefer to keep the sources
360 ;;; devoid of compilation artifacts. (The production of out-of-tree artifacts
361 ;;; is not actually implemented in the generic build, however if your build
362 ;;; system does that by itself, then hooray for you)
363 (defun stem-source-path (stem)
364 (concatenate 'string
(prepend-genfile-path (stem-remap-target stem
)) ".lisp"))
365 (compile 'stem-source-path
)
367 ;;; Determine the object path for a stem/flags/mode combination.
368 (defun stem-object-path (stem flags mode
)
370 (obj-prefix obj-suffix
)
373 ;; On some xc hosts, it's impossible to LOAD a fasl file unless it
374 ;; has the same extension that the host uses for COMPILE-FILE
375 ;; output, so we have to be careful to use the xc host's preferred
377 (values *host-obj-prefix
*
378 (concatenate 'string
"."
379 (pathname-type (compile-file-pathname stem
)))))
380 (:target-compile
(values *target-obj-prefix
*
381 (if (find :assem flags
)
382 *target-assem-obj-suffix
*
383 *target-obj-suffix
*))))
384 (concatenate 'string obj-prefix
(stem-remap-target stem
) obj-suffix
)))
385 (compile 'stem-object-path
)
387 (defvar *stems-and-flags
* nil
)
388 ;;; Check for stupid typos in FLAGS list keywords.
389 (defun get-stems-and-flags ()
390 (when *stems-and-flags
*
391 (return-from get-stems-and-flags
*stems-and-flags
*))
392 (setf *stems-and-flags
* (read-from-file "build-order.lisp-expr"))
393 (let ((stems (make-hash-table :test
'equal
)))
394 (do-stems-and-flags (stem flags
)
395 ;; We do duplicate stem comparison based on the object path in
396 ;; order to cover the case of stems with an :assem flag, which
397 ;; have two entries but separate object paths for each. KLUDGE:
398 ;; We have to bind *target-obj-prefix* here because it's normally
399 ;; set up later in the build process and we don't actually care
400 ;; what it is so long as it doesn't change while we're checking
401 ;; for duplicate stems.
402 (let* ((*target-obj-prefix
* "")
403 (object-path (stem-object-path stem flags
:target-compile
)))
404 (if (gethash object-path stems
)
405 (error "duplicate stem ~S in *STEMS-AND-FLAGS*" stem
)
406 (setf (gethash object-path stems
) t
)))
407 ;; FIXME: We should make sure that the :assem flag is only used
408 ;; when paired with :not-host.
409 (let ((set-difference (set-difference flags
*expected-stem-flags
*)))
411 (error "found unexpected flag(s) in *STEMS-AND-FLAGS*: ~S"
415 ;;;; tools to compile SBCL sources to create the cross-compiler
417 ;;; a wrapper for compilation/assembly, used mostly to centralize
418 ;;; the procedure for finding full filenames from "stems"
420 ;;; Compile the source file whose basic name is STEM, using some
421 ;;; standard-for-the-SBCL-build-process procedures to generate the
422 ;;; full pathnames of source file and object file. Return the pathname
423 ;;; of the object file for STEM.
425 ;;; STEM and FLAGS are as per DO-STEMS-AND-FLAGS. MODE is one of
426 ;;; :HOST-COMPILE and :TARGET-COMPILE.
427 (defun compile-stem (stem flags mode
)
429 (let* (;; KLUDGE: Note that this CONCATENATE 'STRING stuff is not The Common
430 ;; Lisp Way, although it works just fine for common UNIX environments.
431 ;; Should it come to pass that the system is ported to environments
432 ;; where version numbers and so forth become an issue, it might become
433 ;; urgent to rewrite this using the fancy Common Lisp PATHNAME
434 ;; machinery instead of just using strings. In the absence of such a
435 ;; port, it might or might be a good idea to do the rewrite.
437 (src (stem-source-path stem
))
438 (obj (stem-object-path stem flags mode
))
439 ;; Compile-for-effect happens simultaneously with a forked compile,
440 ;; so we need the for-effect output not to stomp on the real output.
442 (concatenate 'string obj
443 (if *compile-for-effect-only
* "-scratch" "-tmp")))
445 (compile-file (ecase mode
446 (:host-compile
#'compile-file
)
447 (:target-compile
(if (find :assem flags
)
448 *target-assemble-file
*
449 *target-compile-file
*))))
450 (trace-file (find :trace-file flags
))
451 (ignore-failure-p (find :ignore-failure-p flags
)))
452 (declare (type function compile-file
))
454 (ensure-directories-exist obj
:verbose
*compile-print
*) ; host's value
456 ;; We're about to set about building a new object file. First, we
457 ;; delete any preexisting object file in order to avoid confusing
458 ;; ourselves later should we happen to bail out of compilation
460 (when (and (not *compile-for-effect-only
*) (probe-file obj
))
465 ;; Work around a bug in CLISP 1999-01-08 #'COMPILE-FILE: CLISP
466 ;; mangles relative pathnames passed as :OUTPUT-FILE arguments,
467 ;; but works OK with absolute pathnames.
469 ;; following discussion on cmucl-imp 2002-07
470 ;; "COMPILE-FILE-PATHNAME", it would seem safer to deal with
471 ;; absolute pathnames all the time; it is no longer clear that the
472 ;; original behaviour in CLISP was wrong or that the current
473 ;; behaviour is right; and in any case absolutifying the pathname
474 ;; insulates us against changes of behaviour. -- CSR, 2002-08-09
476 ;; (Note that this idiom is taken from the ANSI
477 ;; documentation for TRUENAME.)
478 (with-open-file (stream tmp-obj
480 ;; Compilation would overwrite the
481 ;; temporary object anyway and overly
482 ;; strict implementations default
484 :if-exists
:supersede
)
487 ;; and some compilers (e.g. OpenMCL) will complain if they're
488 ;; asked to write over a file that exists already (and isn't
489 ;; recognizeably a fasl file), so
490 (when (probe-file tmp-obj
)
491 (delete-file tmp-obj
))
493 ;; Try to use the compiler to generate a new temporary object file.
494 (flet ((report-recompile-restart (stream)
495 (format stream
"Recompile file ~S" src
))
496 (report-continue-restart (stream)
497 (format stream
"Continue, using possibly bogus file ~S" obj
)))
500 (multiple-value-bind (output-truename warnings-p failure-p
)
503 (funcall compile-file src
:output-file tmp-obj
504 :trace-file t
:allow-other-keys t
)
505 (funcall compile-file src
:output-file tmp-obj
))
507 :report report-recompile-restart
508 (go retry-compile-file
)))
509 (declare (ignore warnings-p
))
510 (cond ((not output-truename
)
511 (error "couldn't compile ~S" src
))
514 (warn "ignoring FAILURE-P return value from compilation of ~S"
518 (error "FAILURE-P was set when creating ~S."
521 :report report-recompile-restart
522 (go retry-compile-file
))
524 :report report-continue-restart
525 (setf failure-p nil
)))
526 ;; Don't leave failed object files lying around.
527 (when (and failure-p
(probe-file tmp-obj
))
528 (delete-file tmp-obj
)
529 (format t
"~&deleted ~S~%" tmp-obj
)))))
530 ;; Otherwise: success, just fall through.
533 ;; If we get to here, compilation succeeded, so it's OK to rename
534 ;; the temporary output file to the permanent object file.
535 (cond ((not *compile-for-effect-only
*)
536 (rename-file-a-la-unix tmp-obj obj
))
537 ((probe-file tmp-obj
)
538 (delete-file tmp-obj
))) ; clean up the trash
540 ;; nice friendly traditional return value
542 (compile 'compile-stem
)
544 ;;; Execute function FN in an environment appropriate for compiling the
545 ;;; cross-compiler's source code in the cross-compilation host.
546 (defun in-host-compilation-mode (fn)
547 (declare (type function fn
))
548 (let ((*features
* (cons :sb-xc-host
*features
*)))
550 (compile 'in-host-compilation-mode
)
552 ;;; Process a file as source code for the cross-compiler, compiling it
553 ;;; (if necessary) in the appropriate environment, then loading it
554 ;;; into the cross-compilation host Common lisp.
555 (defun host-cload-stem (stem flags
)
557 (with-simple-restart (recompile "Recompile")
558 (let ((compiled-filename (in-host-compilation-mode
560 (compile-stem stem flags
:host-compile
)))))
562 (load compiled-filename
))))))
563 (compile 'host-cload-stem
)
565 ;;; like HOST-CLOAD-STEM, except that we don't bother to compile
566 (defun host-load-stem (stem flags
)
568 (with-simple-restart (recompile "Reload")
569 (return (load (stem-object-path stem flags
:host-compile
))))))
570 (compile 'host-load-stem
)
572 ;;;; tools to compile SBCL sources to create object files which will
573 ;;;; be used to create the target SBCL .core file
575 (defun lpnify-stem (stem)
576 ;; Don't want genfiles path to sneak in - avoid (STEM-SOURCE-PATH ...) here.
577 (let ((string (stem-remap-target stem
)))
578 ;; Distrust that random hosts don't bork up the translation.
579 ;; Simply replace '/' with ';' and be done.
580 (format nil
"SYS:~:@(~A~).LISP" (substitute #\
; #\/ string))))
581 (compile 'lpnify-stem
)
583 ;;; Run the cross-compiler on a file in the source directory tree to
584 ;;; produce a corresponding file in the target object directory tree.
585 (defun target-compile-stem (stem flags
)
586 (funcall *in-target-compilation-mode-fn
*
588 (progv (list (intern "*SOURCE-NAMESTRING*" "SB!C"))
589 (list (lpnify-stem stem
))
590 (compile-stem stem flags
:target-compile
)))))
591 (compile 'target-compile-stem
)
593 ;;; (This function is not used by the build process, but is intended
594 ;;; for interactive use when experimenting with the system. It runs
595 ;;; the cross-compiler on test files with arbitrary filenames, not
596 ;;; necessarily in the source tree, e.g. in "/tmp".)
597 (defun target-compile-file (filename)
598 (funcall *in-target-compilation-mode-fn
*
600 (funcall *target-compile-file
* filename
))))
601 (compile 'target-compile-file
)