Stop CMUCL from influencing how POSITION is used.
[sbcl.git] / src / compiler / x86-64 / parms.lisp
blob9a23f86986332c7c3f3a6418520b9fb29b6339ed
1 ;;;; This file contains some parameterizations of various VM
2 ;;;; attributes for the x86. This file is separate from other stuff so
3 ;;;; that it can be compiled and loaded earlier.
5 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; more information.
7 ;;;;
8 ;;;; This software is derived from the CMU CL system, which was
9 ;;;; written at Carnegie Mellon University and released into the
10 ;;;; public domain. The software is in the public domain and is
11 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
12 ;;;; files for more information.
14 (in-package "SB-VM")
16 (defconstant sb-assem:assem-scheduler-p nil)
17 (defconstant sb-assem:+inst-alignment-bytes+ 1)
19 (defconstant sb-fasl:+backend-fasl-file-implementation+ :x86-64)
20 (defconstant-eqx +fixup-kinds+ #(:abs32 :*abs32 :rel32 :absolute) #'equalp)
22 ;;; This size is supposed to indicate something about the actual granularity
23 ;;; at which you can map memory. We just hardwire it, but that may or may not
24 ;;; be necessary any more.
25 (defconstant +backend-page-bytes+ #+win32 65536 #-win32 32768)
27 ;;; The size in bytes of GENCGC pages. A page is the smallest amount of memory
28 ;;; that a thread can claim for a thread-local region, and also determines
29 ;;; the granularity at which we can find the start of a sequence of objects.
30 (defconstant gencgc-page-bytes 32768)
31 ;;; The divisor relative to page-bytes which computes the granularity
32 ;;; at which writes to old generations are logged.
33 #+soft-card-marks (defconstant cards-per-page
34 #+mark-region-gc (/ gencgc-page-bytes 128)
35 #-mark-region-gc 32)
36 ;;; The minimum size of new allocation regions. While it doesn't
37 ;;; currently make a lot of sense to have a card size lower than
38 ;;; the alloc granularity, it will, once we are smarter about finding
39 ;;; the start of objects.
40 (defconstant gencgc-alloc-granularity 0)
41 ;;; The card size for immobile/low space
42 (defconstant immobile-card-bytes 4096)
44 ;;; ### Note: 'lispword' always means 8 bytes, and 'word' usually means
45 ;;; the same as 'lispword', except in the assembler and disassembler,
46 ;;; where 'word' means 2 bytes to match AMD/Intel terminology.
48 ;;;; machine architecture parameters
50 ;;; the number of bits per word, where a word holds one lisp descriptor
51 (defconstant n-word-bits 64)
53 ;;; the natural width of a machine word (as seen in e.g. register width,
54 ;;; address space)
55 (defconstant n-machine-word-bits 64)
57 ;;; from AMD64 Architecture manual
58 (defconstant float-invalid-trap-bit (ash 1 0))
59 (defconstant float-denormal-trap-bit (ash 1 1))
60 (defconstant float-divide-by-zero-trap-bit (ash 1 2))
61 (defconstant float-overflow-trap-bit (ash 1 3))
62 (defconstant float-underflow-trap-bit (ash 1 4))
63 (defconstant float-inexact-trap-bit (ash 1 5))
65 (defconstant float-round-to-nearest 0)
66 (defconstant float-round-to-negative 1)
67 (defconstant float-round-to-positive 2)
68 (defconstant float-round-to-zero 3)
70 (defconstant-eqx float-rounding-mode (byte 2 13) #'equalp)
71 (defconstant-eqx float-sticky-bits (byte 6 0) #'equalp)
72 (defconstant-eqx float-traps-byte (byte 6 7) #'equalp)
73 (defconstant-eqx float-exceptions-byte (byte 6 0) #'equalp)
74 (defconstant float-fast-bit 0) ; no fast mode on x86-64
76 ;;;; description of the target address space
78 ;;; where to put the different spaces.
80 ;;; Currently the read-only and static spaces must be located in low
81 ;;; memory (certainly under the 4GB limit, very probably under 2GB
82 ;;; limit). This is due to the inability of using immediate values of
83 ;;; more than 32 bits (31 bits if you take sign extension into
84 ;;; account) in any other instructions except MOV. Removing this limit
85 ;;; would be possible, but probably not worth the time and code bloat
86 ;;; it would cause. -- JES, 2005-12-11
88 #+(or linux darwin)
89 (gc-space-setup #x50000000
90 :read-only-space-size 0
91 :fixedobj-space-size #.(* 60 1024 1024)
92 :text-space-size #.(* 160 1024 1024)
93 :text-space-start #xB800000000
94 :dynamic-space-start #x1000000000)
96 ;;; The default dynamic space size is lower on OpenBSD to allow SBCL to
97 ;;; run under the default 1G data size limit.
99 #-(or linux darwin)
100 (gc-space-setup #x20000000
101 :read-only-space-size 0
102 :fixedobj-space-size #.(* 60 1024 1024)
103 :text-space-size #.(* 130 1024 1024)
104 :text-space-start #x1000000000
105 :dynamic-space-start #x1100000000
106 #+openbsd :dynamic-space-size #+openbsd #x2fff0000)
108 (defconstant alien-linkage-table-growth-direction :up)
109 (defconstant alien-linkage-table-entry-size 16)
111 #+(and sb-xc-host (not immobile-space))
112 (defparameter lisp-linkage-space-addr #x1500000000) ; arbitrary
113 #+(and sb-xc-host immobile-space)
114 (progn
115 (defparameter lisp-linkage-space-addr
116 ;; text space:
117 ;; | ALIEN LINKAGE | LISP LINKAGE | CODE OBJECTS ...
118 ;; |<------------->|<------------>| ....
119 (- text-space-start (* (ash 1 n-linkage-index-bits) 8)))
120 (defparameter alien-linkage-space-start (- lisp-linkage-space-addr alien-linkage-space-size)))
122 (defenum (:start 8)
123 halt-trap
124 pending-interrupt-trap
125 cerror-trap
126 breakpoint-trap
127 fun-end-breakpoint-trap
128 single-step-around-trap
129 single-step-before-trap
130 invalid-arg-count-trap
131 memory-fault-emulation-trap
132 #+sb-safepoint global-safepoint-trap
133 #+sb-safepoint csp-safepoint-trap
134 uninitialized-load-trap
135 ;; ERROR-TRAP has to be numerically highest.
136 ;; The various internal errors are numbered from here upward.
137 error-trap)
139 ;;;; static symbols
141 ;;; These symbols are loaded into static space directly after NIL so
142 ;;; that the system can compute their address by adding a constant
143 ;;; amount to NIL.
145 ;;; The fdefn objects for the static functions are loaded into static
146 ;;; space directly after the static symbols. That way, the raw-addr
147 ;;; can be loaded directly out of them by indirecting relative to NIL.
149 ;;; we could profitably keep these in registers on x86-64 now we have
150 ;;; r8-r15 as well
151 ;;; Note these spaces grow from low to high addresses.
152 (defvar *binding-stack-pointer*)
154 ;;; Bit indices into *CPU-FEATURE-BITS*
155 (defconstant cpu-has-ymm-registers 0)
156 (defconstant cpu-has-popcnt 1)
158 (defconstant-eqx +static-symbols+
159 `#(,@+common-static-symbols+
160 #+(and immobile-space (not sb-thread)) function-layout
161 ;; I had trouble making alien_stack_pointer use the thread slot for #-sb-thread
162 ;; because WITH-ALIEN binds SB-C:*ALIEN-STACK-POINTER* in an ordinary LET.
163 ;; That being so, it has to use the #-sb-thread mechanism of placing the new value
164 ;; in the symbol's value slot for compatibility with UNBIND and all else.
165 #-sb-thread *alien-stack-pointer* ; a thread slot if #+sb-thread
166 ;; Since the text space and alien linkage table might both get relocated on startup
167 ;; under #+immobile-space, an alien callback wrapper can't wire in the address
168 ;; of a word that holds the C function pointer to callback_wrapper_trampoline.
169 ;; (There is no register that points to a known address when entering the callback)
170 ;; A static symbol works well for this, and is sensible considering that
171 ;; the assembled wrappers also reside in static space.
172 #+(and sb-thread immobile-space) callback-wrapper-trampoline
173 *cpu-feature-bits*)
174 #'equalp)
176 ;; No static-fdefns are actually needed, but #() here causes the
177 ;; "recursion in known function" error to occur in ltn
178 (defconstant-eqx +static-fdefns+ `#(,@common-static-fdefns) #'equalp)
180 #+sb-simd-pack
181 (progn
182 (defconstant-eqx +simd-pack-element-types+
183 (coerce
184 (hash-cons
185 '(single-float double-float
186 (unsigned-byte 8) (unsigned-byte 16) (unsigned-byte 32) (unsigned-byte 64)
187 (signed-byte 8) (signed-byte 16) (signed-byte 32) (signed-byte 64)))
188 'vector)
189 #'equalp)
190 (defconstant sb-kernel::+simd-pack-wild+
191 (ldb (byte (length +simd-pack-element-types+) 0) -1))
192 (defconstant-eqx +simd-pack-128-primtypes+
193 #(simd-pack-single simd-pack-double
194 simd-pack-ub8 simd-pack-ub16 simd-pack-ub32 simd-pack-ub64
195 simd-pack-sb8 simd-pack-sb16 simd-pack-sb32 simd-pack-sb64)
196 #'equalp)
197 (defconstant-eqx +simd-pack-256-primtypes+
198 #(simd-pack-256-single simd-pack-256-double
199 simd-pack-256-ub8 simd-pack-256-ub16 simd-pack-256-ub32 simd-pack-256-ub64
200 simd-pack-256-sb8 simd-pack-256-sb16 simd-pack-256-sb32 simd-pack-256-sb64)
201 #'equalp))