1 ;;;; This file contains machinery for collecting forms that, in the
2 ;;;; target Lisp, must happen before top level forms are run. The
3 ;;;; forms are stuffed into named functions which will be explicitly
4 ;;;; called in the appropriate order by !COLD-INIT.
6 ;;;; This software is part of the SBCL system. See the README file for
9 ;;;; This software is derived from the CMU CL system, which was
10 ;;;; written at Carnegie Mellon University and released into the
11 ;;;; public domain. The software is in the public domain and is
12 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
13 ;;;; files for more information.
15 (in-package "SB!KERNEL")
16 ;;; FIXME: Perhaps this belongs in the %SYS package like some other
19 (eval-when (:compile-toplevel
:load-toplevel
:execute
)
20 (defvar *cold-init-forms
*))
22 (defmacro !begin-collecting-cold-init-forms
()
23 #+sb-xc
'(eval-when (:compile-toplevel
:execute
)
24 (when (boundp '*cold-init-forms
*)
25 (warn "discarding old *COLD-INIT-FORMS* value"))
26 (setf *cold-init-forms
* nil
))
29 ;;; Note: Unlike the analogous COLD-INIT macro in CMU CL, this macro
30 ;;; makes no attempt to simulate a top level situation by treating
31 ;;; EVAL-WHEN forms specially.
32 (defmacro !cold-init-forms
(&rest forms
)
33 ;; In the target Lisp, stuff the forms into a named function which
34 ;; will presumably be executed at the appropriate stage of cold load
35 ;; (i.e. basically as soon as possible).
37 (setf *cold-init-forms
*
38 (nconc *cold-init-forms
* (copy-list forms
)))
40 ;; In the cross-compilation host Lisp, cold load might not be a
41 ;; meaningful concept and in any case would have happened long ago,
42 ;; so just execute the forms at load time (i.e. basically as soon as
44 #-sb-xc
`(progn ,@forms
))
46 (defmacro !defun-from-collected-cold-init-forms
(name)
51 (eval-when (:compile-toplevel
:execute
)
52 (makunbound '*cold-init-forms
*)))
53 #-sb-xc
(declare (ignore name
)))
55 ;;; FIXME: Consider renaming this file asap.lisp,
56 ;;; and the renaming the various things
57 ;;; *ASAP-FORMS* or *REVERSED-ASAP-FORMS*
59 ;;; ASAP or EVAL-WHEN-COLD-LOAD
60 ;;; DEFUN-FROM-ASAP-FORMS
61 ;;; If so, add a comment explaining that ASAP is colloquial English for "as
62 ;;; soon as possible", and has nothing to do with "system area pointer".