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
25 simple-array-p simple-array-unsigned-byte-2-p
26 simple-array-unsigned-byte-4-p simple-array-unsigned-byte-8-p
27 simple-array-unsigned-byte-16-p simple-array-unsigned-byte-32-p
28 simple-array-signed-byte-8-p simple-array-signed-byte-16-p
29 simple-array-signed-byte-30-p simple-array-signed-byte-32-p
30 simple-array-single-float-p simple-array-double-float-p
31 #!+long-float simple-array-long-float-p
32 simple-array-complex-single-float-p
33 simple-array-complex-double-float-p
34 #!+long-float simple-array-complex-long-float-p
35 system-area-pointer-p realp unsigned-byte-32-p signed-byte-32-p
36 vector-t-p weak-pointer-p code-component-p lra-p
37 funcallable-instance-p)
38 (t) boolean (movable foldable flushable))
40 ;;;; miscellaneous "sub-primitives"
42 (defknown %sp-string-compare
43 (simple-string index index simple-string index index)
47 (defknown %sxhash-simple-string (simple-string) index
50 (defknown %sxhash-simple-substring (simple-string index) index
53 (defknown vector-length (vector) index (flushable))
55 (defknown vector-sap ((simple-unboxed-array (*))) system-area-pointer
58 (defknown lowtag-of (t) (unsigned-byte #.sb!vm:n-lowtag-bits)
60 (defknown widetag-of (t) (unsigned-byte #.sb!vm:n-widetag-bits)
63 (defknown (get-header-data get-closure-length) (t) (unsigned-byte 24)
65 (defknown set-header-data (t (unsigned-byte 24)) t
69 (defknown %make-instance (index) instance
71 (defknown %instance-layout (instance) layout
73 (defknown %set-instance-layout (instance layout) layout
75 (defknown %instance-length (instance) index
77 (defknown %instance-ref (instance index) t
79 (defknown %instance-set (instance index t) t
81 (defknown %layout-invalid-error (t layout) nil)
84 (sb!xc:deftype raw-vector () '(simple-array (unsigned-byte 32) (*)))
86 (defknown %raw-ref-single (raw-vector index) single-float
88 (defknown %raw-ref-double (raw-vector index) double-float
91 (defknown %raw-ref-long (raw-vector index) long-float
93 (defknown %raw-set-single (raw-vector index single-float) single-float
95 (defknown %raw-set-double (raw-vector index double-float) double-float
98 (defknown %raw-set-long (raw-vector index long-float) long-float
101 (defknown %raw-ref-complex-single (raw-vector index) (complex single-float)
102 (foldable flushable))
103 (defknown %raw-ref-complex-double (raw-vector index) (complex double-float)
104 (foldable flushable))
106 (defknown %raw-ref-complex-long (raw-vector index) (complex long-float)
107 (foldable flushable))
108 (defknown %raw-set-complex-single (raw-vector index (complex single-float))
109 (complex single-float)
111 (defknown %raw-set-complex-double (raw-vector index (complex double-float))
112 (complex double-float)
115 (defknown %raw-set-complex-long (raw-vector index (complex long-float))
119 (defknown %raw-bits (t fixnum) (unsigned-byte 32)
120 (foldable flushable))
121 (defknown (%set-raw-bits) (t fixnum (unsigned-byte 32)) (unsigned-byte 32)
125 (defknown allocate-vector ((unsigned-byte 8) index index) (simple-array * (*))
128 (defknown make-array-header ((unsigned-byte 8) (unsigned-byte 24)) array
132 (defknown make-weak-pointer (t) weak-pointer
135 (defknown %make-complex (real real) complex
137 (defknown %make-ratio (rational rational) ratio
139 (defknown make-value-cell (t) t
142 (defknown (dynamic-space-free-pointer binding-stack-pointer-sap
143 control-stack-pointer-sap) ()
147 ;;;; debugger support
149 (defknown current-sp () system-area-pointer (movable flushable))
150 (defknown current-fp () system-area-pointer (movable flushable))
151 (defknown stack-ref (system-area-pointer index) t (flushable))
152 (defknown %set-stack-ref (system-area-pointer index t) t (unsafe))
153 (defknown lra-code-header (t) t (movable flushable))
154 (defknown fun-code-header (t) t (movable flushable))
155 (defknown make-lisp-obj ((unsigned-byte 32)) t (movable flushable))
156 (defknown get-lisp-obj-address (t) (unsigned-byte 32) (movable flushable))
157 (defknown fun-word-offset (function) index (movable flushable))
159 ;;;; 32-bit logical operations
161 (defknown merge-bits ((unsigned-byte 5) (unsigned-byte 32) (unsigned-byte 32))
163 (foldable flushable movable))
165 (defknown 32bit-logical-not ((unsigned-byte 32)) (unsigned-byte 32)
166 (foldable flushable movable))
168 (defknown (32bit-logical-and 32bit-logical-nand
169 32bit-logical-or 32bit-logical-nor
170 32bit-logical-xor 32bit-logical-eqv
171 32bit-logical-andc1 32bit-logical-andc2
172 32bit-logical-orc1 32bit-logical-orc2)
173 ((unsigned-byte 32) (unsigned-byte 32)) (unsigned-byte 32)
174 (foldable flushable movable))
176 (defknown (shift-towards-start shift-towards-end) ((unsigned-byte 32) fixnum)
178 (foldable flushable movable))
180 ;;;; bignum operations
182 (defknown %allocate-bignum (bignum-index) bignum-widetag
185 (defknown %bignum-length (bignum-widetag) bignum-index
186 (foldable flushable movable))
188 (defknown %bignum-set-length (bignum-widetag bignum-index) bignum-widetag
191 (defknown %bignum-ref (bignum-widetag bignum-index) bignum-element-type
194 (defknown %bignum-set (bignum-widetag bignum-index bignum-element-type)
198 (defknown %digit-0-or-plusp (bignum-element-type) boolean
199 (foldable flushable movable))
201 (defknown (%add-with-carry %subtract-with-borrow)
202 (bignum-element-type bignum-element-type (mod 2))
203 (values bignum-element-type (mod 2))
204 (foldable flushable movable))
206 (defknown %multiply-and-add
207 (bignum-element-type bignum-element-type bignum-element-type
208 &optional bignum-element-type)
209 (values bignum-element-type bignum-element-type)
210 (foldable flushable movable))
212 (defknown %multiply (bignum-element-type bignum-element-type)
213 (values bignum-element-type bignum-element-type)
214 (foldable flushable movable))
216 (defknown %lognot (bignum-element-type) bignum-element-type
217 (foldable flushable movable))
219 (defknown (%logand %logior %logxor) (bignum-element-type bignum-element-type)
221 (foldable flushable movable))
223 (defknown %fixnum-to-digit (fixnum) bignum-element-type
224 (foldable flushable movable))
226 (defknown %floor (bignum-element-type bignum-element-type bignum-element-type)
227 (values bignum-element-type bignum-element-type)
228 (foldable flushable movable))
230 (defknown %fixnum-digit-with-correct-sign (bignum-element-type)
231 (signed-byte #.sb!vm:n-word-bits)
232 (foldable flushable movable))
234 (defknown (%ashl %ashr %digit-logical-shift-right)
235 (bignum-element-type (mod 32)) bignum-element-type
236 (foldable flushable movable))
238 ;;;; bit-bashing routines
240 (defknown copy-to-system-area
241 ((simple-unboxed-array (*)) index system-area-pointer index index)
245 (defknown copy-from-system-area
246 (system-area-pointer index (simple-unboxed-array (*)) index index)
250 (defknown system-area-copy
251 (system-area-pointer index system-area-pointer index index)
255 (defknown bit-bash-copy
256 ((simple-unboxed-array (*)) index
257 (simple-unboxed-array (*)) index index)
261 ;;; (not really a bit-bashing routine, but starting to take over from
262 ;;; bit-bashing routines in byte-sized copies as of sbcl-0.6.12.29:)
264 ((or (simple-unboxed-array (*)) system-area-pointer) index
265 (or (simple-unboxed-array (*)) system-area-pointer) index index)
269 ;;;; code/function/fdefn object manipulation routines
271 (defknown code-instructions (t) system-area-pointer (flushable movable))
272 (defknown code-header-ref (t index) t (flushable))
273 (defknown code-header-set (t index t) t ())
275 (defknown function-subtype (function) (unsigned-byte #.sb!vm:n-widetag-bits)
277 (defknown ((setf function-subtype))
278 ((unsigned-byte #.sb!vm:n-widetag-bits) function)
279 (unsigned-byte #.sb!vm:n-widetag-bits)
282 (defknown make-fdefn (t) fdefn (flushable movable))
283 (defknown fdefn-p (t) boolean (movable foldable flushable))
284 (defknown fdefn-name (fdefn) t (foldable flushable))
285 (defknown fdefn-fun (fdefn) (or function null) (flushable))
286 (defknown (setf fdefn-fun) (function fdefn) t (unsafe))
287 (defknown fdefn-makunbound (fdefn) t ())
289 (defknown %simple-fun-self (function) function
291 (defknown (setf %simple-fun-self) (function function) function
294 (defknown %closure-fun (function) function
297 (defknown %closure-index-ref (function index) t
300 (defknown %make-funcallable-instance (index layout) function
303 (defknown %funcallable-instance-info (function index) t (flushable))
304 (defknown %set-funcallable-instance-info (function index t) t (unsafe))
306 ;;;; mutator accessors
308 (defknown mutator-self () system-area-pointer (flushable movable))