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.
14 ;;;; internal type predicates
16 ;;; Simple TYPEP uses that don't have any standard predicate are
17 ;;; translated into non-standard unary predicates.
18 (defknown (fixnump bignump ratiop
19 short-float-p single-float-p double-float-p long-float-p
20 complex-rational-p complex-float-p complex-single-float-p
21 complex-double-float-p #!+long-float complex-long-float-p
23 base-char-p %standard-char-p %instancep
24 base-string-p simple-base-string-p
26 simple-array-p simple-array-nil-p vector-nil-p
27 simple-array-unsigned-byte-2-p
28 simple-array-unsigned-byte-4-p simple-array-unsigned-byte-7-p
29 simple-array-unsigned-byte-8-p simple-array-unsigned-byte-15-p
30 simple-array-unsigned-byte-16-p simple-array-unsigned-byte-29-p
31 simple-array-unsigned-byte-31-p
32 simple-array-unsigned-byte-32-p
33 simple-array-signed-byte-8-p simple-array-signed-byte-16-p
34 simple-array-signed-byte-30-p simple-array-signed-byte-32-p
35 simple-array-single-float-p simple-array-double-float-p
36 #!+long-float simple-array-long-float-p
37 simple-array-complex-single-float-p
38 simple-array-complex-double-float-p
39 #!+long-float simple-array-complex-long-float-p
40 system-area-pointer-p realp unsigned-byte-32-p signed-byte-32-p
41 vector-t-p weak-pointer-p code-component-p lra-p
42 funcallable-instance-p)
43 (t) boolean (movable foldable flushable))
45 ;;;; miscellaneous "sub-primitives"
47 (defknown %sp-string-compare
48 (simple-string index index simple-string index index)
52 (defknown %sxhash-simple-string (simple-string) index
55 (defknown %sxhash-simple-substring (simple-string index) index
58 (defknown vector-length (vector) index (flushable))
60 (defknown vector-sap ((simple-unboxed-array (*))) system-area-pointer
63 (defknown lowtag-of (t) (unsigned-byte #.sb!vm:n-lowtag-bits)
65 (defknown widetag-of (t) (unsigned-byte #.sb!vm:n-widetag-bits)
68 (defknown (get-header-data get-closure-length) (t) (unsigned-byte 24)
70 (defknown set-header-data (t (unsigned-byte 24)) t
73 (defknown %array-dimension (t index) index
75 (defknown %set-array-dimension (t index index) index
77 (defknown %array-rank (t) index
80 (defknown %make-instance (index) instance
82 (defknown %instance-layout (instance) layout
84 (defknown %set-instance-layout (instance layout) layout
86 (defknown %instance-length (instance) index
88 (defknown %instance-ref (instance index) t
90 (defknown %instance-set (instance index t) t
92 (defknown %layout-invalid-error (t layout) nil)
95 (sb!xc:deftype raw-vector () '(simple-array (unsigned-byte 32) (*)))
97 (defknown %raw-ref-single (raw-vector index) single-float
99 (defknown %raw-ref-double (raw-vector index) double-float
100 (foldable flushable))
102 (defknown %raw-ref-long (raw-vector index) long-float
103 (foldable flushable))
104 (defknown %raw-set-single (raw-vector index single-float) single-float
106 (defknown %raw-set-double (raw-vector index double-float) double-float
109 (defknown %raw-set-long (raw-vector index long-float) long-float
112 (defknown %raw-ref-complex-single (raw-vector index) (complex single-float)
113 (foldable flushable))
114 (defknown %raw-ref-complex-double (raw-vector index) (complex double-float)
115 (foldable flushable))
117 (defknown %raw-set-complex-single (raw-vector index (complex single-float))
118 (complex single-float)
120 (defknown %raw-set-complex-double (raw-vector index (complex double-float))
121 (complex double-float)
125 (defknown %raw-bits (t fixnum) (unsigned-byte 32)
126 (foldable flushable))
127 (defknown (%set-raw-bits) (t fixnum (unsigned-byte 32)) (unsigned-byte 32)
131 (defknown allocate-vector ((unsigned-byte 8) index index) (simple-array * (*))
134 (defknown make-array-header ((unsigned-byte 8) (unsigned-byte 24)) array
138 (defknown make-weak-pointer (t) weak-pointer
141 (defknown %make-complex (real real) complex
143 (defknown %make-ratio (rational rational) ratio
145 (defknown make-value-cell (t) t
148 (defknown (dynamic-space-free-pointer binding-stack-pointer-sap
149 control-stack-pointer-sap) ()
153 ;;;; debugger support
155 (defknown current-sp () system-area-pointer (movable flushable))
156 (defknown current-fp () system-area-pointer (movable flushable))
157 (defknown stack-ref (system-area-pointer index) t (flushable))
158 (defknown %set-stack-ref (system-area-pointer index t) t (unsafe))
159 (defknown lra-code-header (t) t (movable flushable))
160 (defknown fun-code-header (t) t (movable flushable))
161 (defknown make-lisp-obj ((unsigned-byte 32)) t (movable flushable))
162 (defknown get-lisp-obj-address (t) (unsigned-byte 32) (movable flushable))
163 (defknown fun-word-offset (function) index (movable flushable))
165 ;;;; 32-bit logical operations
167 (defknown merge-bits ((unsigned-byte 5) (unsigned-byte 32) (unsigned-byte 32))
169 (foldable flushable movable))
171 (defknown 32bit-logical-not ((unsigned-byte 32)) (unsigned-byte 32)
172 (foldable flushable movable))
174 (defknown (32bit-logical-and 32bit-logical-nand
175 32bit-logical-or 32bit-logical-nor
176 32bit-logical-xor 32bit-logical-eqv
177 32bit-logical-andc1 32bit-logical-andc2
178 32bit-logical-orc1 32bit-logical-orc2)
179 ((unsigned-byte 32) (unsigned-byte 32)) (unsigned-byte 32)
180 (foldable flushable movable))
182 (defknown (shift-towards-start shift-towards-end) ((unsigned-byte 32) fixnum)
184 (foldable flushable movable))
186 ;;;; bignum operations
188 (defknown %allocate-bignum (bignum-index) bignum-type
191 (defknown %bignum-length (bignum-type) bignum-index
192 (foldable flushable movable))
194 (defknown %bignum-set-length (bignum-type bignum-index) bignum-type
197 (defknown %bignum-ref (bignum-type bignum-index) bignum-element-type
200 (defknown %bignum-set (bignum-type bignum-index bignum-element-type)
204 (defknown %digit-0-or-plusp (bignum-element-type) boolean
205 (foldable flushable movable))
207 (defknown (%add-with-carry %subtract-with-borrow)
208 (bignum-element-type bignum-element-type (mod 2))
209 (values bignum-element-type (mod 2))
210 (foldable flushable movable))
212 (defknown %multiply-and-add
213 (bignum-element-type bignum-element-type bignum-element-type
214 &optional bignum-element-type)
215 (values bignum-element-type bignum-element-type)
216 (foldable flushable movable))
218 (defknown %multiply (bignum-element-type bignum-element-type)
219 (values bignum-element-type bignum-element-type)
220 (foldable flushable movable))
222 (defknown %lognot (bignum-element-type) bignum-element-type
223 (foldable flushable movable))
225 (defknown (%logand %logior %logxor) (bignum-element-type bignum-element-type)
227 (foldable flushable movable))
229 (defknown %fixnum-to-digit (fixnum) bignum-element-type
230 (foldable flushable movable))
232 (defknown %floor (bignum-element-type bignum-element-type bignum-element-type)
233 (values bignum-element-type bignum-element-type)
234 (foldable flushable movable))
236 (defknown %fixnum-digit-with-correct-sign (bignum-element-type)
237 (signed-byte #.sb!vm:n-word-bits)
238 (foldable flushable movable))
240 (defknown (%ashl %ashr %digit-logical-shift-right)
241 (bignum-element-type (mod 32)) bignum-element-type
242 (foldable flushable movable))
244 ;;;; bit-bashing routines
246 (defknown copy-to-system-area
247 ((simple-unboxed-array (*)) index system-area-pointer index index)
251 (defknown copy-from-system-area
252 (system-area-pointer index (simple-unboxed-array (*)) index index)
256 (defknown system-area-copy
257 (system-area-pointer index system-area-pointer index index)
261 (defknown bit-bash-copy
262 ((simple-unboxed-array (*)) index
263 (simple-unboxed-array (*)) index index)
267 ;;; (not really a bit-bashing routine, but starting to take over from
268 ;;; bit-bashing routines in byte-sized copies as of sbcl-0.6.12.29:)
270 ((or (simple-unboxed-array (*)) system-area-pointer) index
271 (or (simple-unboxed-array (*)) system-area-pointer) index index)
275 ;;;; code/function/fdefn object manipulation routines
277 (defknown code-instructions (t) system-area-pointer (flushable movable))
278 (defknown code-header-ref (t index) t (flushable))
279 (defknown code-header-set (t index t) t ())
281 (defknown fun-subtype (function) (unsigned-byte #.sb!vm:n-widetag-bits)
283 (defknown ((setf fun-subtype))
284 ((unsigned-byte #.sb!vm:n-widetag-bits) function)
285 (unsigned-byte #.sb!vm:n-widetag-bits)
288 (defknown make-fdefn (t) fdefn (flushable movable))
289 (defknown fdefn-p (t) boolean (movable foldable flushable))
290 (defknown fdefn-name (fdefn) t (foldable flushable))
291 (defknown fdefn-fun (fdefn) (or function null) (flushable))
292 (defknown (setf fdefn-fun) (function fdefn) t (unsafe))
293 (defknown fdefn-makunbound (fdefn) t ())
295 (defknown %simple-fun-self (function) function
297 (defknown (setf %simple-fun-self) (function function) function
300 (defknown %closure-fun (function) function
303 (defknown %closure-index-ref (function index) t
306 (defknown %make-funcallable-instance (index layout) function
309 (defknown %funcallable-instance-info (function index) t (flushable))
310 (defknown %set-funcallable-instance-info (function index t) t (unsafe))
312 ;;;; mutator accessors
314 (defknown mutator-self () system-area-pointer (flushable movable))
316 (defknown %data-vector-and-index (array index)
317 (values (simple-array * (*)) index)
318 (foldable flushable))