Add safepoint mechanism
[sbcl.git] / src / compiler / generic / parms.lisp
1 ;;;; This file contains some parameterizations of various VM
2 ;;;; attributes common to all architectures.
3
4 ;;;; This software is part of the SBCL system. See the README file for
5 ;;;; more information.
6 ;;;;
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.
12
13 (in-package "SB!VM")
14
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)
20         (if number
21             (let* ((ext (subseq line end))
22                    (mult (cond ((or (zerop (length ext))
23                                     (member ext '("MB MIB") :test #'equalp))
24                                 (expt 2 20))
25                                ((member ext '("GB" "GIB") :test #'equalp)
26                                 (expt 2 30))
27                                (t
28                                 (error "Invalid --dynamic-space-size=~A" line)))))
29               `(+ dynamic-space-start ,(* number mult)))
30             (or default
31                 `(+ dynamic-space-start
32                     (ecase n-word-bits
33                       (32 (expt 2 29))
34                       (64 (expt 2 30))))))))))
35
36 (defparameter *c-callable-static-symbols*
37   '(sub-gc
38     sb!kernel::post-gc
39     sb!kernel::internal-error
40     sb!kernel::control-stack-exhausted-error
41     sb!kernel::binding-stack-exhausted-error
42     sb!kernel::alien-stack-exhausted-error
43     sb!kernel::heap-exhausted-error
44     sb!kernel::undefined-alien-variable-error
45     sb!kernel::undefined-alien-function-error
46     sb!kernel::memory-fault-error
47     sb!kernel::unhandled-trap-error
48     sb!di::handle-breakpoint
49     sb!di::handle-single-step-trap
50     fdefinition-object
51     #!+win32 sb!kernel::handle-win32-exception))
52
53 (defparameter *common-static-symbols*
54   '(t
55
56     ;; filled in by the C code to propagate to Lisp
57     *posix-argv* *core-string*
58
59     ;; free pointers.  Note that these are FIXNUM word counts, not (as
60     ;; one might expect) byte counts or SAPs. The reason seems to be
61     ;; that by representing them this way, we can avoid consing
62     ;; bignums.  -- WHN 2000-10-02
63     *read-only-space-free-pointer*
64     *static-space-free-pointer*
65
66     ;; things needed for non-local-exit
67     *current-catch-block*
68     *current-unwind-protect-block*
69
70     #!+hpux *c-lra*
71
72     ;; stack pointers
73     *binding-stack-start*
74     *control-stack-start*
75     *control-stack-end*
76
77     ;; interrupt handling
78     *alloc-signal*
79     *free-interrupt-context-index*
80     sb!unix::*allow-with-interrupts*
81     sb!unix::*interrupts-enabled*
82     sb!unix::*interrupt-pending*
83     *in-without-gcing*
84     *gc-inhibit*
85     *gc-pending*
86     #!-sb-thread
87     *stepping*
88     #!+sb-safepoint sb!impl::*gc-safe*
89     #!+sb-safepoint sb!impl::*in-safepoint*
90
91     ;; threading support
92     #!+sb-thread *stop-for-gc-pending*
93     #!+sb-thread *free-tls-index*
94     #!+sb-thread *tls-index-lock*
95
96     ;; Dispatch tables for generic array access
97     sb!impl::%%data-vector-reffers%%
98     sb!impl::%%data-vector-reffers/check-bounds%%
99     sb!impl::%%data-vector-setters%%
100     sb!impl::%%data-vector-setters/check-bounds%%
101
102     ;; non-x86oid gencgc object pinning
103     #!+(and gencgc (not (or x86 x86-64)))
104     *pinned-objects*
105
106     ;; hash table weaknesses
107     :key
108     :value
109     :key-and-value
110     :key-or-value))
111
112 ;;; Number of entries in the thread local storage. Limits the number
113 ;;; of symbols with thread local bindings.
114 (def!constant tls-size 4096)
115
116 #!+gencgc
117 (progn
118   (def!constant +highest-normal-generation+ 5)
119   (def!constant +pseudo-static-generation+ 6))
120
121 (defenum ()
122   trace-table-normal
123   trace-table-call-site
124   trace-table-fun-prologue
125   trace-table-fun-epilogue)