Fix allocate-instance working on symbols.
[sbcl.git] / make-target-2-load.lisp
blob4f2db651a3330e2a6d99914d4b204ef628cdafb9
1 ;;; Do warm init without compiling files.
2 (progn
3 (defvar *compile-files-p* nil)
4 "about to LOAD warm.lisp (with *compile-files-p* = NIL)")
5 (let ((*print-length* 10)
6 (*print-level* 5)
7 (*print-circle* t))
8 (load "src/cold/warm.lisp")
10 ;; Share identical FUN-INFOs
11 sb-int::
12 (let ((ht (make-hash-table :test 'equalp))
13 (old-count 0))
14 (sb-c::call-with-each-globaldb-name
15 (lambda (name)
16 (binding* ((info (info :function :info name) :exit-if-null)
17 (shared-info (gethash info ht info)))
18 (incf old-count)
19 (if (eq info shared-info)
20 (setf (gethash info ht) info)
21 (setf (info :function :info name) shared-info)))))
22 (format t "~&FUN-INFO: Collapsed ~D -> ~D~%"
23 old-count (hash-table-count ht)))
25 ;; Share identical FUN-TYPEs.
26 (let ((ht (make-hash-table :test 'equal))
27 (raw-accessor
28 (compile nil '(lambda (f) (sb-vm::%%simple-fun-type f)))))
29 (sb-vm::map-allocated-objects
30 (lambda (obj type size)
31 (declare (ignore type size))
32 (when (sb-kernel:code-component-p obj)
33 (do ((f (sb-kernel:%code-entry-points obj)
34 (sb-kernel:%simple-fun-next f)))
35 ((null f))
36 (let ((type (funcall raw-accessor f)))
37 (setf (sb-kernel:%simple-fun-type f)
38 (or (gethash type ht) (setf (gethash type ht) type)))))))
39 :dynamic))
41 (sb-disassem::!compile-inst-printers)
43 ;; Unintern no-longer-needed stuff before the possible PURIFY in
44 ;; SAVE-LISP-AND-DIE.
45 #-sb-fluid (sb-impl::!unintern-init-only-stuff)
47 ;; A symbol whose INFO slot underwent any kind of manipulation
48 ;; such that it now has neither properties nor globaldb info,
49 ;; can have the slot set back to NIL if it wasn't already.
50 (do-all-symbols (symbol)
51 (when (and (sb-kernel:symbol-info symbol)
52 (null (sb-kernel:symbol-info-vector symbol))
53 (null (symbol-plist symbol)))
54 (setf (sb-kernel:symbol-info symbol) nil)))
56 "done with warm.lisp, about to GC :FULL T")
57 (sb-ext:gc :full t)
59 ;;; resetting compilation policy to neutral values in preparation for
60 ;;; SAVE-LISP-AND-DIE as final SBCL core (not in warm.lisp because
61 ;;; SB-C::*POLICY* has file scope)
62 (setq sb-c::*policy* (copy-structure sb-c::**baseline-policy**))
64 ;;; Lock internal packages
65 #+sb-package-locks
66 (dolist (p (list-all-packages))
67 (unless (member p (mapcar #'find-package '("KEYWORD" "CL-USER")))
68 (sb-ext:lock-package p)))
70 "done with warm.lisp, about to SAVE-LISP-AND-DIE"
71 ;;; Even if /SHOW output was wanted during build, it's probably
72 ;;; not wanted by default after build is complete. (And if it's
73 ;;; wanted, it can easily be turned back on.)
74 #+sb-show (setf sb-int:*/show* nil)
75 ;;; The system is complete now, all standard functions are
76 ;;; defined.
77 ;;; The call to CTYPE-OF-CACHE-CLEAR is probably redundant.
78 ;;; SAVE-LISP-AND-DIE calls DEINIT which calls DROP-ALL-HASH-CACHES.
79 (sb-kernel::ctype-of-cache-clear)
80 (setq sb-c::*flame-on-necessarily-undefined-thing* t)
82 ;;; Clean up stray symbols from the CL-USER package.
83 (with-package-iterator (iter "CL-USER" :internal :external)
84 (loop (multiple-value-bind (winp symbol) (iter)
85 (if winp (unintern symbol "CL-USER") (return)))))
87 #+sb-fasteval (setq sb-ext:*evaluator-mode* :interpret)
88 (sb-ext:save-lisp-and-die "output/sbcl.core")