Fix WRITE on stream-designators.
[sbcl.git] / src / compiler / fndb.lisp
blobcc51acbf5a5852d2b8d447fa4a929a080cd7dcca
1 ;;;; This file defines all the standard functions to be known
2 ;;;; functions. Each function has type and side-effect information,
3 ;;;; and may also have IR1 optimizers.
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!C")
16 ;;;; information for known functions:
18 (defknown coerce (t type-specifier) t
19 ;; Note:
20 ;; This is not FLUSHABLE because it's defined to signal errors.
21 (movable)
22 ;; :DERIVE-TYPE RESULT-TYPE-SPEC-NTH-ARG 2 ? Nope... (COERCE 1 'COMPLEX)
23 ;; returns REAL/INTEGER, not COMPLEX.
25 (defknown list-to-vector* (list type-specifier) vector)
26 (defknown vector-to-vector* (vector type-specifier) vector)
28 (defknown type-of (t) t (foldable flushable))
30 ;;; These can be affected by type definitions, so they're not FOLDABLE.
31 (defknown (sb!xc:upgraded-complex-part-type sb!xc:upgraded-array-element-type)
32 (type-specifier &optional lexenv-designator) type-specifier
33 (unsafely-flushable))
35 ;;;; from the "Predicates" chapter:
37 ;;; FIXME: Is it right to have TYPEP (and TYPE-OF, elsewhere; and
38 ;;; perhaps SPECIAL-OPERATOR-P and others) be FOLDABLE in the
39 ;;; cross-compilation host? After all, some type relationships (e.g.
40 ;;; FIXNUMness) might be different between host and target. Perhaps
41 ;;; this property should be protected by #-SB-XC-HOST? Perhaps we need
42 ;;; 3-stage bootstrapping after all? (Ugh! It's *so* slow already!)
43 (defknown typep (t type-specifier &optional lexenv-designator) t
44 ;; Unlike SUBTYPEP or UPGRADED-ARRAY-ELEMENT-TYPE and friends, this
45 ;; seems to be FOLDABLE. Like SUBTYPEP, it's affected by type
46 ;; definitions, but unlike SUBTYPEP, there should be no way to make
47 ;; a TYPEP expression with constant arguments which doesn't return
48 ;; an error before the type declaration (because of undefined
49 ;; type). E.g. you can do
50 ;; (SUBTYPEP 'INTEGER 'FOO) => NIL, NIL
51 ;; (DEFTYPE FOO () T)
52 ;; (SUBTYPEP 'INTEGER 'FOO) => T, T
53 ;; but the analogous
54 ;; (TYPEP 12 'FOO)
55 ;; (DEFTYPE FOO () T)
56 ;; (TYPEP 12 'FOO)
57 ;; doesn't work because the first call is an error.
59 ;; (UPGRADED-ARRAY-ELEMENT-TYPE and UPGRADED-COMPLEX-PART-TYPE have
60 ;; behavior like SUBTYPEP in this respect, not like TYPEP.)
61 (foldable))
62 (defknown subtypep (type-specifier type-specifier &optional lexenv-designator)
63 (values boolean boolean)
64 ;; This is not FOLDABLE because its value is affected by type
65 ;; definitions.
67 ;; FIXME: Is it OK to fold this when the types have already been
68 ;; defined? Does the code inherited from CMU CL already do this?
69 (unsafely-flushable))
71 (defknown (null symbolp atom consp listp numberp integerp rationalp floatp
72 complexp characterp stringp bit-vector-p vectorp
73 simple-vector-p simple-string-p simple-bit-vector-p arrayp
74 packagep functionp compiled-function-p not)
75 (t) boolean (movable foldable flushable))
77 (defknown (eq eql %eql/integer) (t t) boolean
78 (movable foldable flushable commutative))
79 (defknown (equal equalp) (t t) boolean (foldable flushable recursive))
81 #!+(or x86 x86-64 arm)
82 (defknown fixnum-mod-p (t fixnum) boolean
83 (movable foldable flushable always-translatable))
86 ;;;; classes
88 (sb!xc:deftype name-for-class () t)
89 (defknown classoid-name (classoid) symbol (flushable))
90 (defknown find-classoid (name-for-class &optional t)
91 (or classoid null) ())
92 (defknown classoid-of (t) classoid (flushable))
93 (defknown layout-of (t) layout (flushable))
94 (defknown copy-structure (structure-object) structure-object
95 (flushable)) ;; FIXME: can derive the type based on the structure
97 ;;;; from the "Control Structure" chapter:
99 ;;; This is not FLUSHABLE, since it's required to signal an error if
100 ;;; unbound.
101 (defknown (symbol-value) (symbol) t ())
102 (defknown about-to-modify-symbol-value (symbol t &optional t t) null
103 (explicit-check))
104 ;;; From CLHS, "If the symbol is globally defined as a macro or a
105 ;;; special operator, an object of implementation-dependent nature and
106 ;;; identity is returned. If the symbol is not globally defined as
107 ;;; either a macro or a special operator, and if the symbol is fbound,
108 ;;; a function object is returned". Our objects of
109 ;;; implementation-dependent nature happen to be functions.
110 (defknown (symbol-function) (symbol) function ())
112 (defknown boundp (symbol) boolean (flushable))
113 (defknown fboundp ((or symbol cons)) boolean (unsafely-flushable explicit-check))
114 (defknown special-operator-p (symbol) t
115 ;; The set of special operators never changes.
116 (movable foldable flushable))
117 (defknown set (symbol t) t ()
118 :derive-type #'result-type-last-arg)
119 (defknown fdefinition ((or symbol cons)) function (explicit-check))
120 (defknown %set-fdefinition ((or symbol cons) function) function
121 (explicit-check)
122 :derive-type #'result-type-last-arg)
123 (defknown makunbound (symbol) symbol
125 :derive-type #'result-type-first-arg)
126 (defknown fmakunbound ((or symbol cons)) (or symbol cons)
127 (explicit-check)
128 :derive-type #'result-type-first-arg)
129 (defknown apply (callable t &rest t) *) ; ### Last arg must be List...
130 (defknown funcall (callable &rest t) *)
132 (defknown (mapcar maplist) (callable list &rest list) list
133 (call))
135 ;;; According to CLHS the result must be a LIST, but we do not check
136 ;;; it.
137 (defknown (mapcan mapcon) (callable list &rest list) t
138 (call))
140 (defknown (mapc mapl) (callable list &rest list) list (foldable call))
142 ;;; We let VALUES-LIST be foldable, since constant-folding will turn
143 ;;; it into VALUES. VALUES is not foldable, since MV constants are
144 ;;; represented by a call to VALUES.
145 (defknown values (&rest t) * (movable flushable))
146 (defknown values-list (list) * (movable foldable unsafely-flushable))
148 ;;;; from the "Macros" chapter:
150 (defknown macro-function (symbol &optional lexenv-designator)
151 (or function null)
152 (flushable))
153 (defknown (macroexpand macroexpand-1 %macroexpand %macroexpand-1)
154 (t &optional lexenv-designator)
155 (values form &optional boolean))
157 (defknown compiler-macro-function (t &optional lexenv-designator)
158 (or function null)
159 (flushable))
161 ;;;; from the "Declarations" chapter:
163 (defknown proclaim (list) (values) (recursive))
165 ;;;; from the "Symbols" chapter:
167 (defknown get (symbol t &optional t) t (flushable))
168 (defknown sb!impl::get3 (symbol t t) t (flushable))
169 (defknown remprop (symbol t) t)
170 (defknown symbol-plist (symbol) list (flushable))
171 (defknown getf (list t &optional t) t (foldable flushable))
172 (defknown get-properties (list list) (values t t list) (foldable flushable))
173 (defknown symbol-name (symbol) simple-string (movable foldable flushable))
174 (defknown make-symbol (string) symbol (flushable))
175 (defknown %make-symbol (simple-string) symbol (flushable))
176 (defknown copy-symbol (symbol &optional t) symbol (flushable))
177 (defknown gensym (&optional (or string unsigned-byte)) symbol ())
178 (defknown symbol-package (symbol) (or package null) (flushable))
179 (defknown keywordp (t) boolean (flushable)) ; If someone uninterns it...
181 ;;;; from the "Packages" chapter:
183 (defknown gentemp (&optional string package-designator) symbol)
185 (defknown make-package (string-designator &key
186 (:use list)
187 (:nicknames list)
188 ;; ### extensions...
189 (:internal-symbols index)
190 (:external-symbols index))
191 package)
192 (defknown find-package (package-designator) (or package null)
193 (flushable))
194 (defknown find-undeleted-package-or-lose (package-designator)
195 package) ; not flushable
196 (defknown package-name (package-designator) (or simple-string null)
197 (unsafely-flushable))
198 (defknown package-nicknames (package-designator) list (unsafely-flushable))
199 (defknown rename-package (package-designator package-designator &optional list)
200 package)
201 (defknown package-use-list (package-designator) list (unsafely-flushable))
202 (defknown package-used-by-list (package-designator) list (unsafely-flushable))
203 (defknown package-shadowing-symbols (package-designator) list (unsafely-flushable))
204 (defknown list-all-packages () list (flushable))
205 (defknown intern (string &optional package-designator)
206 (values symbol (member :internal :external :inherited nil))
208 (defknown find-symbol (string &optional package-designator)
209 (values symbol (member :internal :external :inherited nil))
210 (flushable))
211 (defknown (export import) (symbols-designator &optional package-designator)
212 (eql t))
213 (defknown unintern (symbol &optional package-designator) boolean)
214 (defknown unexport (symbols-designator &optional package-designator) (eql t))
215 (defknown shadowing-import (symbols-designator &optional package-designator)
216 (eql t))
217 (defknown shadow ((or symbol character string list) &optional package-designator)
218 (eql t))
219 (defknown (use-package unuse-package)
220 ((or list package-designator) &optional package-designator) (eql t))
221 (defknown find-all-symbols (string-designator) list (flushable))
222 ;; private
223 (defknown package-iter-step (fixnum index simple-vector list)
224 (values fixnum index simple-vector list symbol symbol))
226 ;;;; from the "Numbers" chapter:
228 (defknown zerop (number) boolean (movable foldable flushable explicit-check))
229 (defknown (plusp minusp) (real) boolean
230 (movable foldable flushable explicit-check))
231 (defknown (oddp evenp) (integer) boolean
232 (movable foldable flushable explicit-check))
233 (defknown (=) (number &rest number) boolean
234 (movable foldable flushable explicit-check commutative))
235 (defknown (/=) (number &rest number) boolean
236 (movable foldable flushable explicit-check))
237 (defknown (< > <= >=) (real &rest real) boolean
238 (movable foldable flushable explicit-check))
239 (defknown (max min) (real &rest real) real
240 (movable foldable flushable explicit-check))
242 (defknown (+ *) (&rest number) number
243 (movable foldable flushable explicit-check commutative))
244 (defknown - (number &rest number) number
245 (movable foldable flushable explicit-check))
246 (defknown / (number &rest number) number
247 (movable foldable unsafely-flushable explicit-check))
248 (defknown (1+ 1-) (number) number
249 (movable foldable flushable explicit-check))
251 (defknown conjugate (number) number
252 (movable foldable flushable explicit-check))
254 (defknown gcd (&rest integer) unsigned-byte
255 (movable foldable flushable explicit-check)
256 #|:derive-type 'boolean-result-type|#)
257 (defknown lcm (&rest integer) unsigned-byte
258 (movable foldable flushable explicit-check))
260 #+sb-xc-host ; (See CROSS-FLOAT-INFINITY-KLUDGE.)
261 (defknown exp (number) irrational
262 (movable foldable flushable explicit-check recursive)
263 :derive-type #'result-type-float-contagion)
265 #-sb-xc-host ; (See CROSS-FLOAT-INFINITY-KLUDGE.)
266 (defknown exp (number) irrational
267 (movable foldable flushable explicit-check recursive))
269 (defknown expt (number number) number
270 (movable foldable flushable explicit-check recursive))
271 (defknown log (number &optional real) irrational
272 (movable foldable flushable explicit-check recursive))
273 (defknown sqrt (number) irrational
274 (movable foldable flushable explicit-check))
275 (defknown isqrt (unsigned-byte) unsigned-byte
276 (movable foldable flushable explicit-check recursive))
278 (defknown (abs phase signum) (number) number
279 (movable foldable flushable explicit-check))
280 (defknown cis (real) (complex float)
281 (movable foldable flushable explicit-check))
283 #+sb-xc-host ; (See CROSS-FLOAT-INFINITY-KLUDGE.)
284 (progn
285 (defknown (sin cos) (number)
286 (or (float -1.0 1.0) (complex float))
287 (movable foldable flushable explicit-check recursive)
288 :derive-type #'result-type-float-contagion)
290 (defknown atan
291 (number &optional real) irrational
292 (movable foldable unsafely-flushable explicit-check recursive)
293 :derive-type #'result-type-float-contagion)
295 (defknown (tan sinh cosh tanh asinh)
296 (number) irrational (movable foldable flushable explicit-check recursive)
297 :derive-type #'result-type-float-contagion)
298 ) ; PROGN
300 #-sb-xc-host ; (See CROSS-FLOAT-INFINITY-KLUDGE.)
301 (progn
302 (defknown (sin cos) (number)
303 (or (float -1.0 1.0) (complex float))
304 (movable foldable flushable explicit-check recursive))
306 (defknown atan
307 (number &optional real) irrational
308 (movable foldable unsafely-flushable explicit-check recursive))
310 (defknown (tan sinh cosh tanh asinh)
311 (number) irrational (movable foldable flushable explicit-check recursive))
312 ) ; PROGN
314 (defknown (asin acos acosh atanh)
315 (number) irrational
316 (movable foldable flushable explicit-check recursive))
318 (defknown float (real &optional float) float
319 (movable foldable flushable explicit-check))
321 (defknown (rational) (real) rational
322 (movable foldable flushable explicit-check))
324 (defknown (rationalize) (real) rational
325 (movable foldable flushable explicit-check recursive))
327 (defknown (numerator denominator) (rational) integer
328 (movable foldable flushable))
330 (defknown (floor ceiling round)
331 (real &optional real) (values integer real)
332 (movable foldable flushable explicit-check))
334 (defknown truncate
335 (real &optional real) (values integer real)
336 (movable foldable flushable explicit-check recursive))
338 (defknown %multiply-high (word word) word
339 (movable foldable flushable))
341 (defknown (mod rem) (real real) real
342 (movable foldable flushable explicit-check))
344 (defknown (ffloor fceiling fround ftruncate)
345 (real &optional real) (values float real)
346 (movable foldable flushable explicit-check))
348 (defknown decode-float (float) (values float float-exponent float)
349 (movable foldable unsafely-flushable explicit-check))
350 (defknown scale-float (float integer) float
351 (movable foldable unsafely-flushable explicit-check))
352 (defknown float-radix (float) float-radix
353 (movable foldable unsafely-flushable))
354 (defknown float-sign (float &optional float) float
355 (movable foldable unsafely-flushable explicit-check))
356 (defknown (float-digits float-precision) (float) float-digits
357 (movable foldable unsafely-flushable explicit-check))
358 (defknown integer-decode-float (float)
359 (values integer float-int-exponent (member -1 1))
360 (movable foldable unsafely-flushable explicit-check))
362 (defknown complex (real &optional real) number
363 (movable foldable flushable explicit-check))
365 (defknown (realpart imagpart) (number) real (movable foldable flushable))
367 (defknown (logior logxor logand logeqv) (&rest integer) integer
368 (movable foldable flushable explicit-check commutative))
370 (defknown (lognand lognor logandc1 logandc2 logorc1 logorc2)
371 (integer integer) integer
372 (movable foldable flushable explicit-check))
374 (defknown boole (boole-code integer integer) integer
375 (movable foldable flushable))
377 (defknown lognot (integer) integer (movable foldable flushable explicit-check))
378 (defknown logtest (integer integer) boolean (movable foldable flushable commutative))
379 (defknown logbitp (unsigned-byte integer) boolean (movable foldable flushable))
380 (defknown ash (integer integer) integer
381 (movable foldable flushable explicit-check))
382 #!+ash-right-vops
383 (defknown %ash/right ((or word sb!vm:signed-word) (mod #.sb!vm:n-word-bits))
384 (or word sb!vm:signed-word)
385 (movable foldable flushable always-translatable))
386 (defknown (logcount integer-length) (integer) bit-index
387 (movable foldable flushable explicit-check))
388 ;;; FIXME: According to the ANSI spec, it's legal to use any
389 ;;; nonnegative indices for BYTE arguments, not just BIT-INDEX. It's
390 ;;; hard to come up with useful ways to do this, but it is possible to
391 ;;; come up with *legal* ways to do this, so it would be nice
392 ;;; to fix this so we comply with the spec.
393 (defknown byte (bit-index bit-index) byte-specifier
394 (movable foldable flushable))
395 (defknown (byte-size byte-position) (byte-specifier) bit-index
396 (movable foldable flushable))
397 (defknown ldb (byte-specifier integer) unsigned-byte (movable foldable flushable))
398 (defknown ldb-test (byte-specifier integer) boolean
399 (movable foldable flushable))
400 (defknown mask-field (byte-specifier integer) unsigned-byte
401 (movable foldable flushable))
402 (defknown dpb (integer byte-specifier integer) integer
403 (movable foldable flushable))
404 (defknown deposit-field (integer byte-specifier integer) integer
405 (movable foldable flushable))
406 (defknown random ((or (float (0.0)) (integer 1)) &optional random-state)
407 (or (float 0.0) (integer 0))
408 (explicit-check))
409 (defknown make-random-state (&optional (or random-state (member nil t)))
410 random-state (flushable))
411 ;; The arg type specifier is for documentation only- EXPLICIT-CHECK prevails.
412 ;; It feels almost wrong to state it at all.
413 (defknown seed-random-state (&optional ; SBCL extension
414 (or (member nil t) random-state unsigned-byte
415 (simple-array (unsigned-byte 8) (*))
416 (simple-array (unsigned-byte 32) (*))))
417 random-state (flushable explicit-check))
419 (defknown random-state-p (t) boolean (movable foldable flushable))
421 ;;;; from the "Characters" chapter:
422 (defknown (standard-char-p graphic-char-p alpha-char-p
423 upper-case-p lower-case-p both-case-p alphanumericp)
424 (character) boolean (movable foldable flushable))
426 (defknown digit-char-p (character &optional (integer 2 36))
427 (or (integer 0 35) null) (movable foldable flushable))
429 ;; Character predicates: if the 2-argument predicate which underlies
430 ;; the N-argument predicate unavoidably type-checks its 2 args,
431 ;; then the N-argument form should not type-check anything
432 ;; except in the degenerate case of 1 actual argument.
433 ;; All of the case-sensitive functions have the check of the first arg
434 ;; generated by the compiler, and successive args checked by hand.
435 ;; The case-insensitive functions don't need any checks, since the underlying
436 ;; two-arg case-insensitive function does it, except when it isn't called.
437 (defknown (char=)
438 (character &rest character) boolean (movable foldable flushable commutative))
440 (defknown (char/= char< char> char<= char>= char-not-equal)
441 (character &rest character) boolean (movable foldable flushable))
442 (defknown (char-equal char-lessp char-greaterp char-not-greaterp char-not-lessp)
443 (character &rest character) boolean (movable foldable flushable explicit-check))
445 (defknown (two-arg-char-equal)
446 (character character) boolean (movable foldable flushable commutative))
448 (defknown (two-arg-char-not-equal
449 two-arg-char-lessp
450 two-arg-char-not-lessp
451 two-arg-char-greaterp
452 two-arg-char-not-greaterp)
453 (character character) boolean (movable foldable flushable))
455 (defknown char-equal-constant (character character character)
456 boolean
457 (movable foldable flushable explicit-check))
459 (defknown character (t) character (movable foldable unsafely-flushable))
460 (defknown char-code (character) char-code (movable foldable flushable))
461 (defknown (char-upcase char-downcase) (character) character
462 (movable foldable flushable))
463 (defknown digit-char (unsigned-byte &optional (integer 2 36))
464 (or character null) (movable foldable flushable))
465 (defknown char-int (character) char-code (movable foldable flushable))
466 (defknown char-name (character) (or simple-string null)
467 (movable foldable flushable))
468 (defknown name-char (string-designator) (or character null)
469 (movable foldable flushable))
470 (defknown code-char (char-code) character
471 ;; By suppressing constant folding on CODE-CHAR when the
472 ;; cross-compiler is running in the cross-compilation host vanilla
473 ;; ANSI Common Lisp, we can use CODE-CHAR expressions to delay until
474 ;; target Lisp run time the generation of CHARACTERs which aren't
475 ;; STANDARD-CHARACTERs. That way, we don't need to rely on the host
476 ;; Common Lisp being able to handle any characters other than those
477 ;; guaranteed by the ANSI spec.
478 (movable #-sb-xc-host foldable flushable))
480 ;;;; from the "Sequences" chapter:
482 (defknown elt (sequence index) t (foldable unsafely-flushable))
484 (defknown subseq (sequence index &optional sequence-end) consed-sequence
485 (flushable)
486 :derive-type (sequence-result-nth-arg 1))
488 (defknown copy-seq (sequence) consed-sequence (flushable)
489 :derive-type (sequence-result-nth-arg 1))
491 (defknown length (sequence) index (explicit-check foldable flushable dx-safe))
493 (defknown reverse (sequence) consed-sequence (explicit-check flushable)
494 :derive-type (sequence-result-nth-arg 1))
496 (defknown nreverse (sequence) sequence (explicit-check important-result)
497 :derive-type #'result-type-first-arg
498 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
500 (defknown make-sequence (type-specifier index
501 &key
502 (:initial-element t))
503 consed-sequence
504 (movable)
505 :derive-type (creation-result-type-specifier-nth-arg 1))
507 (defknown concatenate (type-specifier &rest sequence) consed-sequence
509 :derive-type (creation-result-type-specifier-nth-arg 1))
511 (defknown %concatenate-to-string (&rest sequence) simple-string
512 (explicit-check flushable))
513 (defknown %concatenate-to-base-string (&rest sequence) simple-base-string
514 (explicit-check flushable))
516 (defknown (map %map) (type-specifier callable sequence &rest sequence)
517 consed-sequence
518 (call)
519 ; :DERIVE-TYPE 'TYPE-SPEC-ARG1 ? Nope... (MAP NIL ...) returns NULL, not NIL.
521 (defknown %map-for-effect-arity-1 (callable sequence) null (call))
522 (defknown %map-to-list-arity-1 (callable sequence) list (flushable call))
523 (defknown %map-to-simple-vector-arity-1 (callable sequence) simple-vector
524 (flushable call))
526 (defknown map-into (sequence callable &rest sequence)
527 sequence
528 (call)
529 :derive-type #'result-type-first-arg
530 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
532 (defknown #.(loop for info across sb!vm:*specialized-array-element-type-properties*
533 collect
534 (intern (concatenate 'string "VECTOR-MAP-INTO/"
535 (string (sb!vm:saetp-primitive-type-name info)))
536 :sb!impl))
537 (simple-array index index function list)
538 index
539 (call explicit-check))
541 ;;; returns the result from the predicate...
542 (defknown some (callable sequence &rest sequence) t
543 (foldable unsafely-flushable call))
545 (defknown (every notany notevery) (callable sequence &rest sequence) boolean
546 (foldable unsafely-flushable call))
548 (defknown reduce (callable sequence &rest t &key (:from-end t) (:start index)
549 (:end sequence-end) (:initial-value t) (:key callable))
551 (foldable flushable call))
553 (defknown fill (sequence t &rest t &key
554 (:start index) (:end sequence-end)) sequence
556 :derive-type #'result-type-first-arg
557 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1)
558 :result-arg 0)
560 (defknown replace (sequence sequence &rest t &key (:start1 index)
561 (:end1 sequence-end) (:start2 index) (:end2 sequence-end))
562 sequence ()
563 :derive-type #'result-type-first-arg
564 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1)
565 :result-arg 0)
567 (defknown remove
568 (t sequence &rest t &key (:from-end t) (:test callable)
569 (:test-not callable) (:start index) (:end sequence-end)
570 (:count sequence-count) (:key callable))
571 consed-sequence
572 (flushable call)
573 :derive-type (sequence-result-nth-arg 2))
575 (defknown substitute
576 (t t sequence &rest t &key (:from-end t) (:test callable)
577 (:test-not callable) (:start index) (:end sequence-end)
578 (:count sequence-count) (:key callable))
579 consed-sequence
580 (flushable call)
581 :derive-type (sequence-result-nth-arg 3))
583 (defknown (remove-if remove-if-not)
584 (callable sequence &rest t &key (:from-end t) (:start index)
585 (:end sequence-end) (:count sequence-count) (:key callable))
586 consed-sequence
587 (flushable call)
588 :derive-type (sequence-result-nth-arg 2))
590 (defknown (substitute-if substitute-if-not)
591 (t callable sequence &rest t &key (:from-end t) (:start index)
592 (:end sequence-end) (:count sequence-count) (:key callable))
593 consed-sequence
594 (flushable call)
595 :derive-type (sequence-result-nth-arg 3))
597 (defknown delete
598 (t sequence &rest t &key (:from-end t) (:test callable)
599 (:test-not callable) (:start index) (:end sequence-end)
600 (:count sequence-count) (:key callable))
601 sequence
602 (flushable call important-result)
603 :derive-type (sequence-result-nth-arg 2)
604 :destroyed-constant-args (nth-constant-nonempty-sequence-args 2))
606 (defknown nsubstitute
607 (t t sequence &rest t &key (:from-end t) (:test callable)
608 (:test-not callable) (:start index) (:end sequence-end)
609 (:count sequence-count) (:key callable))
610 sequence
611 (flushable call)
612 :derive-type (sequence-result-nth-arg 3)
613 :destroyed-constant-args (nth-constant-nonempty-sequence-args 3))
615 (defknown (delete-if delete-if-not)
616 (callable sequence &rest t &key (:from-end t) (:start index)
617 (:end sequence-end) (:count sequence-count) (:key callable))
618 sequence
619 (flushable call important-result)
620 :derive-type (sequence-result-nth-arg 2)
621 :destroyed-constant-args (nth-constant-nonempty-sequence-args 2))
623 (defknown (nsubstitute-if nsubstitute-if-not)
624 (t callable sequence &rest t &key (:from-end t) (:start index)
625 (:end sequence-end) (:count sequence-count) (:key callable))
626 sequence
627 (flushable call)
628 :derive-type (sequence-result-nth-arg 3)
629 :destroyed-constant-args (nth-constant-nonempty-sequence-args 3))
631 (defknown remove-duplicates
632 (sequence &rest t &key (:test callable) (:test-not callable) (:start index)
633 (:from-end t) (:end sequence-end) (:key callable))
634 consed-sequence
635 (unsafely-flushable call)
636 :derive-type (sequence-result-nth-arg 1))
638 (defknown delete-duplicates
639 (sequence &rest t &key (:test callable) (:test-not callable) (:start index)
640 (:from-end t) (:end sequence-end) (:key callable))
641 sequence
642 (unsafely-flushable call important-result)
643 :derive-type (sequence-result-nth-arg 1)
644 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
646 (defknown find (t sequence &rest t &key (:test callable)
647 (:test-not callable) (:start index) (:from-end t)
648 (:end sequence-end) (:key callable))
650 (foldable flushable call))
652 (defknown (find-if find-if-not)
653 (callable sequence &rest t &key (:from-end t) (:start index)
654 (:end sequence-end) (:key callable))
656 (foldable flushable call))
658 (defknown position (t sequence &rest t &key (:test callable)
659 (:test-not callable) (:start index) (:from-end t)
660 (:end sequence-end) (:key callable))
661 (or index null)
662 (foldable flushable call)
663 :derive-type #'position-derive-type)
665 (defknown (position-if position-if-not)
666 (callable sequence &rest t &key (:from-end t) (:start index)
667 (:end sequence-end) (:key callable))
668 (or index null)
669 (foldable flushable call)
670 :derive-type #'position-derive-type)
672 (defknown count (t sequence &rest t &key
673 (:test callable) (:test-not callable) (:start index)
674 (:from-end t) (:end sequence-end) (:key callable))
675 index
676 (foldable flushable call)
677 :derive-type #'count-derive-type)
679 (defknown (count-if count-if-not)
680 (callable sequence &rest t &key
681 (:from-end t) (:start index) (:end sequence-end) (:key callable))
682 index
683 (foldable flushable call)
684 :derive-type #'count-derive-type)
686 (defknown (mismatch search)
687 (sequence sequence &rest t &key (:from-end t) (:test callable)
688 (:test-not callable) (:start1 index) (:end1 sequence-end)
689 (:start2 index) (:end2 sequence-end) (:key callable))
690 (or index null)
691 (foldable flushable call))
693 ;;; not FLUSHABLE, since vector sort guaranteed in-place...
694 (defknown (stable-sort sort) (sequence callable &rest t &key (:key callable))
695 sequence
696 (call)
697 :derive-type (sequence-result-nth-arg 1)
698 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
699 (defknown sb!impl::stable-sort-list (list function function) list
700 (call important-result explicit-check)
701 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
702 (defknown sb!impl::sort-vector (vector index index function (or function null))
703 * ; SORT-VECTOR works through side-effect
704 (call)
705 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
707 (defknown sb!impl::stable-sort-vector
708 (vector function (or function null))
709 vector
710 (call explicit-check)
711 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
713 (defknown sb!impl::stable-sort-simple-vector
714 (simple-vector function (or function null))
715 simple-vector
716 (call explicit-check)
717 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
719 (defknown merge (type-specifier sequence sequence callable
720 &key (:key callable))
721 sequence
722 (call important-result)
723 :derive-type (creation-result-type-specifier-nth-arg 1)
724 :destroyed-constant-args (nth-constant-nonempty-sequence-args 2 3))
726 (defknown read-sequence (sequence stream
727 &key
728 (:start index)
729 (:end sequence-end))
730 (index)
733 (defknown write-sequence (sequence stream
734 &key
735 (:start index)
736 (:end sequence-end))
737 sequence
739 :derive-type #'result-type-first-arg)
741 ;;;; from the "Manipulating List Structure" chapter:
742 (defknown (car cdr first rest)
743 (list)
745 (foldable flushable))
747 ;; Correct argument type restrictions for these functions are
748 ;; complicated, so we just declare them to accept LISTs and suppress
749 ;; flushing is safe code.
750 (defknown (caar cadr cdar cddr
751 caaar caadr cadar caddr cdaar cdadr cddar cdddr
752 caaaar caaadr caadar caaddr cadaar cadadr caddar cadddr
753 cdaaar cdaadr cdadar cdaddr cddaar cddadr cdddar cddddr
754 second third fourth fifth sixth seventh eighth ninth tenth)
755 (list)
757 (foldable unsafely-flushable))
759 (defknown cons (t t) cons (movable flushable))
761 (defknown tree-equal (t t &key (:test callable) (:test-not callable)) boolean
762 (foldable flushable call))
763 (defknown endp (list) boolean (foldable flushable movable))
764 (defknown list-length (list) (or index null) (foldable unsafely-flushable))
765 (defknown (nth fast-&rest-nth) (unsigned-byte list) t (foldable flushable))
766 (defknown nthcdr (unsigned-byte list) t (foldable unsafely-flushable))
768 (defknown last (list &optional unsigned-byte) t (foldable flushable))
769 (defknown %last0 (list) t (foldable flushable))
770 (defknown %last1 (list) t (foldable flushable))
771 (defknown %lastn/fixnum (list (and unsigned-byte fixnum)) t (foldable flushable))
772 (defknown %lastn/bignum (list (and unsigned-byte bignum)) t (foldable flushable))
774 (defknown list (&rest t) list (movable flushable))
775 (defknown list* (t &rest t) t (movable flushable))
776 (defknown make-list (index &key (:initial-element t)) list
777 (movable flushable))
779 (defknown sb!impl::|List| (&rest t) list (movable flushable foldable))
780 (defknown sb!impl::|List*| (t &rest t) t (movable flushable foldable))
781 (defknown sb!impl::|Append| (&rest t) t (flushable foldable))
782 (defknown sb!impl::|Vector| (&rest t) simple-vector (flushable foldable))
784 ;;; All but last must be of type LIST, but there seems to be no way to
785 ;;; express that in this syntax.
786 (defknown append (&rest t) t (flushable))
787 (defknown sb!impl::append2 (list t) t (flushable))
789 (defknown copy-list (list) list (flushable))
790 (defknown copy-alist (list) list (flushable))
791 (defknown copy-tree (t) t (flushable recursive))
792 (defknown revappend (list t) t (flushable))
794 ;;; All but last must be of type LIST, but there seems to be no way to
795 ;;; express that in this syntax. The result must be LIST, but we do
796 ;;; not check it now :-).
797 (defknown nconc (&rest t) t ()
798 :destroyed-constant-args (remove-non-constants-and-nils #'butlast))
800 (defknown nreconc (list t) t (important-result)
801 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
802 (defknown butlast (list &optional unsigned-byte) list (flushable))
803 (defknown nbutlast (list &optional unsigned-byte) list ()
804 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
806 (defknown ldiff (list t) list (flushable))
807 (defknown (rplaca rplacd) (cons t) cons ()
808 :destroyed-constant-args (nth-constant-args 1))
810 (defknown subst (t t t &key (:key callable) (:test callable)
811 (:test-not callable))
812 t (flushable call))
813 (defknown nsubst (t t t &key (:key callable) (:test callable)
814 (:test-not callable))
815 t (call)
816 :destroyed-constant-args (nth-constant-nonempty-sequence-args 3))
818 (defknown (subst-if subst-if-not)
819 (t callable t &key (:key callable))
820 t (flushable call))
821 (defknown (nsubst-if nsubst-if-not)
822 (t callable t &key (:key callable))
823 t (call)
824 :destroyed-constant-args (nth-constant-nonempty-sequence-args 3))
826 (defknown sublis (list t &key (:key callable) (:test callable)
827 (:test-not callable))
828 t (flushable call))
829 (defknown nsublis (list t &key (:key callable) (:test callable)
830 (:test-not callable))
831 t (flushable call)
832 :destroyed-constant-args (nth-constant-nonempty-sequence-args 2))
834 (defknown member (t list &key (:key callable) (:test callable)
835 (:test-not callable))
836 list (foldable flushable call))
837 (defknown (member-if member-if-not) (callable list &key (:key callable))
838 list (foldable flushable call))
840 (defknown tailp (t list) boolean (foldable flushable))
842 (defknown adjoin (t list &key (:key callable) (:test callable)
843 (:test-not callable))
844 cons (flushable call))
846 (defknown (union intersection set-difference set-exclusive-or)
847 (list list &key (:key callable) (:test callable) (:test-not callable))
848 list
849 (foldable flushable call))
851 (defknown (nunion nintersection nset-difference nset-exclusive-or)
852 (list list &key (:key callable) (:test callable) (:test-not callable))
853 list
854 (foldable flushable call important-result)
855 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1 2))
857 (defknown subsetp
858 (list list &key (:key callable) (:test callable) (:test-not callable))
859 boolean
860 (foldable flushable call))
862 (defknown acons (t t t) cons (movable flushable))
863 (defknown pairlis (t t &optional t) list (flushable))
865 (defknown (rassoc assoc)
866 (t list &key (:key callable) (:test callable) (:test-not callable))
867 list (foldable flushable call))
868 (defknown (assoc-if-not assoc-if rassoc-if rassoc-if-not)
869 (callable list &key (:key callable)) list (foldable flushable call))
871 (defknown (memq assq) (t list) list (foldable flushable))
872 (defknown delq (t list) list (flushable)
873 :destroyed-constant-args (nth-constant-nonempty-sequence-args 2))
875 ;;;; from the "Hash Tables" chapter:
877 (defknown make-hash-table
878 (&key (:test callable) (:size unsigned-byte)
879 (:rehash-size (or (integer 1) (float (1.0))))
880 (:rehash-threshold (real 0 1))
881 (:hash-function (or null callable))
882 (:weakness (member nil :key :value :key-and-value :key-or-value))
883 (:synchronized t))
884 hash-table
885 (flushable))
886 (defknown hash-table-p (t) boolean (movable foldable flushable))
887 (defknown gethash (t hash-table &optional t) (values t boolean)
888 (flushable)) ; not FOLDABLE, since hash table contents can change
889 (defknown sb!impl::gethash3 (t hash-table t) (values t boolean)
890 (flushable)) ; not FOLDABLE, since hash table contents can change
891 (defknown %puthash (t hash-table t) t ()
892 :destroyed-constant-args (nth-constant-args 2)
893 :derive-type #'result-type-last-arg)
894 (defknown remhash (t hash-table) boolean ()
895 :destroyed-constant-args (nth-constant-args 2))
896 (defknown maphash (callable hash-table) null (flushable call))
897 (defknown clrhash (hash-table) hash-table ()
898 :destroyed-constant-args (nth-constant-args 2))
899 (defknown hash-table-count (hash-table) index (flushable))
900 (defknown hash-table-rehash-size (hash-table) (or index (single-float (1.0)))
901 (foldable flushable))
902 (defknown hash-table-rehash-threshold (hash-table) (single-float (0.0) 1.0)
903 (foldable flushable))
904 (defknown hash-table-size (hash-table) index (flushable))
905 (defknown hash-table-test (hash-table) symbol (foldable flushable))
906 (defknown sxhash (t) hash (#-sb-xc-host foldable flushable))
907 (defknown psxhash (t &optional t) hash (#-sb-xc-host foldable flushable))
908 (defknown hash-table-equalp (hash-table hash-table) boolean (foldable flushable))
910 ;;;; from the "Arrays" chapter
912 (defknown make-array ((or index list)
913 &key
914 (:element-type type-specifier)
915 (:initial-element t)
916 (:initial-contents t)
917 (:adjustable t)
918 ;; the type constraint doesn't do anything
919 ;; on account of EXPLICIT-CHECK. it's documentation.
920 (:fill-pointer (or index boolean))
921 (:displaced-to (or array null))
922 (:displaced-index-offset index))
923 array (flushable explicit-check))
925 (defknown %make-array ((or index list)
926 (unsigned-byte #.sb!vm:n-widetag-bits)
927 (unsigned-byte 16)
928 &key
929 (:element-type type-specifier)
930 (:initial-element t)
931 (:initial-contents t)
932 (:adjustable t)
933 (:fill-pointer (or index boolean))
934 (:displaced-to (or array null))
935 (:displaced-index-offset index))
936 array (flushable))
938 (defknown sb!impl::fill-data-vector (vector list sequence)
940 (explicit-check))
942 (defknown vector (&rest t) simple-vector (flushable))
944 (defknown aref (array &rest index) t (foldable))
945 (defknown row-major-aref (array index) t (foldable))
947 (defknown array-element-type (array)
948 type-specifier
949 (foldable flushable recursive))
950 (defknown array-rank (array) array-rank (foldable flushable))
951 ;; FIXME: there's a fencepost bug, but for all practical purposes our
952 ;; ARRAY-RANK-LIMIT is infinite, thus masking the bug. e.g. if the
953 ;; exclusive limit on rank were 8, then your dimension numbers can
954 ;; be in the range 0 through 6, not 0 through 7.
955 (defknown array-dimension (array array-rank) index (foldable flushable))
956 (defknown array-dimensions (array) list (foldable flushable))
957 (defknown array-in-bounds-p (array &rest integer) boolean (foldable flushable))
958 (defknown array-row-major-index (array &rest index) array-total-size
959 (foldable flushable))
960 (defknown array-total-size (array) array-total-size (foldable flushable))
961 (defknown adjustable-array-p (array) boolean (movable foldable flushable))
963 (defknown svref (simple-vector index) t (foldable flushable))
964 (defknown bit ((array bit) &rest index) bit (foldable flushable))
965 (defknown sbit ((simple-array bit) &rest index) bit (foldable flushable))
967 ;;; FIXME: :DESTROYED-CONSTANT-ARGS for these is complicated.
968 (defknown (bit-and bit-ior bit-xor bit-eqv bit-nand bit-nor bit-andc1 bit-andc2
969 bit-orc1 bit-orc2)
970 ((array bit) (array bit) &optional (or (array bit) (member t nil)))
971 (array bit)
973 #|:derive-type #'result-type-last-arg|#)
975 (defknown bit-not ((array bit) &optional (or (array bit) (member t nil)))
976 (array bit)
978 #|:derive-type #'result-type-last-arg|#)
980 (defknown bit-vector-= (bit-vector bit-vector) boolean
981 (movable foldable flushable))
983 (defknown array-has-fill-pointer-p (array) boolean
984 (movable foldable flushable))
985 (defknown fill-pointer (complex-vector) index
986 (unsafely-flushable explicit-check))
987 (defknown sb!impl::fill-pointer-error (t &optional t) nil)
989 (defknown vector-push (t complex-vector) (or index null)
990 (explicit-check)
991 :destroyed-constant-args (nth-constant-args 2))
992 (defknown vector-push-extend (t complex-vector &optional (and index (integer 1))) index
993 (explicit-check)
994 :destroyed-constant-args (nth-constant-args 2))
995 (defknown vector-pop (complex-vector) t
996 (explicit-check)
997 :destroyed-constant-args (nth-constant-args 1))
999 ;;; FIXME: complicated :DESTROYED-CONSTANT-ARGS
1000 ;;; Also, an important-result warning could be provided if the array
1001 ;;; is known to be not expressly adjustable.
1002 (defknown adjust-array
1003 (array (or index list) &key (:element-type type-specifier)
1004 (:initial-element t) (:initial-contents t)
1005 (:fill-pointer (or index boolean))
1006 (:displaced-to (or array null))
1007 (:displaced-index-offset index))
1008 array ())
1009 ; :derive-type 'result-type-arg1) Not even close...
1011 ;;;; from the "Strings" chapter:
1013 (defknown char (string index) character (foldable flushable))
1014 (defknown schar (simple-string index) character (foldable flushable))
1016 (defknown (string= string-equal)
1017 (string-designator string-designator &key (:start1 index) (:end1 sequence-end)
1018 (:start2 index) (:end2 sequence-end))
1019 boolean
1020 (foldable flushable))
1022 (defknown (string< string> string<= string>= string/= string-lessp
1023 string-greaterp string-not-lessp string-not-greaterp
1024 string-not-equal)
1025 (string-designator string-designator &key (:start1 index) (:end1 sequence-end)
1026 (:start2 index) (:end2 sequence-end))
1027 (or index null)
1028 (foldable flushable))
1030 (defknown make-string (index &key (:element-type type-specifier)
1031 (:initial-element character))
1032 simple-string (flushable))
1034 (defknown (string-trim string-left-trim string-right-trim)
1035 (sequence string-designator) string (flushable))
1037 (defknown (string-upcase string-downcase string-capitalize)
1038 (string-designator &key (:start index) (:end sequence-end))
1039 simple-string (flushable))
1041 (defknown (nstring-upcase nstring-downcase nstring-capitalize)
1042 (string &key (:start index) (:end sequence-end))
1043 string ()
1044 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
1046 (defknown string (string-designator) string
1047 (flushable explicit-check))
1049 ;;;; internal non-keyword versions of string predicates:
1051 (defknown (string<* string>* string<=* string>=* string/=*)
1052 (string-designator string-designator index sequence-end index sequence-end)
1053 (or index null)
1054 (foldable flushable))
1056 (defknown string=*
1057 (string-designator string-designator index sequence-end index sequence-end)
1058 boolean
1059 (foldable flushable))
1061 ;;;; from the "Eval" chapter:
1063 (defknown eval (t) * (recursive))
1064 (defknown constantp (t &optional lexenv-designator) boolean
1065 (foldable flushable))
1067 ;;;; from the "Streams" chapter:
1069 (defknown make-synonym-stream (symbol) stream (flushable))
1070 (defknown make-broadcast-stream (&rest stream) stream (unsafely-flushable))
1071 (defknown make-concatenated-stream (&rest stream) stream (unsafely-flushable))
1072 (defknown make-two-way-stream (stream stream) stream (unsafely-flushable))
1073 (defknown make-echo-stream (stream stream) stream (flushable))
1074 (defknown make-string-input-stream (string &optional index sequence-end)
1075 stream
1076 (flushable))
1077 (defknown make-string-output-stream
1078 (&key (:element-type type-specifier))
1079 string-output-stream
1080 (flushable))
1081 (defknown get-output-stream-string (stream) simple-string ())
1082 (defknown streamp (t) boolean (movable foldable flushable))
1083 (defknown stream-element-type (stream) type-specifier
1084 (movable foldable flushable))
1085 (defknown stream-external-format (stream) t (flushable))
1086 (defknown (output-stream-p input-stream-p) (stream) boolean
1087 (movable foldable flushable))
1088 (defknown open-stream-p (stream) boolean (flushable))
1089 (defknown close (stream &key (:abort t)) (eql t) ())
1090 (defknown file-string-length (ansi-stream (or string character))
1091 (or unsigned-byte null)
1092 (flushable))
1094 ;;;; from the "Input/Output" chapter:
1096 ;;; (The I/O functions are given effects ANY under the theory that
1097 ;;; code motion over I/O operations is particularly confusing and not
1098 ;;; very important for efficiency.)
1100 (defknown copy-readtable (&optional (or readtable null) (or readtable null))
1101 readtable
1103 (defknown readtablep (t) boolean (movable foldable flushable))
1105 (defknown set-syntax-from-char
1106 (character character &optional readtable (or readtable null)) (eql t)
1109 (defknown set-macro-character (character callable &optional t (or readtable null))
1110 (eql t)
1112 (defknown get-macro-character (character &optional (or readtable null))
1113 (values callable boolean) (flushable))
1115 (defknown make-dispatch-macro-character (character &optional t readtable)
1116 (eql t) ())
1117 (defknown set-dispatch-macro-character
1118 (character character callable &optional (or readtable null)) (eql t)
1120 (defknown get-dispatch-macro-character
1121 (character character &optional (or readtable null)) (or callable null)
1124 (defknown copy-pprint-dispatch
1125 (&optional (or sb!pretty:pprint-dispatch-table null))
1126 sb!pretty:pprint-dispatch-table
1128 (defknown pprint-dispatch
1129 (t &optional (or sb!pretty:pprint-dispatch-table null))
1130 (values callable boolean)
1132 (defknown (pprint-fill pprint-linear)
1133 (stream-designator t &optional t t)
1134 null
1136 (defknown pprint-tabular
1137 (stream-designator t &optional t t unsigned-byte)
1138 null
1140 (defknown pprint-indent
1141 ((member :block :current) real &optional stream-designator)
1142 null
1144 (defknown pprint-newline
1145 ((member :linear :fill :miser :mandatory) &optional stream-designator)
1146 null
1148 (defknown pprint-tab
1149 ((member :line :section :line-relative :section-relative)
1150 unsigned-byte unsigned-byte &optional stream-designator)
1151 null
1153 (defknown set-pprint-dispatch
1154 (type-specifier (or null callable)
1155 &optional real sb!pretty:pprint-dispatch-table)
1156 null
1159 ;;; may return any type due to eof-value...
1160 ;;; and because READ generally returns anything.
1161 (defknown (read read-preserving-whitespace)
1162 (&optional stream-designator t t t) t (explicit-check))
1164 (defknown read-char (&optional stream-designator t t t) t (explicit-check)
1165 :derive-type (read-elt-type-deriver nil 'character nil))
1166 (defknown read-char-no-hang (&optional stream-designator t t t) t
1167 (explicit-check)
1168 :derive-type (read-elt-type-deriver nil 'character t))
1170 (defknown read-delimited-list (character &optional stream-designator t) list
1171 (explicit-check))
1172 ;; FIXME: add a type-deriver => (values (or string eof-value) boolean)
1173 (defknown read-line (&optional stream-designator t t t) (values t boolean)
1174 (explicit-check))
1175 (defknown unread-char (character &optional stream-designator) t
1176 (explicit-check))
1177 (defknown peek-char (&optional (or character (member nil t))
1178 stream-designator t t t) t
1179 (explicit-check)
1180 :derive-type (read-elt-type-deriver t 'character nil))
1182 (defknown listen (&optional stream-designator) boolean (flushable explicit-check))
1184 (defknown clear-input (&optional stream-designator) null (explicit-check))
1186 (defknown read-from-string
1187 (string &optional t t
1188 &key
1189 (:start index)
1190 (:end sequence-end)
1191 (:preserve-whitespace t))
1192 (values t index))
1193 (defknown parse-integer
1194 (string &key
1195 (:start index)
1196 (:end sequence-end)
1197 (:radix (integer 2 36))
1198 (:junk-allowed t))
1199 (values (or integer null ()) index))
1201 (defknown read-byte (stream &optional t t) t (explicit-check)
1202 :derive-type (read-elt-type-deriver nil 'integer nil))
1204 (defknown (prin1 print princ) (t &optional stream-designator)
1206 (any explicit-check)
1207 :derive-type #'result-type-first-arg)
1209 (defknown output-object (t stream) null (any explicit-check))
1210 (defknown %write (t stream-designator) t (any explicit-check))
1212 (defknown (pprint) (t &optional stream-designator) (values)
1213 (explicit-check))
1215 (macrolet
1216 ((deffrob (name keys returns attributes &rest more)
1217 `(defknown ,name
1218 (t &key ,@keys
1219 (:escape t)
1220 (:radix t)
1221 (:base (integer 2 36))
1222 (:circle t)
1223 (:pretty t)
1224 (:readably t)
1225 (:level (or unsigned-byte null))
1226 (:length (or unsigned-byte null))
1227 (:case t)
1228 (:array t)
1229 (:gensym t)
1230 (:lines (or unsigned-byte null))
1231 (:right-margin (or unsigned-byte null))
1232 (:miser-width (or unsigned-byte null))
1233 (:pprint-dispatch t)
1234 (:suppress-errors t))
1235 ,returns ,attributes ,@more)))
1236 (deffrob write ((:stream stream-designator)) t (any explicit-check)
1237 :derive-type #'result-type-first-arg)
1238 ;;; xxx-TO-STRING functions are not foldable because they depend on
1239 ;;; the dynamic environment, the state of the pretty printer dispatch
1240 ;;; table, and probably other run-time factors.
1241 (deffrob write-to-string () simple-string
1242 (unsafely-flushable explicit-check)))
1244 (defknown (prin1-to-string princ-to-string) (t) simple-string (flushable))
1245 (defknown sb!impl::stringify-object (t) simple-string)
1247 (defknown write-char (character &optional stream-designator) character
1248 (explicit-check)
1249 :derive-type #'result-type-first-arg)
1251 (defknown (write-string write-line)
1252 (string &optional stream-designator &key (:start index) (:end sequence-end))
1253 string
1254 (explicit-check)
1255 :derive-type #'result-type-first-arg)
1257 (defknown (terpri finish-output force-output clear-output)
1258 (&optional stream-designator) null
1259 (explicit-check))
1261 (defknown fresh-line (&optional stream-designator) boolean
1262 (explicit-check))
1264 (defknown write-byte (integer stream) integer
1265 (explicit-check)
1266 :derive-type #'result-type-first-arg)
1268 ;;; FIXME: complicated :DESTROYED-CONSTANT-ARGS
1269 (defknown format ((or (member nil t) stream string)
1270 (or string function) &rest t)
1271 (or string null)
1272 (explicit-check))
1273 (defknown sb!format::args-exhausted (string integer) nil)
1275 (defknown (y-or-n-p yes-or-no-p) (&optional string &rest t) boolean
1276 (explicit-check))
1278 ;;;; from the "File System Interface" chapter:
1280 ;;; (No pathname functions are FOLDABLE because they all potentially
1281 ;;; depend on *DEFAULT-PATHNAME-DEFAULTS*, e.g. to provide a default
1282 ;;; host when parsing a namestring. They are not FLUSHABLE because
1283 ;;; parsing of a PATHNAME-DESIGNATOR might signal an error.)
1285 (defknown wild-pathname-p (pathname-designator
1286 &optional
1287 (member nil :host :device
1288 :directory :name
1289 :type :version))
1290 generalized-boolean
1291 (recursive))
1293 (defknown pathname-match-p (pathname-designator pathname-designator)
1294 generalized-boolean
1297 (defknown translate-pathname (pathname-designator
1298 pathname-designator
1299 pathname-designator &key)
1300 pathname
1303 (defknown logical-pathname (pathname-designator) logical-pathname ())
1304 (defknown translate-logical-pathname (pathname-designator &key) pathname
1305 (recursive))
1306 (defknown load-logical-pathname-translations (string) t ())
1307 (defknown logical-pathname-translations (logical-host-designator) list ())
1309 (defknown pathname (pathname-designator) pathname ())
1310 (defknown truename (pathname-designator) pathname ())
1312 (defknown parse-namestring
1313 (pathname-designator &optional
1314 (or list host string (member :unspecific))
1315 pathname-designator
1316 &key
1317 (:start index)
1318 (:end sequence-end)
1319 (:junk-allowed t))
1320 (values (or pathname null) sequence-end)
1321 (recursive))
1323 (defknown merge-pathnames
1324 (pathname-designator &optional pathname-designator pathname-version)
1325 pathname
1328 (defknown make-pathname
1329 (&key (:defaults pathname-designator)
1330 (:host (or string pathname-host))
1331 (:device (or string pathname-device))
1332 (:directory (or pathname-directory string (member :wild)))
1333 (:name (or pathname-name string (member :wild)))
1334 (:type (or pathname-type string (member :wild)))
1335 (:version pathname-version) (:case (member :local :common)))
1336 pathname (unsafely-flushable))
1338 (defknown pathnamep (t) boolean (movable flushable))
1340 (defknown pathname-host (pathname-designator
1341 &key (:case (member :local :common)))
1342 pathname-host (flushable))
1343 (defknown pathname-device (pathname-designator
1344 &key (:case (member :local :common)))
1345 pathname-device (flushable))
1346 (defknown pathname-directory (pathname-designator
1347 &key (:case (member :local :common)))
1348 pathname-directory (flushable))
1349 (defknown pathname-name (pathname-designator
1350 &key (:case (member :local :common)))
1351 pathname-name (flushable))
1352 (defknown pathname-type (pathname-designator
1353 &key (:case (member :local :common)))
1354 pathname-type (flushable))
1355 (defknown pathname-version (pathname-designator)
1356 pathname-version (flushable))
1358 (defknown pathname= (pathname pathname) boolean (movable foldable flushable))
1360 (defknown (namestring file-namestring directory-namestring host-namestring)
1361 (pathname-designator) (or simple-string null)
1362 (unsafely-flushable))
1364 (defknown enough-namestring (pathname-designator &optional pathname-designator)
1365 simple-string
1366 (unsafely-flushable))
1368 (defknown user-homedir-pathname (&optional t) pathname (flushable))
1370 (defknown open
1371 (pathname-designator &key
1372 (:class symbol)
1373 (:direction (member :input :output :io :probe))
1374 (:element-type type-specifier)
1375 (:if-exists (member :error :new-version :rename
1376 :rename-and-delete :overwrite
1377 :append :supersede nil))
1378 (:if-does-not-exist (member :error :create nil))
1379 (:external-format external-format-designator))
1380 (or stream null))
1382 (defknown rename-file (pathname-designator filename)
1383 (values pathname pathname pathname))
1384 (defknown delete-file (pathname-designator) (eql t))
1385 (defknown probe-file (pathname-designator) (or pathname null) ())
1386 (defknown file-write-date (pathname-designator) (or unsigned-byte null)
1388 (defknown file-author (pathname-designator) (or simple-string null)
1391 (defknown file-position (stream &optional
1392 (or unsigned-byte (member :start :end)))
1393 (or unsigned-byte (member t nil)))
1394 (defknown file-length (stream) (or unsigned-byte null) (unsafely-flushable))
1396 (defknown load
1397 ((or filename stream)
1398 &key
1399 (:verbose t)
1400 (:print t)
1401 (:if-does-not-exist t)
1402 (:external-format external-format-designator))
1403 boolean)
1405 (defknown directory (pathname-designator &key (:resolve-symlinks t))
1406 list ())
1408 ;;;; from the "Conditions" chapter:
1410 (defknown error (t &rest t) nil)
1411 (defknown cerror (format-control t &rest t) null)
1412 (defknown invalid-method-error (t format-control &rest t) *) ; FIXME: first arg is METHOD
1413 (defknown method-combination-error (format-control &rest t) *)
1414 (defknown signal (t &rest t) null)
1415 (defknown warn (t &rest t) null)
1416 (defknown invoke-debugger (condition) nil)
1417 (defknown break (&optional format-control &rest t) null)
1418 (defknown make-condition (type-specifier &rest t) condition)
1419 (defknown compute-restarts (&optional (or condition null)) list)
1420 (defknown find-restart (restart-designator &optional (or condition null))
1421 (or restart null))
1422 (defknown invoke-restart (restart-designator &rest t) *)
1423 (defknown invoke-restart-interactively (restart-designator) *)
1424 (defknown restart-name (restart) symbol)
1425 (defknown (abort muffle-warning) (&optional (or condition null)) nil)
1426 (defknown continue (&optional (or condition null)) null)
1427 (defknown (store-value use-value) (t &optional (or condition null))
1428 null)
1430 ;;; and analogous SBCL extension:
1431 (defknown sb!impl::%failed-aver (t) nil)
1432 (defknown bug (t &rest t) nil) ; never returns
1433 (defknown sb!int:simple-reader-error (stream string &rest t) nil)
1434 (defknown sb!kernel:reader-eof-error (stream string) nil)
1437 ;;;; from the "Miscellaneous" Chapter:
1439 (defknown compile ((or symbol cons) &optional (or list function null))
1440 (values (or function symbol cons) boolean boolean))
1442 (defknown compile-file
1443 (pathname-designator
1444 &key
1446 ;; ANSI options
1447 (:output-file (or pathname-designator
1448 null
1449 ;; FIXME: This last case is a non-ANSI hack.
1450 (member t)))
1451 (:verbose t)
1452 (:print t)
1453 (:external-format external-format-designator)
1455 ;; extensions
1456 (:trace-file t)
1457 (:block-compile t)
1458 (:emit-cfasl t))
1459 (values (or pathname null) boolean boolean))
1461 (defknown (compile-file-pathname)
1462 (pathname-designator &key (:output-file (or pathname-designator
1463 null
1464 (member t)))
1465 &allow-other-keys)
1466 pathname)
1468 ;; FIXME: consider making (OR CALLABLE CONS) something like
1469 ;; EXTENDED-FUNCTION-DESIGNATOR
1470 (defknown disassemble ((or callable cons) &key
1471 (:stream stream) (:use-labels t))
1472 null)
1474 (defknown describe (t &optional (or stream (member t nil))) (values))
1475 (defknown function-lambda-expression (function) (values t boolean t))
1476 (defknown inspect (t) (values))
1477 (defknown room (&optional (member t nil :default)) (values))
1478 (defknown ed (&optional (or symbol cons filename))
1480 (defknown dribble (&optional filename &key (:if-exists t)) (values))
1482 (defknown apropos (string-designator &optional package-designator t) (values))
1483 (defknown apropos-list (string-designator &optional package-designator t) list
1484 (flushable recursive))
1486 (defknown get-decoded-time ()
1487 (values (integer 0 59) (integer 0 59) (integer 0 23) (integer 1 31)
1488 (integer 1 12) unsigned-byte (integer 0 6) boolean (rational -24 24))
1489 (flushable))
1491 (defknown get-universal-time () unsigned-byte (flushable))
1493 (defknown decode-universal-time
1494 (unsigned-byte &optional (or null (rational -24 24)))
1495 (values (integer 0 59) (integer 0 59) (integer 0 23) (integer 1 31)
1496 (integer 1 12) unsigned-byte (integer 0 6) boolean (rational -24 24))
1497 (flushable))
1499 (defknown encode-universal-time
1500 ((integer 0 59) (integer 0 59) (integer 0 23) (integer 1 31)
1501 (integer 1 12) unsigned-byte &optional (or null (rational -24 24)))
1502 unsigned-byte
1503 (flushable))
1505 (defknown (get-internal-run-time get-internal-real-time)
1506 () internal-time (flushable))
1508 (defknown sleep ((real 0)) null (explicit-check))
1510 (defknown call-with-timing (callable callable &rest t) *
1511 (call))
1513 ;;; Even though ANSI defines LISP-IMPLEMENTATION-TYPE and
1514 ;;; LISP-IMPLEMENTATION-VERSION to possibly punt and return NIL, we
1515 ;;; know that there's no valid reason for our implementations to ever
1516 ;;; do so, so we can safely guarantee that they'll return strings.
1517 (defknown (lisp-implementation-type lisp-implementation-version)
1518 () simple-string (flushable))
1520 ;;; For any of these functions, meaningful information might not be
1521 ;;; available, so -- unlike the related LISP-IMPLEMENTATION-FOO
1522 ;;; functions -- these really can return NIL.
1523 (defknown (machine-type machine-version machine-instance
1524 software-type software-version
1525 short-site-name long-site-name)
1526 () (or simple-string null) (flushable))
1528 (defknown identity (t) t (movable foldable flushable)
1529 :derive-type #'result-type-first-arg)
1531 (defknown constantly (t) function (movable flushable))
1532 (defknown complement (function) function (movable flushable))
1534 ;;;; miscellaneous extensions
1536 (defknown symbol-global-value (symbol) t ())
1537 (defknown set-symbol-global-value (symbol t) t ()
1538 :derive-type #'result-type-last-arg)
1540 (defknown get-bytes-consed () unsigned-byte (flushable))
1541 (defknown mask-signed-field ((integer 0 *) integer) integer
1542 (movable flushable foldable))
1544 (defknown array-storage-vector (array) (simple-array * (*))
1545 (any))
1547 ;;;; magical compiler frobs
1549 (defknown %rest-values (t t t) * (always-translatable))
1550 (defknown %rest-ref (t t t t &optional boolean) * (always-translatable))
1551 (defknown %rest-length (t t t) * (always-translatable))
1552 (defknown %rest-null (t t t t) * (always-translatable))
1553 (defknown %rest-true (t t t) * (always-translatable))
1555 (defknown %unary-truncate/single-float (single-float) integer (movable foldable flushable))
1556 (defknown %unary-truncate/double-float (double-float) integer (movable foldable flushable))
1558 ;;; We can't fold this in general because of SATISFIES. There is a
1559 ;;; special optimizer anyway.
1560 (defknown %typep (t (or type-specifier ctype)) boolean
1561 (movable flushable explicit-check))
1562 (defknown %instance-typep (t (or type-specifier ctype)) boolean
1563 (movable flushable explicit-check always-translatable))
1564 ;;; We should never emit a call to %typep-wrapper
1565 (defknown %typep-wrapper (t t (or type-specifier ctype)) t
1566 (movable flushable always-translatable))
1568 (defknown %cleanup-point () t)
1569 (defknown %special-bind (t t) t)
1570 (defknown %special-unbind (t) t)
1571 (defknown %listify-rest-args (t index) list (flushable))
1572 (defknown %more-arg-context (t t) (values t index) (flushable))
1573 (defknown %more-arg (t index) t)
1574 #!+stack-grows-downward-not-upward
1575 ;;; FIXME: The second argument here should really be NEGATIVE-INDEX, but doing that
1576 ;;; breaks the build, and I cannot seem to figure out why. --NS 2006-06-29
1577 (defknown %more-kw-arg (t fixnum) (values t t))
1578 (defknown %more-arg-values (t index index) * (flushable))
1580 #!-precise-arg-count-error
1581 (defknown %verify-arg-count (index index) (values))
1583 (defknown %arg-count-error (t t) nil)
1584 (defknown %unknown-values () *)
1585 (defknown %catch (t t) t)
1586 (defknown %unwind-protect (t t) t)
1587 (defknown (%catch-breakup %unwind-protect-breakup) () t)
1588 (defknown %lexical-exit-breakup (t) t)
1589 (defknown %continue-unwind (t t t) nil)
1590 (defknown %throw (t &rest t) nil) ; This is MV-called.
1591 (defknown %nlx-entry (t) *)
1592 (defknown %%primitive (t t &rest t) *)
1593 (defknown %pop-values (t) t)
1594 (defknown %nip-values (t t &rest t) (values))
1595 (defknown %dummy-dx-alloc (t t) t)
1596 (defknown %allocate-closures (t) *)
1597 (defknown %type-check-error (t t) nil)
1598 (defknown %type-check-error/c (t t) nil)
1600 ;; FIXME: This function does not return, but due to the implementation
1601 ;; of FILTER-LVAR we cannot write it here.
1602 (defknown %compile-time-type-error (t t t t t) *)
1603 (defknown case-failure (t t t) nil)
1605 (defknown %odd-key-args-error () nil)
1606 (defknown %unknown-key-arg-error (t) nil)
1607 (defknown (%ldb %mask-field) (bit-index bit-index integer) unsigned-byte
1608 (movable foldable flushable explicit-check))
1609 (defknown (%dpb %deposit-field) (integer bit-index bit-index integer) integer
1610 (movable foldable flushable explicit-check))
1611 (defknown %negate (number) number (movable foldable flushable explicit-check))
1612 (defknown %check-bound (array index fixnum) index
1613 (movable foldable flushable dx-safe))
1614 (defknown data-vector-ref (simple-array index) t
1615 (foldable unsafely-flushable explicit-check always-translatable))
1616 (defknown data-vector-ref-with-offset (simple-array fixnum fixnum) t
1617 (foldable unsafely-flushable explicit-check always-translatable))
1618 (defknown data-nil-vector-ref (simple-array index) nil
1619 (explicit-check always-translatable))
1620 (defknown data-vector-set (array index t) t
1621 (explicit-check always-translatable))
1622 (defknown data-vector-set-with-offset (array fixnum fixnum t) t
1623 (explicit-check always-translatable))
1624 (defknown hairy-data-vector-ref (array index) t
1625 (foldable explicit-check))
1626 (defknown hairy-data-vector-set (array index t) t (explicit-check))
1627 (defknown hairy-data-vector-ref/check-bounds (array index) t
1628 (foldable explicit-check))
1629 (defknown hairy-data-vector-set/check-bounds (array index t)
1631 (explicit-check))
1632 (defknown %caller-frame () t (flushable))
1633 (defknown %caller-pc () system-area-pointer (flushable))
1634 (defknown %with-array-data (array index (or index null))
1635 (values (simple-array * (*)) index index index)
1636 (foldable flushable))
1637 (defknown %with-array-data/fp (array index (or index null))
1638 (values (simple-array * (*)) index index index)
1639 (foldable flushable))
1640 (defknown %set-symbol-package (symbol t) t ())
1641 (defknown %coerce-callable-to-fun (callable) function
1642 (flushable explicit-check))
1643 (defknown array-bounding-indices-bad-error (t t t) nil)
1644 (defknown sequence-bounding-indices-bad-error (t t t) nil)
1645 (defknown %find-position
1646 (t sequence t index sequence-end function function)
1647 (values t (or index null))
1648 (flushable call))
1649 (defknown (%find-position-if %find-position-if-not)
1650 (function sequence t index sequence-end function)
1651 (values t (or index null))
1652 (call))
1653 (defknown effective-find-position-test (callable callable)
1654 function
1655 (flushable foldable))
1656 (defknown effective-find-position-key (callable)
1657 function
1658 (flushable foldable))
1660 (defknown (%adjoin %adjoin-eq)
1661 (t list)
1662 list
1663 (explicit-check flushable))
1665 (defknown (%member %member-eq
1666 %assoc %assoc-eq %rassoc %rassoc-eq)
1667 (t list)
1668 list
1669 (explicit-check foldable flushable))
1671 (defknown (%adjoin-key %adjoin-key-eq)
1672 (t list function)
1673 list
1674 (explicit-check flushable call))
1676 (defknown (%member-key %member-key-eq
1677 %assoc-key %assoc-key-eq %rassoc-key %rassoc-key-eq)
1678 (t list function)
1679 list
1680 (explicit-check foldable flushable call))
1682 (defknown (%assoc-if %assoc-if-not %rassoc-if %rassoc-if-not
1683 %member-if %member-if-not)
1684 (function list)
1685 list
1686 (explicit-check foldable flushable call))
1688 (defknown (%assoc-if-key %assoc-if-not-key %rassoc-if-key %rassoc-if-not-key
1689 %member-if-key %member-if-not-key)
1690 (function list function)
1691 list
1692 (explicit-check foldable flushable call))
1694 (defknown (%adjoin-test %adjoin-test-not)
1695 (t list function)
1696 list
1697 (explicit-check flushable call))
1699 (defknown (%member-test %member-test-not
1700 %assoc-test %assoc-test-not
1701 %rassoc-test %rassoc-test-not)
1702 (t list function)
1703 list
1704 (explicit-check foldable flushable call))
1706 (defknown (%adjoin-key-test %adjoin-key-test-not)
1707 (t list function function)
1708 list
1709 (explicit-check flushable call))
1711 (defknown (%member-key-test %member-key-test-not
1712 %assoc-key-test %assoc-key-test-not
1713 %rassoc-key-test %rassoc-key-test-not)
1714 (t list function function)
1715 list
1716 (explicit-check foldable flushable call))
1718 (defknown %check-vector-sequence-bounds (vector index sequence-end)
1719 index
1720 (unwind))
1722 ;;;; SETF inverses
1724 (defknown (setf aref) (t array &rest index) t ()
1725 :destroyed-constant-args (nth-constant-args 2)
1726 :derive-type #'result-type-first-arg)
1727 (defknown %set-row-major-aref (array index t) t ()
1728 :destroyed-constant-args (nth-constant-args 1))
1729 (defknown (%rplaca %rplacd) (cons t) t ()
1730 :destroyed-constant-args (nth-constant-args 1)
1731 :derive-type #'result-type-last-arg)
1732 (defknown %put (symbol t t) t ())
1733 (defknown %setelt (sequence index t) t ()
1734 :destroyed-constant-args (nth-constant-args 1)
1735 :derive-type #'result-type-last-arg)
1736 (defknown %svset (simple-vector index t) t ()
1737 :destroyed-constant-args (nth-constant-args 1))
1738 (defknown (setf bit) (bit (array bit) &rest index) bit ()
1739 :destroyed-constant-args (nth-constant-args 2))
1740 (defknown (setf sbit) (bit (simple-array bit) &rest index) bit ()
1741 :destroyed-constant-args (nth-constant-args 2))
1742 (defknown %charset (string index character) character ()
1743 :destroyed-constant-args (nth-constant-args 1))
1744 (defknown %scharset (simple-string index character) character ()
1745 :destroyed-constant-args (nth-constant-args 1))
1746 (defknown %set-symbol-value (symbol t) t ())
1747 (defknown (setf symbol-function) (function symbol) function ())
1748 (defknown %set-symbol-plist (symbol list) list ()
1749 :derive-type #'result-type-last-arg)
1750 (defknown %setnth (unsigned-byte list t) t ()
1751 :destroyed-constant-args (nth-constant-args 2)
1752 :derive-type #'result-type-last-arg)
1753 (defknown %set-fill-pointer (complex-vector index) index
1754 (explicit-check)
1755 :destroyed-constant-args (nth-constant-args 1)
1756 :derive-type #'result-type-last-arg)
1758 ;;;; ALIEN and call-out-to-C stuff
1760 ;; Used by WITH-PINNED-OBJECTS
1761 #!+(or x86 x86-64)
1762 (defknown sb!vm::touch-object (t) (values)
1763 (always-translatable))
1765 #!+linkage-table
1766 (defknown foreign-symbol-dataref-sap (simple-string)
1767 system-area-pointer
1768 (movable flushable))
1770 (defknown foreign-symbol-sap (simple-string &optional boolean)
1771 system-area-pointer
1772 (movable flushable))
1774 (defknown foreign-symbol-address (simple-string &optional boolean)
1775 (values integer boolean)
1776 (movable flushable))
1778 ;;;; miscellaneous internal utilities
1780 (defknown %fun-name (function) t (flushable))
1781 (defknown (setf %fun-name) (t function) t ())
1783 (defknown policy-quality (policy symbol) policy-quality
1784 (flushable))
1786 (defknown compiler-error (t &rest t) nil ())
1787 (defknown (compiler-warn compiler-style-warn) (t &rest t) (values) ())
1788 (defknown (compiler-notify maybe-compiler-notify) ((or string symbol) &rest t)
1789 (values)
1791 (defknown style-warn (t &rest t) null ())
1793 (defknown coerce-to-condition ((or condition symbol string function)
1794 list type-specifier symbol)
1795 condition
1796 (explicit-check))
1798 (defknown coerce-symbol-to-fun (symbol)
1799 function
1802 (defknown sc-number-or-lose (symbol) sc-number
1803 (foldable))
1805 (defknown set-info-value (t info-number t) t ()
1806 :derive-type #'result-type-last-arg)
1808 ;;;; memory barriers
1810 (defknown sb!vm:%compiler-barrier () (values) ())
1811 (defknown sb!vm:%memory-barrier () (values) ())
1812 (defknown sb!vm:%read-barrier () (values) ())
1813 (defknown sb!vm:%write-barrier () (values) ())
1814 (defknown sb!vm:%data-dependency-barrier () (values) ())
1816 #!+sb-safepoint
1817 ;;; Note: This known function does not have an out-of-line definition;
1818 ;;; and if such a definition were needed, it would not need to "call"
1819 ;;; itself inline, but could be a no-op, because the compiler inserts a
1820 ;;; use of the VOP in the function prologue anyway.
1821 (defknown sb!kernel::gc-safepoint () (values) ())
1823 ;;;; atomic ops
1824 (defknown %compare-and-swap-svref (simple-vector index t t) t
1826 (defknown %compare-and-swap-instance-ref (instance index t t) t
1828 (defknown %compare-and-swap-symbol-value (symbol t t) t
1829 (unwind))
1830 (defknown (%atomic-dec-symbol-global-value %atomic-inc-symbol-global-value)
1831 (symbol fixnum) fixnum)
1832 (defknown (%atomic-dec-car %atomic-inc-car %atomic-dec-cdr %atomic-inc-cdr)
1833 (cons fixnum) fixnum)
1834 (defknown spin-loop-hint () (values)
1835 (always-translatable))