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 '(;; the constants (except for T and NIL which have
26 ;; a specially hacked correspondence between
27 ;; cross-compilation host Lisp and target Lisp)
28 "ARRAY-DIMENSION-LIMIT"
30 "ARRAY-TOTAL-SIZE-LIMIT"
47 "CALL-ARGUMENTS-LIMIT"
49 "DOUBLE-FLOAT-EPSILON"
50 "DOUBLE-FLOAT-NEGATIVE-EPSILON"
51 "INTERNAL-TIME-UNITS-PER-SECOND"
52 "LAMBDA-LIST-KEYWORDS"
53 "LAMBDA-PARAMETERS-LIMIT"
54 "LEAST-NEGATIVE-DOUBLE-FLOAT"
55 "LEAST-NEGATIVE-LONG-FLOAT"
56 "LEAST-NEGATIVE-NORMALIZED-DOUBLE-FLOAT"
57 "LEAST-NEGATIVE-NORMALIZED-LONG-FLOAT"
58 "LEAST-NEGATIVE-NORMALIZED-SHORT-FLOAT"
59 "LEAST-NEGATIVE-NORMALIZED-SINGLE-FLOAT"
60 "LEAST-NEGATIVE-SHORT-FLOAT"
61 "LEAST-NEGATIVE-SINGLE-FLOAT"
62 "LEAST-POSITIVE-DOUBLE-FLOAT"
63 "LEAST-POSITIVE-LONG-FLOAT"
64 "LEAST-POSITIVE-NORMALIZED-DOUBLE-FLOAT"
65 "LEAST-POSITIVE-NORMALIZED-LONG-FLOAT"
66 "LEAST-POSITIVE-NORMALIZED-SHORT-FLOAT"
67 "LEAST-POSITIVE-NORMALIZED-SINGLE-FLOAT"
68 "LEAST-POSITIVE-SHORT-FLOAT"
69 "LEAST-POSITIVE-SINGLE-FLOAT"
71 "LONG-FLOAT-NEGATIVE-EPSILON"
72 "MOST-NEGATIVE-DOUBLE-FLOAT"
73 "MOST-NEGATIVE-FIXNUM"
74 "MOST-NEGATIVE-LONG-FLOAT"
75 "MOST-NEGATIVE-SHORT-FLOAT"
76 "MOST-NEGATIVE-SINGLE-FLOAT"
77 "MOST-POSITIVE-DOUBLE-FLOAT"
78 "MOST-POSITIVE-FIXNUM"
79 "MOST-POSITIVE-LONG-FLOAT"
80 "MOST-POSITIVE-SHORT-FLOAT"
81 "MOST-POSITIVE-SINGLE-FLOAT"
82 "MULTIPLE-VALUES-LIMIT"
85 "SHORT-FLOAT-NEGATIVE-EPSILON"
86 "SINGLE-FLOAT-EPSILON"
87 "SINGLE-FLOAT-NEGATIVE-EPSILON"
89 ;; everything else which needs a separate
90 ;; existence in xc and target
92 "CLASS" "CLASS-NAME" "CLASS-OF"
94 "COMPILE-FILE-PATHNAME"
95 "*COMPILE-FILE-PATHNAME*"
96 "*COMPILE-FILE-TRUENAME*"
99 "COMPILER-MACRO-FUNCTION"
102 "DEFINE-MODIFY-MACRO"
103 "DEFINE-SETF-EXPANDER"
104 "DEFMACRO" "DEFSETF" "DEFSTRUCT" "DEFTYPE"
105 "FBOUNDP" "FDEFINITION" "FMAKUNBOUND"
108 "LAMBDA-LIST-KEYWORDS"
109 "LISP-IMPLEMENTATION-TYPE" "LISP-IMPLEMENTATION-VERSION"
111 "MACROEXPAND" "MACROEXPAND-1" "*MACROEXPAND-HOOK*"
120 "WITH-COMPILATION-UNIT"))
121 (export (intern name package-name) package-name)))
123 ;; Build a version of Python to run in the host Common Lisp, to be
124 ;; used only in cross-compilation.
126 ;; Note that files which are marked :ASSEM, to cause them to be
127 ;; processed with SB!C:ASSEMBLE-FILE when we're running under the
128 ;; cross-compiler or the target lisp, are still processed here, just
129 ;; with the ordinary Lisp compiler, and this is intentional, in
130 ;; order to make the compiler aware of the definitions of assembly
132 (do-stems-and-flags (stem flags)
133 (unless (find :not-host flags)
134 (funcall load-or-cload-stem
136 :ignore-failure-p (find :ignore-failure-p flags))
137 #!+sb-show (warn-when-cl-snapshot-diff *cl-snapshot*)))
139 ;; If the cross-compilation host is SBCL itself, we can use the
140 ;; PURIFY extension to freeze everything in place, reducing the
141 ;; amount of work done on future GCs. In machines with limited
142 ;; memory, this could help, by reducing the amount of memory which
143 ;; needs to be juggled in a full GC. And it can hardly hurt, since
144 ;; (in the ordinary build procedure anyway) essentially everything
145 ;; which is reachable at this point will remain reachable for the
147 #+sbcl (sb-ext:purify)