1 ;;;; needed-early stuff for the loader
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 "SB!IMPL")
14 ;;; information about non-Lisp-level linkage
17 ;;; Assembler routines are named by full Lisp symbols: they
18 ;;; have packages and that sort of native Lisp stuff associated
19 ;;; with them. We can compare them with EQ.
20 ;;; Foreign symbols are named by Lisp strings: the Lisp package
21 ;;; system doesn't extend out to symbols in languages like C.
22 ;;; We want to use EQUAL to compare them.
23 ;;; *STATIC-FOREIGN-SYMBOLS* are static as opposed to "dynamic" (not
24 ;;; as opposed to "extern"). The table contains symbols known at
25 ;;; the time that the program was built, but not symbols defined
26 ;;; in object files which have been loaded dynamically since then.
27 (declaim (type hash-table *assembler-routines* *static-foreign-symbols*))
28 (defvar *assembler-routines* (make-hash-table :test 'eq))
29 (defvar *static-foreign-symbols* (make-hash-table :test 'equal))
32 (defvar *fop-names* (make-array 256 :initial-element nil)
34 "a vector indexed by a FaslOP that yields the FOP's name")
35 (defvar *fop-functions*
37 :initial-element (lambda ()
38 (error "corrupt fasl file: losing FOP")))
40 "a vector indexed by a FaslOP that yields a function of 0 arguments which
41 will perform the operation")
42 (declaim (simple-vector *fop-names* *fop-functions*))
44 (defvar *load-code-verbose* nil)
46 ;;; Moving native code during a GC or purify is not trivial on the x86
47 ;;; port, so there are a few options for code placement.
49 ;;; Byte-compiled code objects can always be moved so can be place in
50 ;;; the dynamics heap. This is enabled with
51 ;;; *load-byte-compiled-code-to-dynamic-space*.
52 ;;; FIXME: See whether this really works. Also, now that we have gencgc
53 ;;; and all code moves, perhaps we could just remove this conditional
54 ;;; and make this fixed behavior.
56 ;;; Native code top level forms only have a short life so can be
57 ;;; safely loaded into the dynamic heap (without fixups) so long as
58 ;;; the GC is not active. This could be handy during a world load to
59 ;;; save core space without the need to enable the support for moving
60 ;;; x86 native code. Enable with *load-x86-tlf-to-dynamic-space*.
61 ;;; FIXME: Yikes! Could we punt this?
63 ;;; One strategy for allowing the loading of x86 native code into the
64 ;;; dynamic heap requires that the addresses of fixups be saved for
65 ;;; all these code objects. After a purify these fixups can be
66 ;;; dropped. This is enabled with *enable-dynamic-space-code*.
68 ;;; A little analysis of the header information is used to determine
69 ;;; if a code object is byte compiled, or native code.
70 (defvar *load-byte-compiled-code-to-dynamic-space* t)
71 (defvar *load-x86-tlf-to-dynamic-space* nil) ; potentially dangerous with CGC.
72 ; KLUDGE: Yikes squared!
73 (defvar *enable-dynamic-space-code* #!-gencgc nil #!+gencgc t)
74 ;;; FIXME: I think all of these should go away. I can't see a good reason
75 ;;; not to just make everything relocatable.