Reduce consing during copy propagation.
[sbcl.git] / make-host-1.lisp
blobbbcb4f5f286c819ffc2ba1129e23a6966972bed8
1 ;;; (We want to have some limit on print length and print level during
2 ;;; bootstrapping because PRINT-OBJECT only gets set up rather late,
3 ;;; and running without PRINT-OBJECT it's easy to fall into printing
4 ;;; enormous (or infinitely circular) low-level representations of
5 ;;; things.)
6 (setf *print-level* 5 *print-length* 5)
8 (progn (load "src/cold/shared.lisp")
9 (load "tools-for-build/ldso-stubs.lisp"))
10 (in-package "SB-COLD")
11 (progn
12 (setf *host-obj-prefix* "obj/from-host/")
13 (load "src/cold/set-up-cold-packages.lisp")
14 (load "src/cold/defun-load-or-cload-xcompiler.lisp")
16 ;; Supress function/macro redefinition warnings under clisp.
17 #+clisp (setf custom:*suppress-check-redefinition* t)
19 (defmacro maybe-with-compilation-unit (&body forms)
20 ;; A compilation-unit seems to kill the compile. I'm not sure if it's
21 ;; running out of memory or what. I don't care to find out,
22 ;; but it's most definitely the cause of the breakage.
23 #+clisp `(progn ,@forms)
25 #+sbcl
26 ;; Watch for deferred warnings under SBCL.
27 ;; UNDEFINED-VARIABLE does not cause COMPILE-FILE to return warnings-p
28 ;; unless outside a compilation unit. You find out about it only upon
29 ;; exit of SUMMARIZE-COMPILATION-UNIT. So we set up a handler for that.
30 `(let (in-summary fail)
31 (handler-bind (((and simple-warning (not style-warning))
32 (lambda (c)
33 ;; hack for PPC. See 'build-order.lisp-expr'
34 ;; Ignore the warning, and the warning about the warning.
35 (unless (or (search "not allowed by the operand type"
36 (simple-condition-format-control c))
37 (search "ignoring FAILURE-P return"
38 (simple-condition-format-control c)))
39 (setq fail 'warning))))
40 ;; Prevent regressions on a couple platforms
41 ;; that are known to build cleanly.
42 #!+(or x86 x86-64)
43 (sb-int:simple-style-warning
44 (lambda (c)
45 (when (and in-summary
46 (search "undefined"
47 (simple-condition-format-control c)))
48 (unless (eq fail 'warning)
49 (setq fail 'style-warning))))))
50 (with-compilation-unit ()
51 (multiple-value-prog1 (progn ,@forms) (setq in-summary t))))
52 (when fail
53 (cerror "Proceed anyway"
54 "make-host-1 stopped due to unexpected ~A." fail)))
56 #-(or clisp sbcl) `(with-compilation-unit () ,@forms))
58 ;; Now we can set the #[+-] readers to our precautionary
59 ;; readers that prohibit use of ":sbcl" as the condition.
60 (set-dispatch-macro-character #\# #\+ #'she-reader)
61 (set-dispatch-macro-character #\# #\- #'she-reader))
63 (maybe-with-compilation-unit
64 (load-or-cload-xcompiler #'host-cload-stem)
66 ;;; Let's check that the type system, and various other things, are
67 ;;; reasonably sane. (It's easy to spend a long time wandering around
68 ;;; confused trying to debug cross-compilation if it isn't.)
69 (when (find :sb-test *shebang-features*)
70 (load "tests/type.before-xc.lisp")
71 (load "tests/info.before-xc.lisp")
72 (load "tests/vm.before-xc.lisp"))
73 ;; When building on a slow host using a slow Lisp,
74 ;; the wait time in slurp-ucd seems interminable - over a minute.
75 ;; Compiling seems to help a bit, but maybe it's my imagination.
76 (let ((object (compile-file "tools-for-build/ucd.lisp")))
77 (load object)
78 (delete-file object))
80 ;;; Generate character database tables.
81 (dolist (s '(sb-cold::slurp-ucd sb-cold::slurp-proplist sb-cold::output))
82 (funcall s))
84 ;;; propagate structure offset and other information to the C runtime
85 ;;; support code.
86 (host-cload-stem "src/compiler/generic/genesis" nil)
87 ) ; END with-compilation-unit
89 (sb!vm:genesis :c-header-dir-name "src/runtime/genesis")
90 #+cmu (ext:quit)
91 #+clisp (ext:quit)
92 #+abcl (ext:quit)