[f05756]: src / compiler / generic / parms.lisp Maximize Restore History

Download this file

parms.lisp    207 lines (186 with data), 7.7 kB

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