1 ;;;; This file contains some parameterizations of various VM
2 ;;;; attributes common to all architectures.
4 ;;;; This software is part of the SBCL system. See the README file for
7 ;;;; This software is derived from the CMU CL system, which was
8 ;;;; written at Carnegie Mellon University and released into the
9 ;;;; public domain. The software is in the public domain and is
10 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
11 ;;;; files for more information.
15 (def!macro !configure-dynamic-space-end (&optional default)
16 (with-open-file (f "output/dynamic-space-size.txt")
17 (let ((line (read-line f)))
18 (multiple-value-bind (number end)
19 (parse-integer line :junk-allowed t)
21 (let* ((ext (subseq line end))
22 (mult (cond ((or (zerop (length ext))
23 (member ext '("MB MIB") :test #'equalp))
25 ((member ext '("GB" "GIB") :test #'equalp)
28 (error "Invalid --dynamic-space-size=~A" line)))))
29 `(+ dynamic-space-start ,(* number mult)))
31 `(+ dynamic-space-start
34 (64 (expt 2 30))))))))))
37 ;; Define START/END constants for GENCGC spaces.
39 ;; We only need very small read-only and static spaces, because
40 ;; gencgc does not purify any more. We can count on being able to
41 ;; allocate them with roughly the same size, and next to each other.
43 ;; There is one page of unmapped buffer between them for good measure.
45 ;; The linkage table (if enabled) can be treated the same way.
47 ;; Dynamic space traditionally sits elsewhere, so has its own
48 ;; parameter. But if not specified, it is allocated right after
49 ;; the other spaces (used on Windows/x86).
51 ;; The safepoint page (if enabled) is to be allocated immediately
52 ;; prior to static page. For x86(-64) this would not matter, because
53 ;; they can only reference it using an absolute fixup anyway, but
54 ;; for RISC platforms we can (and must) do better.
56 ;; The safepoint page needs to be small enough that the offset from
57 ;; static space is immediate, e.g. >= -2^12 for SPARC. #x1000 works
58 ;; for almost all platforms, but is too small to make VirtualProtect
59 ;; happy -- hence the need for an extra `alignment' configuration
60 ;; option below, which parms.lisp can set to #x10000 on Windows.
64 ;; In the interest of readability, &KEY would be much nicer than
65 ;; &OPTIONAL. But is it possible to use keyword arguments to
68 (def!macro !gencgc-space-setup
70 &optional dynamic-space-start*
71 default-dynamic-space-size
72 ;; Smallest os_validate()able alignment; used as safepoint
73 ;; page size. Default suitable for POSIX platforms.
75 ;; traditional distance between spaces -- including the margin:
76 (small-space-spread #x100000)
77 ;; traditional margin between spaces
79 (let* ((spaces '(read-only static #!+linkage-table linkage-table))
80 (ptr small-spaces-start)
83 (loop for (space next-space) on spaces appending
84 (let* ((next-start (+ ptr small-space-spread))
86 (when (eq next-space 'static)
87 ;; margin becomes safepoint page; substract margin again.
89 (setf safepoint-address end))
91 `((def!constant ,(symbolicate space "-SPACE-START")
93 (def!constant ,(symbolicate space "-SPACE-END")
94 ,(- end margin-size)))
95 (setf ptr next-start)))))
98 `(def!constant gc-safepoint-page-addr ,safepoint-address)))
99 (dynamic-space-start* (or dynamic-space-start* ptr))
100 (optional-dynamic-space-end
101 (when default-dynamic-space-size
102 (list (+ dynamic-space-start* default-dynamic-space-size)))))
104 ,@safepoint-page-forms
106 (def!constant dynamic-space-start ,dynamic-space-start*)
107 (def!constant dynamic-space-end (!configure-dynamic-space-end
108 ,@optional-dynamic-space-end)))))
110 (defparameter *c-callable-static-symbols*
113 sb!kernel::internal-error
114 sb!kernel::control-stack-exhausted-error
115 sb!kernel::binding-stack-exhausted-error
116 sb!kernel::alien-stack-exhausted-error
117 sb!kernel::heap-exhausted-error
118 sb!kernel::undefined-alien-variable-error
119 sb!kernel::undefined-alien-function-error
120 sb!kernel::memory-fault-error
121 sb!kernel::unhandled-trap-error
122 sb!di::handle-breakpoint
123 sb!di::handle-single-step-trap
125 #!+win32 sb!kernel::handle-win32-exception
126 #!+sb-thruption sb!thread::run-interruption
127 #!+sb-safepoint sb!thread::enter-foreign-callback
128 #!+(and sb-safepoint-strictly (not win32))
129 sb!unix::signal-handler-callback))
131 (defparameter *common-static-symbols*
134 ;; filled in by the C code to propagate to Lisp
135 *posix-argv* *core-string*
137 ;; free pointers. Note that these are FIXNUM word counts, not (as
138 ;; one might expect) byte counts or SAPs. The reason seems to be
139 ;; that by representing them this way, we can avoid consing
140 ;; bignums. -- WHN 2000-10-02
141 *read-only-space-free-pointer*
142 *static-space-free-pointer*
144 ;; things needed for non-local-exit
145 *current-catch-block*
146 *current-unwind-protect-block*
151 *binding-stack-start*
152 *control-stack-start*
155 ;; interrupt handling
157 *free-interrupt-context-index*
158 sb!unix::*allow-with-interrupts*
159 sb!unix::*interrupts-enabled*
160 sb!unix::*interrupt-pending*
161 #!+sb-thruption sb!unix::*thruption-pending*
162 #!+sb-thruption sb!impl::*restart-clusters*
163 sb!vm::*in-without-gcing*
168 #!+sb-safepoint sb!impl::*gc-safe*
169 #!+sb-safepoint sb!impl::*in-safepoint*
172 #!+sb-thread *stop-for-gc-pending*
173 #!+sb-thread *free-tls-index*
174 #!+sb-thread *tls-index-lock*
176 ;; dynamic runtime linking support
177 #!+sb-dynamic-core *required-runtime-c-symbols*
178 sb!kernel::*gc-epoch*
180 ;; Dispatch tables for generic array access
181 sb!impl::%%data-vector-reffers%%
182 sb!impl::%%data-vector-reffers/check-bounds%%
183 sb!impl::%%data-vector-setters%%
184 sb!impl::%%data-vector-setters/check-bounds%%
186 ;; non-x86oid gencgc object pinning
187 #!+(and gencgc (not (or x86 x86-64)))
190 ;; hash table weaknesses
196 ;;; Number of entries in the thread local storage. Limits the number
197 ;;; of symbols with thread local bindings.
198 (def!constant tls-size 4096)
202 (def!constant +highest-normal-generation+ 5)
203 (def!constant +pseudo-static-generation+ 6))
207 trace-table-call-site
208 trace-table-fun-prologue
209 trace-table-fun-epilogue)