0.9.3.41: gc trigger
[sbcl/eslaughter.git] / src / compiler / alpha / parms.lisp
blobbd2780899867d217ca596c066b74ba6124128011
1 ;;;; This software is part of the SBCL system. See the README file for
2 ;;;; more information.
3 ;;;;
4 ;;;; This software is derived from the CMU CL system, which was
5 ;;;; written at Carnegie Mellon University and released into the
6 ;;;; public domain. The software is in the public domain and is
7 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
8 ;;;; files for more information.
10 (in-package "SB!VM")
12 (eval-when (:compile-toplevel :load-toplevel :execute)
14 ;;; number of bits per word where a word holds one lisp descriptor
15 (def!constant n-word-bits 32)
17 ;;; the natural width of a machine word (as seen in e.g. register width,
18 ;;; address space)
19 (def!constant n-machine-word-bits 64)
21 ;;; number of bits per byte where a byte is the smallest addressable
22 ;;; object
23 (def!constant n-byte-bits 8)
25 (def!constant float-sign-shift 31)
27 (def!constant single-float-bias 126)
28 (defconstant-eqx single-float-exponent-byte (byte 8 23) #'equalp)
29 (defconstant-eqx single-float-significand-byte (byte 23 0) #'equalp)
30 (def!constant single-float-normal-exponent-min 1)
31 (def!constant single-float-normal-exponent-max 254)
32 (def!constant single-float-hidden-bit (ash 1 23))
33 (def!constant single-float-trapping-nan-bit (ash 1 22))
35 (def!constant double-float-bias 1022)
36 (defconstant-eqx double-float-exponent-byte (byte 11 20) #'equalp)
37 (defconstant-eqx double-float-significand-byte (byte 20 0) #'equalp)
38 (def!constant double-float-normal-exponent-min 1)
39 (def!constant double-float-normal-exponent-max #x7FE)
40 (def!constant double-float-hidden-bit (ash 1 20))
41 (def!constant double-float-trapping-nan-bit (ash 1 19))
43 (def!constant single-float-digits
44 (+ (byte-size single-float-significand-byte) 1))
46 (def!constant double-float-digits
47 (+ (byte-size double-float-significand-byte) n-word-bits 1))
49 ;;; These values are originally from the DEC Assembly Language
50 ;;; Programmers guide. Where possible we read/write the software
51 ;;; fp_control word, which apparently is necessary for the OS FPU
52 ;;; completion (OS handler which fixes up non-IEEE answers that the
53 ;;; hardware occasionally gives us) to work properly. The rounding
54 ;;; mode, however, can't be set that way, so we have to deal with that
55 ;;; directly. (FIXME: we actually don't suport setting the rounding mode
56 ;;; at the moment anyway)
58 ;;; Short guide to floating point trap terminology: an "exception" is
59 ;;; cheap and can happen at almost any time. An exception will only
60 ;;; generate a trap if that trap is enabled, otherwise a default value
61 ;;; will be substituted. A "trap" will end up somewhere in the
62 ;;; kernel, which may play by its own rules, (on Alpha it allegedly
63 ;;; actually fixes up some non-IEEE compliant results to get the
64 ;;; _right_ answer) but if something is really wrong will eventually
65 ;;; signal SIGFPE and let us sort it out.
67 ;;; Old comment follows: The active bits are actually in (byte 12 52)
68 ;;; of the fpcr. (byte 6 52) contain the exception flags. Bit 63 is the
69 ;;; bitwise logor of all exceptions. The enable and exception bytes
70 ;;; are in a software control word manipulated via OS functions and the
71 ;;; bits in the SCP match those defs. This mapping follows
72 ;;; <machine/fpu.h>
74 ;;; trap enables are set in software (fp_control)
75 (def!constant float-inexact-trap-bit (ash 1 4)) ; rw
76 (def!constant float-underflow-trap-bit (ash 1 3)) ; rw
77 (def!constant float-overflow-trap-bit (ash 1 2)) ; ro
78 (def!constant float-divide-by-zero-trap-bit (ash 1 1)) ; ro
79 (def!constant float-invalid-trap-bit (ash 1 0)) ; ro
80 (defconstant-eqx float-traps-byte (byte 6 1) #'equalp)
82 ;;; exceptions are also read/written in software (by syscalls, no less).
83 ;;; This is kind of dumb, but has to be done
84 (defconstant-eqx float-sticky-bits (byte 6 17) #'equalp) ; fp_control
86 ;;; (We don't actually _have_ "current exceptions" on Alpha; the
87 ;;; hardware only ever sets bits. So, set this the same as accrued
88 ;;; exceptions)
89 (defconstant-eqx float-exceptions-byte (byte 6 17) #'equalp)
91 ;;; Rounding modes can only be set by frobbing the hardware fpcr directly
92 (def!constant float-round-to-zero 0)
93 (def!constant float-round-to-negative 1)
94 (def!constant float-round-to-nearest 2)
95 (def!constant float-round-to-positive 3)
96 (defconstant-eqx float-rounding-mode (byte 2 58) #'equalp)
98 ;;; Miscellaneous stuff - I think it's far to say that you deserve
99 ;;; what you get if you ask for fast mode.
100 (def!constant float-fast-bit 0)
102 ); eval-when
106 ;;;; Description of the target address space.
108 ;;; Where to put the different spaces.
111 #!+linux
112 (progn
113 (def!constant read-only-space-start #x20000000)
114 (def!constant read-only-space-end #x24000000))
116 #!+osf1
117 (progn
118 (defconstant read-only-space-start #x10000000)
119 (defconstant read-only-space-end #x25000000))
122 (def!constant static-space-start #x28000000)
123 (def!constant static-space-end #x2c000000)
125 (def!constant dynamic-0-space-start #x30000000)
126 (def!constant dynamic-0-space-end #x3fff0000)
128 (def!constant dynamic-1-space-start #x40000000)
129 (def!constant dynamic-1-space-end #x4fff0000)
131 ;;; FIXME nothing refers to either of these in alpha or x86 cmucl
132 ;;; backend, so they could probably be removed.
134 ;; The space-register holding the lisp heap.
135 (def!constant lisp-heap-space 4)
137 ;; The space-register holding the C text segment.
138 (def!constant c-text-space 4)
140 ;;; the X86 port defines *nil-value* as (+ *target-static-space-start* #xB)
141 ;;; here, but it seems to be the only port that needs to know the
142 ;;; location of NIL from lisp.
144 ;;;; other miscellaneous constants
146 (defenum (:suffix -trap :start 8)
147 halt
148 pending-interrupt
149 error
150 cerror
151 breakpoint
152 fun-end-breakpoint
153 single-step-breakpoint)
155 (defenum (:prefix trace-table-)
156 normal
157 call-site
158 fun-prologue
159 fun-epilogue)
161 ;;;; static symbols
163 ;;; These symbols are loaded into static space directly after NIL so
164 ;;; that the system can compute their address by adding a constant
165 ;;; amount to NIL.
167 ;;; The fdefn objects for the static functions are loaded into static
168 ;;; space directly after the static symbols. That way, the raw-addr
169 ;;; can be loaded directly out of them by indirecting relative to NIL.
171 (defparameter *static-symbols*
174 ;; The C startup code must fill these in.
175 *posix-argv*
177 ;; functions that the C code needs to call
178 sub-gc
179 sb!kernel::internal-error
180 sb!kernel::control-stack-exhausted-error
181 sb!kernel::undefined-alien-variable-error
182 sb!kernel::undefined-alien-function-error
183 sb!di::handle-breakpoint
184 sb!di::handle-fun-end-breakpoint
186 ;; free pointers
187 *read-only-space-free-pointer*
188 *static-space-free-pointer*
189 *initial-dynamic-space-free-pointer*
191 ;; things needed for non-local exit
192 *current-catch-block*
193 *current-unwind-protect-block*
195 *binding-stack-start*
196 *control-stack-start*
197 *control-stack-end*
199 ;; interrupt handling
200 *free-interrupt-context-index*
201 sb!unix::*interrupts-enabled*
202 sb!unix::*interrupt-pending*
203 *gc-inhibit*
204 *gc-pending*))
206 (defparameter *static-funs*
207 '(length
208 sb!kernel:two-arg-+
209 sb!kernel:two-arg--
210 sb!kernel:two-arg-*
211 sb!kernel:two-arg-/
212 sb!kernel:two-arg-<
213 sb!kernel:two-arg->
214 sb!kernel:two-arg-=
215 ;; FIXME: Is this
216 ;; probably need the following as they are defined in
217 ;; arith.lisp: two-arg-<= two-arg->= two-arg-/=
218 ;; a comment from old CMU CL or old old CMU CL or
219 ;; the SBCL alpha port or what? Do we need to worry about it,
220 ;; or can we delete it?
221 sb!kernel:two-arg-/=
223 sb!kernel:%negate
224 sb!kernel:two-arg-and
225 sb!kernel:two-arg-ior
226 sb!kernel:two-arg-xor
227 sb!kernel:two-arg-eqv
228 sb!kernel:two-arg-gcd
229 sb!kernel:two-arg-lcm))