1 ;;;; signatures of machine-specific functions
3 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; This software is derived from the CMU CL system, which was
7 ;;;; written at Carnegie Mellon University and released into the
8 ;;;; public domain. The software is in the public domain and is
9 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
10 ;;;; files for more information.
17 ;;;; internal type predicates
19 ;;; Simple TYPEP uses that don't have any standard predicate are
20 ;;; translated into non-standard unary predicates.
21 (defknown (fixnump bignump ratiop
22 short-float-p single-float-p double-float-p long-float-p
23 complex-rational-p complex-float-p complex-single-float-p
24 complex-double-float-p #!+long-float complex-long-float-p
26 base-char-p %standard-char-p %instancep
28 simple-array-p simple-array-unsigned-byte-2-p
29 simple-array-unsigned-byte-4-p simple-array-unsigned-byte-8-p
30 simple-array-unsigned-byte-16-p simple-array-unsigned-byte-32-p
31 simple-array-signed-byte-8-p simple-array-signed-byte-16-p
32 simple-array-signed-byte-30-p simple-array-signed-byte-32-p
33 simple-array-single-float-p simple-array-double-float-p
34 #!+long-float simple-array-long-float-p
35 simple-array-complex-single-float-p
36 simple-array-complex-double-float-p
37 #!+long-float simple-array-complex-long-float-p
38 system-area-pointer-p realp unsigned-byte-32-p signed-byte-32-p
39 vector-t-p weak-pointer-p code-component-p lra-p
40 funcallable-instance-p)
41 (t) boolean (movable foldable flushable))
43 ;;;; miscellaneous "sub-primitives"
45 (defknown %sp-string-compare
46 (simple-string index index simple-string index index)
50 (defknown %sxhash-simple-string (simple-string) index
53 (defknown %sxhash-simple-substring (simple-string index) index
56 (defknown vector-length (vector) index (flushable))
58 (defknown vector-sap ((simple-unboxed-array (*))) system-area-pointer
61 (defknown get-lowtag (t) (unsigned-byte #.sb!vm:lowtag-bits)
63 (defknown get-type (t) (unsigned-byte #.sb!vm:type-bits)
66 (defknown (get-header-data get-closure-length) (t) (unsigned-byte 24)
68 (defknown set-header-data (t (unsigned-byte 24)) t
72 (defknown %make-instance (index) instance
74 (defknown %instance-layout (instance) layout
76 (defknown %set-instance-layout (instance layout) layout
78 (defknown %instance-length (instance) index
80 (defknown %instance-ref (instance index) t
82 (defknown %instance-set (instance index t) t
84 (defknown %layout-invalid-error (t layout) nil)
87 (sb!xc:deftype raw-vector () '(simple-array (unsigned-byte 32) (*)))
89 (defknown %raw-ref-single (raw-vector index) single-float
91 (defknown %raw-ref-double (raw-vector index) double-float
94 (defknown %raw-ref-long (raw-vector index) long-float
96 (defknown %raw-set-single (raw-vector index single-float) single-float
98 (defknown %raw-set-double (raw-vector index double-float) double-float
101 (defknown %raw-set-long (raw-vector index long-float) long-float
104 (defknown %raw-ref-complex-single (raw-vector index) (complex single-float)
105 (foldable flushable))
106 (defknown %raw-ref-complex-double (raw-vector index) (complex double-float)
107 (foldable flushable))
109 (defknown %raw-ref-complex-long (raw-vector index) (complex long-float)
110 (foldable flushable))
111 (defknown %raw-set-complex-single (raw-vector index (complex single-float))
112 (complex single-float)
114 (defknown %raw-set-complex-double (raw-vector index (complex double-float))
115 (complex double-float)
118 (defknown %raw-set-complex-long (raw-vector index (complex long-float))
122 (defknown %raw-bits (t fixnum) (unsigned-byte 32)
123 (foldable flushable))
124 (defknown (%set-raw-bits) (t fixnum (unsigned-byte 32)) (unsigned-byte 32)
128 (defknown allocate-vector ((unsigned-byte 8) index index) (simple-array * (*))
131 (defknown make-array-header ((unsigned-byte 8) (unsigned-byte 24)) array
135 (defknown make-weak-pointer (t) weak-pointer
138 (defknown %make-complex (real real) complex
140 (defknown %make-ratio (rational rational) ratio
142 (defknown make-value-cell (t) t
145 (defknown (dynamic-space-free-pointer binding-stack-pointer-sap
146 control-stack-pointer-sap) ()
150 ;;;; debugger support
152 (defknown current-sp () system-area-pointer (movable flushable))
153 (defknown current-fp () system-area-pointer (movable flushable))
154 (defknown stack-ref (system-area-pointer index) t (flushable))
155 (defknown %set-stack-ref (system-area-pointer index t) t (unsafe))
156 (defknown lra-code-header (t) t (movable flushable))
157 (defknown function-code-header (t) t (movable flushable))
158 (defknown make-lisp-obj ((unsigned-byte 32)) t (movable flushable))
159 (defknown get-lisp-obj-address (t) (unsigned-byte 32) (movable flushable))
160 (defknown function-word-offset (function) index (movable flushable))
162 ;;;; 32-bit logical operations
164 (defknown merge-bits ((unsigned-byte 5) (unsigned-byte 32) (unsigned-byte 32))
166 (foldable flushable movable))
168 (defknown 32bit-logical-not ((unsigned-byte 32)) (unsigned-byte 32)
169 (foldable flushable movable))
171 (defknown (32bit-logical-and 32bit-logical-nand
172 32bit-logical-or 32bit-logical-nor
173 32bit-logical-xor 32bit-logical-eqv
174 32bit-logical-andc1 32bit-logical-andc2
175 32bit-logical-orc1 32bit-logical-orc2)
176 ((unsigned-byte 32) (unsigned-byte 32)) (unsigned-byte 32)
177 (foldable flushable movable))
179 (defknown (shift-towards-start shift-towards-end) ((unsigned-byte 32) fixnum)
181 (foldable flushable movable))
183 ;;;; bignum operations
185 (defknown %allocate-bignum (bignum-index) bignum-type
188 (defknown %bignum-length (bignum-type) bignum-index
189 (foldable flushable movable))
191 (defknown %bignum-set-length (bignum-type bignum-index) bignum-type
194 (defknown %bignum-ref (bignum-type bignum-index) bignum-element-type
197 (defknown %bignum-set (bignum-type bignum-index bignum-element-type)
201 (defknown %digit-0-or-plusp (bignum-element-type) boolean
202 (foldable flushable movable))
204 (defknown (%add-with-carry %subtract-with-borrow)
205 (bignum-element-type bignum-element-type (mod 2))
206 (values bignum-element-type (mod 2))
207 (foldable flushable movable))
209 (defknown %multiply-and-add
210 (bignum-element-type bignum-element-type bignum-element-type
211 &optional bignum-element-type)
212 (values bignum-element-type bignum-element-type)
213 (foldable flushable movable))
215 (defknown %multiply (bignum-element-type bignum-element-type)
216 (values bignum-element-type bignum-element-type)
217 (foldable flushable movable))
219 (defknown %lognot (bignum-element-type) bignum-element-type
220 (foldable flushable movable))
222 (defknown (%logand %logior %logxor) (bignum-element-type bignum-element-type)
224 (foldable flushable movable))
226 (defknown %fixnum-to-digit (fixnum) bignum-element-type
227 (foldable flushable movable))
229 (defknown %floor (bignum-element-type bignum-element-type bignum-element-type)
230 (values bignum-element-type bignum-element-type)
231 (foldable flushable movable))
233 (defknown %fixnum-digit-with-correct-sign (bignum-element-type)
234 (signed-byte #.sb!vm:word-bits)
235 (foldable flushable movable))
237 (defknown (%ashl %ashr %digit-logical-shift-right)
238 (bignum-element-type (mod 32)) bignum-element-type
239 (foldable flushable movable))
241 ;;;; bit-bashing routines
243 (defknown copy-to-system-area
244 ((simple-unboxed-array (*)) index system-area-pointer index index)
248 (defknown copy-from-system-area
249 (system-area-pointer index (simple-unboxed-array (*)) index index)
253 (defknown system-area-copy
254 (system-area-pointer index system-area-pointer index index)
258 (defknown bit-bash-copy
259 ((simple-unboxed-array (*)) index
260 (simple-unboxed-array (*)) index index)
264 ;;;; code/function/fdefn object manipulation routines
266 (defknown code-instructions (t) system-area-pointer (flushable movable))
267 (defknown code-header-ref (t index) t (flushable))
268 (defknown code-header-set (t index t) t ())
270 (defknown function-subtype (function) (unsigned-byte #.sb!vm:type-bits)
272 (defknown ((setf function-subtype))
273 ((unsigned-byte #.sb!vm:type-bits) function)
274 (unsigned-byte #.sb!vm:type-bits)
277 (defknown make-fdefn (t) fdefn (flushable movable))
278 (defknown fdefn-p (t) boolean (movable foldable flushable))
279 (defknown fdefn-name (fdefn) t (foldable flushable))
280 (defknown fdefn-function (fdefn) (or function null) (flushable))
281 (defknown (setf fdefn-function) (function fdefn) t (unsafe))
282 (defknown fdefn-makunbound (fdefn) t ())
284 (defknown %function-self (function) function
286 (defknown (setf %function-self) (function function) function
289 (defknown %closure-function (function) function
292 (defknown %closure-index-ref (function index) t
295 (defknown %make-funcallable-instance (index layout) function
298 (defknown %funcallable-instance-info (function index) t (flushable))
299 (defknown %set-funcallable-instance-info (function index t) t (unsafe))
301 ;;;; mutator accessors
303 (defknown mutator-self () system-area-pointer (flushable movable))