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