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 ;;; Either load or compile-then-load the cross-compiler into the
13 ;;; cross-compilation host Common Lisp.
14 (defun load-or-cload-xcompiler (load-or-cload-stem)
16 ;; The running-in-the-host-Lisp Python cross-compiler defines its
17 ;; own versions of a number of functions which should not overwrite
18 ;; host-Lisp functions. Instead we put them in a special package.
20 ;; The common theme of the functions, macros, constants, and so
21 ;; forth in this package is that they run in the host and affect the
22 ;; compilation of the target.
23 (let ((package-name "SB-XC"))
24 (make-package package-name :use nil :nicknames nil)
25 (dolist (name '("ARRAY-RANK-LIMIT"
26 "ARRAY-DIMENSION-LIMIT"
27 "ARRAY-TOTAL-SIZE-LIMIT"
29 "CLASS" "CLASS-NAME" "CLASS-OF"
31 "COMPILE-FILE-PATHNAME"
32 "*COMPILE-FILE-PATHNAME*"
33 "*COMPILE-FILE-TRUENAME*"
36 "COMPILER-MACRO-FUNCTION"
40 "DEFINE-SETF-EXPANDER"
41 "DEFMACRO" "DEFSETF" "DEFSTRUCT" "DEFTYPE"
42 "FBOUNDP" "FDEFINITION" "FMAKUNBOUND"
45 "LAMBDA-LIST-KEYWORDS"
46 "LISP-IMPLEMENTATION-TYPE" "LISP-IMPLEMENTATION-VERSION"
48 "MACROEXPAND" "MACROEXPAND-1" "*MACROEXPAND-HOOK*"
57 "WITH-COMPILATION-UNIT"))
58 (export (intern name package-name) package-name)))
60 ;; Build a version of Python to run in the host Common Lisp, to be
61 ;; used only in cross-compilation.
63 ;; Note that files which are marked :ASSEM, to cause them to be
64 ;; processed with SB!C:ASSEMBLE-FILE when we're running under the
65 ;; cross-compiler or the target lisp, are still processed here, just
66 ;; with the ordinary Lisp compiler, and this is intentional, in
67 ;; order to make the compiler aware of the definitions of assembly
69 (for-stems-and-flags (stem flags)
70 (unless (find :not-host flags)
71 (funcall load-or-cload-stem
73 :ignore-failure-p (find :ignore-failure-p flags))
74 #!+sb-show (warn-when-cl-snapshot-diff *cl-snapshot*)))
76 ;; If the cross-compilation host is SBCL itself, we can use the
77 ;; PURIFY extension to freeze everything in place, reducing the
78 ;; amount of work done on future GCs. In machines with limited
79 ;; memory, this could help, by reducing the amount of memory which
80 ;; needs to be juggled in a full GC. And it can hardly hurt, since
81 ;; (in the ordinary build procedure anyway) essentially everything
82 ;; which is reachable at this point will remain reachable for the
84 #+sbcl (sb-ext:purify)