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