1 ;;;; "warm initialization": initialization which comes after cold init
3 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; This software is derived from the CMU CL system, which was
7 ;;;; written at Carnegie Mellon University and released into the
8 ;;;; public domain. The software is in the public domain and is
9 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
10 ;;;; files for more information.
12 (in-package "COMMON-LISP-USER")
14 ;;;; general warm init compilation policy
17 (proclaim '(optimize (compilation-speed 1)
18 (debug #+sb-show 2 #-sb-show 1)
26 ;;; Our cross-compilation host is out of the picture now, so we no
27 ;;; longer need to worry about collisions between our package names
28 ;;; and cross-compilation host package names, so now is a good time to
29 ;;; rename any package with a bootstrap-only name SB!FOO to its
30 ;;; permanent name SB-FOO.
32 ;;; (In principle it might be tidier to do this when dumping the cold
33 ;;; image in genesis, but in practice the logic might be a little
34 ;;; messier because genesis dumps both symbols and packages, and we'd
35 ;;; need to make sure that dumped symbols were renamed in the same way
36 ;;; as dumped packages. Or we could do it in cold init, but it's
37 ;;; easier to experiment with and debug things here in warm init than
38 ;;; in cold init, so we do it here instead.)
39 (let ((boot-prefix "SB!")
41 (dolist (package (list-all-packages))
42 (let ((old-package-name (package-name package)))
43 (when (and (>= (length old-package-name) (length boot-prefix))
44 (string= boot-prefix old-package-name
45 :end2 (length boot-prefix)))
46 (let ((new-package-name (concatenate 'string
48 (subseq old-package-name
49 (length boot-prefix)))))
50 (rename-package package
52 (package-nicknames package)))))))
54 ;;; FIXME: This nickname is a deprecated hack for backwards
55 ;;; compatibility with code which assumed the CMU-CL-style
56 ;;; SB-ALIEN/SB-C-CALL split. That split went away and was deprecated
57 ;;; in 0.7.0, so we should get rid of this nickname after a while.
58 (let ((package (find-package "SB-ALIEN")))
59 (rename-package package
60 (package-name package)
61 (cons "SB-C-CALL" (package-nicknames package))))
63 ;;; KLUDGE: This is created here (instead of in package-data-list.lisp-expr)
64 ;;; because it doesn't have any symbols in it, so even if it's
65 ;;; present at cold load time, genesis thinks it's unimportant
66 ;;; and doesn't dump it. There's gotta be a better way, but for now
67 ;;; I'll just do it here. (As noted below, I'd just as soon have this
68 ;;; go away entirely, so I'm disinclined to fiddle with it too much.)
71 ;;; FIXME: Why do slot accessor names need to be interned anywhere? For
72 ;;; low-level debugging? Perhaps this should go away, or at least
73 ;;; be optional, controlled by SB-SHOW or something.
74 (defpackage "SB-SLOT-ACCESSOR-NAME"
77 ;;;; compiling and loading more of the system
79 ;;; KLUDGE: In SBCL, almost all in-the-flow-of-control package hacking has
80 ;;; gone away in favor of package setup controlled by tables. However, that
81 ;;; mechanism isn't smart enough to handle shadowing, and since this shadowing
82 ;;; is inherently a non-ANSI KLUDGE anyway (i.e. there ought to be no
83 ;;; difference between e.g. CL:CLASS and SB-PCL:CLASS) there's not much
84 ;;; point in trying to polish it by implementing a non-KLUDGEy way of
85 ;;; setting it up. -- WHN 19991203
86 (let ((*package* (the package (find-package "SB-PCL"))))
87 (shadow '(;; CLASS itself and operations thereon
88 "CLASS" "CLASS-NAME" "CLASS-OF" "FIND-CLASS"
89 ;; some system classes
90 "BUILT-IN-CLASS" "STANDARD-CLASS" "STRUCTURE-CLASS"))
91 ;; Of the shadowing symbols above, these are external symbols in CMU CL ca.
92 ;; 19991203. I'm not sure what's the basis of the decision to export some and
93 ;; not others; we'll just follow along..
94 (export (mapcar #'intern '("CLASS-NAME" "CLASS-OF" "FIND-CLASS"))))
96 ;;; FIXME: CMU CL's pclcom.lisp had extra optional stuff wrapped around
97 ;;; COMPILE-PCL, at least some of which we should probably have too:
99 ;;; (with-compilation-unit
100 ;;; (:optimize '(optimize (debug #+(and (not high-security) small) .5
101 ;;; #-(or high-security small) 2
102 ;;; #+high-security 3)
103 ;;; (speed 2) (safety #+(and (not high-security) small) 0
104 ;;; #-(or high-security small) 2
105 ;;; #+high-security 3)
106 ;;; (inhibit-warnings 2))
107 ;;; :optimize-interface '(optimize-interface #+(and (not high-security) small)
109 ;;; #+high-security (safety 3))
110 ;;; :context-declarations
111 ;;; '((:external (declare (optimize-interface (safety #-high-security 2 #+high-
113 ;;; (debug #-high-security 1 #+high-s
115 ;;; ((:or :macro (:match "$EARLY-") (:match "$BOOT-"))
116 ;;; (declare (optimize (speed 0))))))
118 ;;; FIXME: This has mutated into a hack which crudely duplicates
119 ;;; functionality from the existing mechanism to load files from
120 ;;; build-order.lisp-expr, without being quite parallel. (E.g. object
121 ;;; files end up alongside the source files instead of ending up in
122 ;;; parallel directory trees.) Maybe we could merge the filenames here
123 ;;; into build-order.lisp-expr with some new flag (perhaps :WARM) to
124 ;;; indicate that the files should be handled not in cold load but
126 (dolist (stem '(;; CLOS, derived from the PCL reference implementation
128 ;; This PCL build order is based on a particular
129 ;; (arbitrary) linearization of the declared build
130 ;; order dependencies from the old PCL defsys.lisp
131 ;; dependency database.
135 "src/pcl/compiler-support"
152 "src/pcl/generic-functions"
163 "src/pcl/documentation"
164 "src/pcl/print-object"
168 ;; miscellaneous functionality which depends on CLOS
169 "src/code/force-delayed-defbangmethods"
171 ;; CLOS-level support for the Gray OO streams
172 ;; extension (which is also supported by various
173 ;; lower-level hooks elsewhere in the code)
174 "src/pcl/gray-streams-class"
175 "src/pcl/gray-streams"
177 ;; other functionality not needed for cold init, moved
178 ;; to warm init to reduce peak memory requirement in
181 "src/code/describe-policy"
186 "src/code/run-program"
188 ;; Code derived from PCL's pre-ANSI DESCRIBE-OBJECT
189 ;; facility is still used in our ANSI DESCRIBE
190 ;; facility, and should be compiled and loaded after
191 ;; our DESCRIBE facility is compiled and loaded.
194 (let ((fullname (concatenate 'string stem ".lisp")))
195 (sb-int:/show "about to compile" fullname)
197 (compiled-truename compilation-warnings-p compilation-failure-p)
198 (compile-file fullname)
199 (declare (ignore compilation-warnings-p))
200 (sb-int:/show "done compiling" fullname)
201 (cond (compilation-failure-p
202 (error "COMPILE-FILE of ~S failed." fullname))
204 (unless (load compiled-truename)
205 (error "LOAD of ~S failed." compiled-truename))
206 (sb-int:/show "done loading" compiled-truename))))))
208 ;;;; setting package documentation
210 ;;; While we were running on the cross-compilation host, we tried to
211 ;;; be portable and not overwrite the doc strings for the standard
212 ;;; packages. But now the cross-compilation host is only a receding
213 ;;; memory, and we can have our way with the doc strings.
214 (sb-int:/show "setting package documentation")
215 #+sb-doc (setf (documentation (find-package "COMMON-LISP") t)
216 "public: home of symbols defined by the ANSI language specification")
217 #+sb-doc (setf (documentation (find-package "COMMON-LISP-USER") t)
218 "public: the default package for user code and data")
219 #+sb-doc (setf (documentation (find-package "KEYWORD") t)
220 "public: home of keywords")
222 ;;; KLUDGE: It'd be nicer to do this in the table with the other
223 ;;; non-standard packages. -- WHN 19991206
224 #+sb-doc (setf (documentation (find-package "SB-SLOT-ACCESSOR-NAME") t)
225 "private: home of CLOS slot accessor internal names")
227 ;;; FIXME: There doesn't seem to be any easy way to get package doc strings
228 ;;; through the cold boot process. They need to be set somewhere. Maybe the
229 ;;; easiest thing to do is to read them out of package-data-list.lisp-expr