Change initialization of interned array ctypes.
[sbcl.git] / src / compiler / fndb.lisp
blobe2f8f06b34f8d002503f3bf6e1f05b839e7a6724
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 ;; 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 ())
28 (defknown vector-to-vector* (vector type-specifier) vector ())
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))
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))
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))
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))
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 arm64)
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
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))
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 ())
129 (defknown %set-fdefinition ((or symbol cons) function) function ()
130 :derive-type #'result-type-last-arg)
131 (defknown makunbound (symbol) symbol ()
132 :derive-type #'result-type-first-arg)
133 (defknown fmakunbound ((or symbol cons)) (or symbol cons)
135 :derive-type #'result-type-first-arg)
136 (defknown apply (callable t &rest t) *) ; ### Last arg must be List...
137 (defknown funcall (callable &rest t) *)
139 (defknown (mapcar maplist) (callable list &rest list) list
140 (call))
142 ;;; According to CLHS the result must be a LIST, but we do not check
143 ;;; it.
144 (defknown (mapcan mapcon) (callable list &rest list) t
145 (call))
147 (defknown (mapc mapl) (callable list &rest list) list (foldable call))
149 ;;; We let VALUES-LIST be foldable, since constant-folding will turn
150 ;;; it into VALUES. VALUES is not foldable, since MV constants are
151 ;;; represented by a call to VALUES.
152 (defknown values (&rest t) * (movable flushable))
153 (defknown values-list (list) * (movable foldable unsafely-flushable))
155 ;;;; from the "Macros" chapter:
157 (defknown macro-function (symbol &optional lexenv-designator)
158 (or function null)
159 (flushable))
160 (defknown (macroexpand macroexpand-1 %macroexpand %macroexpand-1)
161 (t &optional lexenv-designator)
162 (values form &optional boolean))
164 (defknown compiler-macro-function (t &optional lexenv-designator)
165 (or function null)
166 (flushable))
168 ;;;; from the "Declarations" chapter:
170 (defknown proclaim (list) (values) (recursive))
172 ;;;; from the "Symbols" chapter:
174 (defknown get (symbol t &optional t) t (flushable))
175 (defknown sb!impl::get3 (symbol t t) t (flushable))
176 (defknown remprop (symbol t) t)
177 (defknown symbol-plist (symbol) list (flushable))
178 (defknown getf (list t &optional t) t (foldable flushable))
179 (defknown get-properties (list list) (values t t list) (foldable flushable))
180 (defknown symbol-name (symbol) simple-string (movable foldable flushable))
181 (defknown make-symbol (string) symbol (flushable))
182 (defknown %make-symbol (simple-string) symbol (flushable))
183 (defknown copy-symbol (symbol &optional t) symbol (flushable))
184 (defknown gensym (&optional (or string unsigned-byte)) symbol ())
185 (defknown symbol-package (symbol) (or package null) (flushable))
186 (defknown keywordp (t) boolean (flushable)) ; If someone uninterns it...
188 ;;;; from the "Packages" chapter:
190 (defknown gentemp (&optional string package-designator) symbol)
192 (defknown make-package (string-designator &key
193 (:use list)
194 (:nicknames list)
195 ;; ### extensions...
196 (:internal-symbols index)
197 (:external-symbols index))
198 package)
199 (defknown find-package (package-designator) (or package null)
200 (flushable))
201 (defknown find-undeleted-package-or-lose (package-designator)
202 package) ; not flushable
203 (defknown package-name (package-designator) (or simple-string null)
204 (unsafely-flushable))
205 (defknown package-nicknames (package-designator) list (unsafely-flushable))
206 (defknown rename-package (package-designator package-designator &optional list)
207 package)
208 (defknown package-use-list (package-designator) list (unsafely-flushable))
209 (defknown package-used-by-list (package-designator) list (unsafely-flushable))
210 (defknown package-shadowing-symbols (package-designator) list (unsafely-flushable))
211 (defknown list-all-packages () list (flushable))
212 (defknown intern (string &optional package-designator)
213 (values symbol (member :internal :external :inherited nil))
215 (defknown find-symbol (string &optional package-designator)
216 (values symbol (member :internal :external :inherited nil))
217 (flushable))
218 (defknown (export import) (symbols-designator &optional package-designator)
219 (eql t))
220 (defknown unintern (symbol &optional package-designator) boolean)
221 (defknown unexport (symbols-designator &optional package-designator) (eql t))
222 (defknown shadowing-import (symbols-designator &optional package-designator)
223 (eql t))
224 (defknown shadow ((or symbol character string list) &optional package-designator)
225 (eql t))
226 (defknown (use-package unuse-package)
227 ((or list package-designator) &optional package-designator) (eql t))
228 (defknown find-all-symbols (string-designator) list (flushable))
229 ;; private
230 (defknown package-iter-step (fixnum index simple-vector list)
231 (values fixnum index simple-vector list symbol symbol))
233 ;;;; from the "Numbers" chapter:
235 (defknown zerop (number) boolean (movable foldable flushable))
236 (defknown (plusp minusp) (real) boolean
237 (movable foldable flushable))
238 (defknown (oddp evenp) (integer) boolean
239 (movable foldable flushable))
240 (defknown (=) (number &rest number) boolean
241 (movable foldable flushable commutative))
242 (defknown (/=) (number &rest number) boolean
243 (movable foldable flushable))
244 (defknown (< > <= >=) (real &rest real) boolean
245 (movable foldable flushable))
246 (defknown (max min) (real &rest real) real
247 (movable foldable flushable))
249 (defknown (+ *) (&rest number) number
250 (movable foldable flushable commutative))
251 (defknown - (number &rest number) number
252 (movable foldable flushable))
253 (defknown / (number &rest number) number
254 (movable foldable unsafely-flushable))
255 (defknown (1+ 1-) (number) number
256 (movable foldable flushable))
258 (defknown conjugate (number) number
259 (movable foldable flushable))
261 (defknown gcd (&rest integer) unsigned-byte
262 (movable foldable flushable)
263 #|:derive-type 'boolean-result-type|#)
264 (defknown lcm (&rest integer) unsigned-byte
265 (movable foldable flushable))
267 #+sb-xc-host ; (See CROSS-FLOAT-INFINITY-KLUDGE.)
268 (defknown exp (number) irrational
269 (movable foldable flushable recursive)
270 :derive-type #'result-type-float-contagion)
272 #-sb-xc-host ; (See CROSS-FLOAT-INFINITY-KLUDGE.)
273 (defknown exp (number) irrational
274 (movable foldable flushable recursive))
276 (defknown expt (number number) number
277 (movable foldable flushable recursive))
278 (defknown log (number &optional real) irrational
279 (movable foldable flushable recursive))
280 (defknown sqrt (number) irrational
281 (movable foldable flushable))
282 (defknown isqrt (unsigned-byte) unsigned-byte
283 (movable foldable flushable recursive))
285 (defknown (abs phase signum) (number) number
286 (movable foldable flushable))
287 (defknown cis (real) (complex float)
288 (movable foldable flushable))
290 #+sb-xc-host ; (See CROSS-FLOAT-INFINITY-KLUDGE.)
291 (progn
292 (defknown (sin cos) (number)
293 (or (float -1.0 1.0) (complex float))
294 (movable foldable flushable recursive)
295 :derive-type #'result-type-float-contagion)
297 (defknown atan
298 (number &optional real) irrational
299 (movable foldable unsafely-flushable recursive)
300 :derive-type #'result-type-float-contagion)
302 (defknown (tan sinh cosh tanh asinh)
303 (number) irrational (movable foldable flushable recursive)
304 :derive-type #'result-type-float-contagion)
305 ) ; PROGN
307 #-sb-xc-host ; (See CROSS-FLOAT-INFINITY-KLUDGE.)
308 (progn
309 (defknown (sin cos) (number)
310 (or (float -1.0 1.0) (complex float))
311 (movable foldable flushable recursive))
313 (defknown atan
314 (number &optional real) irrational
315 (movable foldable unsafely-flushable recursive))
317 (defknown (tan sinh cosh tanh asinh)
318 (number) irrational (movable foldable flushable recursive))
319 ) ; PROGN
321 (defknown (asin acos acosh atanh)
322 (number) irrational
323 (movable foldable flushable recursive))
325 (defknown float (real &optional float) float
326 (movable foldable flushable))
328 (defknown (rational) (real) rational
329 (movable foldable flushable))
331 (defknown (rationalize) (real) rational
332 (movable foldable flushable recursive))
334 (defknown (numerator denominator) (rational) integer
335 (movable foldable flushable))
337 (defknown (floor ceiling round)
338 (real &optional real) (values integer real)
339 (movable foldable flushable))
341 (defknown truncate
342 (real &optional real) (values integer real)
343 (movable foldable flushable recursive))
345 (defknown %multiply-high (word word) word
346 (movable foldable flushable))
348 (defknown (mod rem) (real real) real
349 (movable foldable flushable))
351 (defknown (ffloor fceiling fround ftruncate)
352 (real &optional real) (values float real)
353 (movable foldable flushable))
355 (defknown decode-float (float) (values float float-exponent float)
356 (movable foldable unsafely-flushable))
357 (defknown scale-float (float integer) float
358 (movable foldable unsafely-flushable))
359 (defknown float-radix (float) float-radix
360 (movable foldable unsafely-flushable))
361 (defknown float-sign (float &optional float) float
362 (movable foldable unsafely-flushable))
363 (defknown (float-digits float-precision) (float) float-digits
364 (movable foldable unsafely-flushable))
365 (defknown integer-decode-float (float)
366 (values integer float-int-exponent (member -1 1))
367 (movable foldable unsafely-flushable))
369 (defknown complex (real &optional real) number
370 (movable foldable flushable))
372 (defknown (realpart imagpart) (number) real (movable foldable flushable))
374 (defknown (logior logxor logand logeqv) (&rest integer) integer
375 (movable foldable flushable commutative))
377 (defknown (lognand lognor logandc1 logandc2 logorc1 logorc2)
378 (integer integer) integer
379 (movable foldable flushable))
381 (defknown boole (boole-code integer integer) integer
382 (movable foldable flushable))
384 (defknown lognot (integer) integer (movable foldable flushable))
385 (defknown logtest (integer integer) boolean (movable foldable flushable commutative))
386 (defknown logbitp (unsigned-byte integer) boolean (movable foldable flushable))
387 (defknown ash (integer integer) integer
388 (movable foldable flushable))
389 #!+ash-right-vops
390 (defknown %ash/right ((or word sb!vm:signed-word) (mod #.sb!vm:n-word-bits))
391 (or word sb!vm:signed-word)
392 (movable foldable flushable always-translatable))
393 (defknown (logcount integer-length) (integer) bit-index
394 (movable foldable flushable))
395 ;;; FIXME: According to the ANSI spec, it's legal to use any
396 ;;; nonnegative indices for BYTE arguments, not just BIT-INDEX. It's
397 ;;; hard to come up with useful ways to do this, but it is possible to
398 ;;; come up with *legal* ways to do this, so it would be nice
399 ;;; to fix this so we comply with the spec.
400 (defknown byte (bit-index bit-index) byte-specifier
401 (movable foldable flushable))
402 (defknown (byte-size byte-position) (byte-specifier) bit-index
403 (movable foldable flushable))
404 (defknown ldb (byte-specifier integer) unsigned-byte (movable foldable flushable))
405 (defknown ldb-test (byte-specifier integer) boolean
406 (movable foldable flushable))
407 (defknown mask-field (byte-specifier integer) unsigned-byte
408 (movable foldable flushable))
409 (defknown dpb (integer byte-specifier integer) integer
410 (movable foldable flushable))
411 (defknown deposit-field (integer byte-specifier integer) integer
412 (movable foldable flushable))
413 (defknown random ((or (float (0.0)) (integer 1)) &optional random-state)
414 (or (float 0.0) (integer 0))
416 (defknown make-random-state (&optional (or random-state (member nil t)))
417 random-state (flushable))
418 (defknown seed-random-state (&optional ; SBCL extension
419 (or (member nil t) random-state unsigned-byte
420 (simple-array (unsigned-byte 8) (*))
421 (simple-array (unsigned-byte 32) (*))))
422 random-state (flushable))
424 (defknown random-state-p (t) boolean (movable foldable flushable))
426 ;;;; from the "Characters" chapter:
427 (defknown (standard-char-p graphic-char-p alpha-char-p
428 upper-case-p lower-case-p both-case-p alphanumericp)
429 (character) boolean (movable foldable flushable))
431 (defknown digit-char-p (character &optional (integer 2 36))
432 (or (integer 0 35) null) (movable foldable flushable))
434 ;; Character predicates: if the 2-argument predicate which underlies
435 ;; the N-argument predicate unavoidably type-checks its 2 args,
436 ;; then the N-argument form should not type-check anything
437 ;; except in the degenerate case of 1 actual argument.
438 ;; All of the case-sensitive functions have the check of the first arg
439 ;; generated by the compiler, and successive args checked by hand.
440 ;; The case-insensitive functions don't need any checks, since the underlying
441 ;; two-arg case-insensitive function does it, except when it isn't called.
442 (defknown (char=)
443 (character &rest character) boolean (movable foldable flushable commutative))
445 (defknown (char/= char< char> char<= char>= char-not-equal)
446 (character &rest character) boolean (movable foldable flushable))
447 (defknown (char-equal char-lessp char-greaterp char-not-greaterp char-not-lessp)
448 (character &rest character) boolean (movable foldable flushable))
450 (defknown (two-arg-char-equal)
451 (character character) boolean (movable foldable flushable commutative))
453 (defknown (two-arg-char-not-equal
454 two-arg-char-lessp
455 two-arg-char-not-lessp
456 two-arg-char-greaterp
457 two-arg-char-not-greaterp)
458 (character character) boolean (movable foldable flushable))
460 (defknown char-equal-constant (character character character)
461 boolean
462 (movable foldable flushable))
464 (defknown character (t) character (movable foldable unsafely-flushable))
465 (defknown char-code (character) char-code (movable foldable flushable))
466 (defknown (char-upcase char-downcase) (character) character
467 (movable foldable flushable))
468 (defknown digit-char (unsigned-byte &optional (integer 2 36))
469 (or character null) (movable foldable flushable))
470 (defknown char-int (character) char-code (movable foldable flushable))
471 (defknown char-name (character) (or simple-string null)
472 (movable foldable flushable))
473 (defknown name-char (string-designator) (or character null)
474 (movable foldable flushable))
475 (defknown code-char (char-code) character
476 ;; By suppressing constant folding on CODE-CHAR when the
477 ;; cross-compiler is running in the cross-compilation host vanilla
478 ;; ANSI Common Lisp, we can use CODE-CHAR expressions to delay until
479 ;; target Lisp run time the generation of CHARACTERs which aren't
480 ;; STANDARD-CHARACTERs. That way, we don't need to rely on the host
481 ;; Common Lisp being able to handle any characters other than those
482 ;; guaranteed by the ANSI spec.
483 (movable #-sb-xc-host foldable flushable))
485 ;;;; from the "Sequences" chapter:
487 (defknown elt (sequence index) t (foldable unsafely-flushable))
489 (defknown subseq (sequence index &optional sequence-end) consed-sequence
490 (flushable)
491 :derive-type (sequence-result-nth-arg 1))
493 (defknown copy-seq (sequence) consed-sequence (flushable)
494 :derive-type (sequence-result-nth-arg 1))
496 (defknown length (sequence) index (foldable flushable dx-safe))
498 (defknown reverse (sequence) consed-sequence (flushable)
499 :derive-type (sequence-result-nth-arg 1))
501 (defknown nreverse (sequence) sequence (important-result)
502 :derive-type #'result-type-first-arg
503 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
505 (defknown make-sequence (type-specifier index
506 &key
507 (:initial-element t))
508 consed-sequence
509 (movable)
510 :derive-type (creation-result-type-specifier-nth-arg 1))
512 (defknown concatenate (type-specifier &rest sequence) consed-sequence ()
513 :derive-type (creation-result-type-specifier-nth-arg 1))
515 (defknown %concatenate-to-string (&rest sequence) simple-string
516 (flushable))
517 (defknown %concatenate-to-base-string (&rest sequence) simple-base-string
518 (flushable))
520 (defknown map (type-specifier (callable &rest) sequence &rest sequence)
521 consed-sequence (call)
522 ; :DERIVE-TYPE 'TYPE-SPEC-ARG1 ? Nope... (MAP NIL ...) returns NULL, not NIL.
524 (defknown %map (type-specifier callable &rest sequence) consed-sequence (call))
525 (defknown %map-for-effect-arity-1 (callable sequence) null (call))
526 (defknown %map-to-list-arity-1 (callable sequence) list (flushable call))
527 (defknown %map-to-simple-vector-arity-1 (callable sequence) simple-vector
528 (flushable call))
530 (defknown map-into (sequence (callable &rest) &rest sequence)
531 sequence
532 (call)
533 :derive-type #'result-type-first-arg
534 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
536 (defknown #.(loop for info across sb!vm:*specialized-array-element-type-properties*
537 collect
538 (intern (concatenate 'string "VECTOR-MAP-INTO/"
539 (string (sb!vm:saetp-primitive-type-name info)))
540 :sb!impl))
541 (simple-array index index function list)
542 index
543 (call))
545 ;;; returns the result from the predicate...
546 (defknown some (callable sequence &rest sequence) t
547 (foldable unsafely-flushable call))
549 (defknown (every notany notevery) (callable sequence &rest sequence) boolean
550 (foldable unsafely-flushable call))
552 (defknown reduce ((callable 2) sequence &rest t &key (:from-end t) (:start index)
553 (:end sequence-end) (:initial-value t) (:key (callable 1)))
555 (foldable flushable call))
557 (defknown fill (sequence t &rest t &key
558 (:start index) (:end sequence-end)) sequence
560 :derive-type #'result-type-first-arg
561 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1)
562 :result-arg 0)
564 (defknown replace (sequence sequence &rest t &key (:start1 index)
565 (:end1 sequence-end) (:start2 index) (:end2 sequence-end))
566 sequence ()
567 :derive-type #'result-type-first-arg
568 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1)
569 :result-arg 0)
571 (defknown remove
572 (t sequence &rest t &key (:from-end t) (:test (callable 2))
573 (:test-not (callable 2)) (:start index) (:end sequence-end)
574 (:count sequence-count) (:key (callable 1)))
575 consed-sequence
576 (flushable call)
577 :derive-type (sequence-result-nth-arg 2))
579 (defknown substitute
580 (t t sequence &rest t &key (:from-end t) (:test (callable 2))
581 (:test-not (callable 2)) (:start index) (:end sequence-end)
582 (:count sequence-count) (:key (callable 1)))
583 consed-sequence
584 (flushable call)
585 :derive-type (sequence-result-nth-arg 3))
587 (defknown (remove-if remove-if-not)
588 ((callable 1) sequence &rest t &key (:from-end t) (:start index)
589 (:end sequence-end) (:count sequence-count) (:key (callable 1)))
590 consed-sequence
591 (flushable call)
592 :derive-type (sequence-result-nth-arg 2))
594 (defknown (substitute-if substitute-if-not)
595 (t (callable 1) sequence &rest t &key (:from-end t) (:start index)
596 (:end sequence-end) (:count sequence-count) (:key (callable 1)))
597 consed-sequence
598 (flushable call)
599 :derive-type (sequence-result-nth-arg 3))
601 (defknown delete
602 (t sequence &rest t &key (:from-end t) (:test (callable 2))
603 (:test-not (callable 2)) (:start index) (:end sequence-end)
604 (:count sequence-count) (:key (callable 1)))
605 sequence
606 (flushable call important-result)
607 :derive-type (sequence-result-nth-arg 2)
608 :destroyed-constant-args (nth-constant-nonempty-sequence-args 2))
610 (defknown nsubstitute
611 (t t sequence &rest t &key (:from-end t) (:test (callable 2))
612 (:test-not (callable 2)) (:start index) (:end sequence-end)
613 (:count sequence-count) (:key (callable 1)))
614 sequence
615 (flushable call)
616 :derive-type (sequence-result-nth-arg 3)
617 :destroyed-constant-args (nth-constant-nonempty-sequence-args 3))
619 (defknown (delete-if delete-if-not)
620 ((callable 1) sequence &rest t &key (:from-end t) (:start index)
621 (:end sequence-end) (:count sequence-count) (:key (callable 1)))
622 sequence
623 (flushable call important-result)
624 :derive-type (sequence-result-nth-arg 2)
625 :destroyed-constant-args (nth-constant-nonempty-sequence-args 2))
627 (defknown (nsubstitute-if nsubstitute-if-not)
628 (t (callable 1) sequence &rest t &key (:from-end t) (:start index)
629 (:end sequence-end) (:count sequence-count) (:key (callable 1)))
630 sequence
631 (flushable call)
632 :derive-type (sequence-result-nth-arg 3)
633 :destroyed-constant-args (nth-constant-nonempty-sequence-args 3))
635 (defknown remove-duplicates
636 (sequence &rest t &key (:test (callable 2)) (:test-not (callable 2)) (:start index)
637 (:from-end t) (:end sequence-end) (:key (callable 1)))
638 consed-sequence
639 (unsafely-flushable call)
640 :derive-type (sequence-result-nth-arg 1))
642 (defknown delete-duplicates
643 (sequence &rest t &key (:test (callable 2)) (:test-not (callable 2)) (:start index)
644 (:from-end t) (:end sequence-end) (:key (callable 1)))
645 sequence
646 (unsafely-flushable call important-result)
647 :derive-type (sequence-result-nth-arg 1)
648 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
650 (defknown find (t sequence &rest t &key (:test (callable 2))
651 (:test-not (callable 2)) (:start index) (:from-end t)
652 (:end sequence-end) (:key (callable 1)))
654 (foldable flushable call))
656 (defknown (find-if find-if-not)
657 ((callable 1) sequence &rest t &key (:from-end t) (:start index)
658 (:end sequence-end) (:key (callable 1)))
660 (foldable flushable call))
662 (defknown position (t sequence &rest t &key (:test (callable 2))
663 (:test-not (callable 2)) (:start index) (:from-end t)
664 (:end sequence-end) (:key (callable 1)))
665 (or index null)
666 (foldable flushable call)
667 :derive-type #'position-derive-type)
669 (defknown (position-if position-if-not)
670 ((callable 1) sequence &rest t &key (:from-end t) (:start index)
671 (:end sequence-end) (:key (callable 1)))
672 (or index null)
673 (foldable flushable call)
674 :derive-type #'position-derive-type)
676 (defknown count (t sequence &rest t &key
677 (:test (callable 2)) (:test-not (callable 2)) (:start index)
678 (:from-end t) (:end sequence-end) (:key (callable 1)))
679 index
680 (foldable flushable call)
681 :derive-type #'count-derive-type)
683 (defknown (count-if count-if-not)
684 ((callable 1) sequence &rest t &key
685 (:from-end t) (:start index) (:end sequence-end) (:key (callable 1)))
686 index
687 (foldable flushable call)
688 :derive-type #'count-derive-type)
690 (defknown (mismatch search)
691 (sequence sequence &rest t &key (:from-end t) (:test (callable 2))
692 (:test-not (callable 2)) (:start1 index) (:end1 sequence-end)
693 (:start2 index) (:end2 sequence-end) (:key (callable 1)))
694 (or index null)
695 (foldable flushable call))
697 ;;; not FLUSHABLE, since vector sort guaranteed in-place...
698 (defknown (stable-sort sort) (sequence (callable 2) &rest t &key (:key (callable 1)))
699 sequence
700 (call)
701 :derive-type (sequence-result-nth-arg 1)
702 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
703 (defknown sb!impl::stable-sort-list (list function function) list
704 (call important-result)
705 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
706 (defknown sb!impl::sort-vector (vector index index function (or function null))
707 * ; SORT-VECTOR works through side-effect
708 (call)
709 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
711 (defknown sb!impl::stable-sort-vector
712 (vector function (or function null))
713 vector
714 (call)
715 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
717 (defknown sb!impl::stable-sort-simple-vector
718 (simple-vector function (or function null))
719 simple-vector
720 (call)
721 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
723 (defknown merge (type-specifier sequence sequence (callable 2)
724 &key (:key (callable 1)))
725 sequence
726 (call important-result)
727 :derive-type (creation-result-type-specifier-nth-arg 1)
728 :destroyed-constant-args (nth-constant-nonempty-sequence-args 2 3))
730 (defknown read-sequence (sequence stream
731 &key
732 (:start index)
733 (:end sequence-end))
734 (index)
737 (defknown write-sequence (sequence stream
738 &key
739 (:start index)
740 (:end sequence-end))
741 sequence
743 :derive-type #'result-type-first-arg)
745 ;;;; from the "Manipulating List Structure" chapter:
746 (defknown (car cdr first rest)
747 (list)
749 (foldable flushable))
751 ;; Correct argument type restrictions for these functions are
752 ;; complicated, so we just declare them to accept LISTs and suppress
753 ;; flushing is safe code.
754 (defknown (caar cadr cdar cddr
755 caaar caadr cadar caddr cdaar cdadr cddar cdddr
756 caaaar caaadr caadar caaddr cadaar cadadr caddar cadddr
757 cdaaar cdaadr cdadar cdaddr cddaar cddadr cdddar cddddr
758 second third fourth fifth sixth seventh eighth ninth tenth)
759 (list)
761 (foldable unsafely-flushable))
763 (defknown cons (t t) cons (movable flushable))
765 (defknown tree-equal (t t &key (:test (callable 2)) (:test-not (callable 2))) boolean
766 (foldable flushable call))
767 (defknown endp (list) boolean (foldable flushable movable))
768 (defknown list-length (list) (or index null) (foldable unsafely-flushable))
769 (defknown (nth fast-&rest-nth) (unsigned-byte list) t (foldable flushable))
770 (defknown nthcdr (unsigned-byte list) t (foldable unsafely-flushable))
772 (defknown last (list &optional unsigned-byte) t (foldable flushable))
773 (defknown %last0 (list) t (foldable flushable))
774 (defknown %last1 (list) t (foldable flushable))
775 (defknown %lastn/fixnum (list (and unsigned-byte fixnum)) t (foldable flushable))
776 (defknown %lastn/bignum (list (and unsigned-byte bignum)) t (foldable flushable))
778 (defknown list (&rest t) list (movable flushable))
779 (defknown list* (t &rest t) t (movable flushable))
780 (defknown make-list (index &key (:initial-element t)) list
781 (movable flushable))
782 (defknown %make-list (index t) list (movable flushable))
784 (defknown sb!impl::|List| (&rest t) list (movable flushable foldable))
785 (defknown sb!impl::|List*| (t &rest t) t (movable flushable foldable))
786 (defknown sb!impl::|Append| (&rest t) t (flushable foldable))
787 (defknown sb!impl::|Vector| (&rest t) simple-vector (flushable foldable))
789 ;;; All but last must be of type LIST, but there seems to be no way to
790 ;;; express that in this syntax.
791 (defknown append (&rest t) t (flushable))
792 (defknown sb!impl::append2 (list t) t (flushable))
794 (defknown copy-list (list) list (flushable))
795 (defknown copy-alist (list) list (flushable))
796 (defknown copy-tree (t) t (flushable recursive))
797 (defknown revappend (list t) t (flushable))
799 ;;; All but last must be of type LIST, but there seems to be no way to
800 ;;; express that in this syntax. The result must be LIST, but we do
801 ;;; not check it now :-).
802 (defknown nconc (&rest t) t ()
803 :destroyed-constant-args (remove-non-constants-and-nils #'butlast))
805 (defknown nreconc (list t) t (important-result)
806 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
807 (defknown butlast (list &optional unsigned-byte) list (flushable))
808 (defknown nbutlast (list &optional unsigned-byte) list ()
809 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
811 (defknown ldiff (list t) list (flushable))
812 (defknown (rplaca rplacd) (cons t) cons ()
813 :destroyed-constant-args (nth-constant-args 1))
815 (defknown subst (t t t &key (:key (callable 1)) (:test (callable 2))
816 (:test-not (callable 2)))
817 t (flushable call))
818 (defknown nsubst (t t t &key (:key (callable 1)) (:test (callable 2))
819 (:test-not (callable 2)))
820 t (call)
821 :destroyed-constant-args (nth-constant-nonempty-sequence-args 3))
823 (defknown (subst-if subst-if-not)
824 (t (callable 1) t &key (:key (callable 1)))
825 t (flushable call))
826 (defknown (nsubst-if nsubst-if-not)
827 (t (callable 1) t &key (:key (callable 1)))
828 t (call)
829 :destroyed-constant-args (nth-constant-nonempty-sequence-args 3))
831 (defknown sublis (list t &key (:key (callable 1)) (:test (callable 2))
832 (:test-not (callable 2)))
833 t (flushable call))
834 (defknown nsublis (list t &key (:key (callable 1)) (:test (callable 2))
835 (:test-not (callable 2)))
836 t (flushable call)
837 :destroyed-constant-args (nth-constant-nonempty-sequence-args 2))
839 (defknown member (t list &key (:key (callable 1)) (:test (callable 2))
840 (:test-not (callable 2)))
841 list (foldable flushable call))
842 (defknown (member-if member-if-not) ((callable 1) list &key (:key (callable 1)))
843 list (foldable flushable call))
845 (defknown tailp (t list) boolean (foldable flushable))
847 (defknown adjoin (t list &key (:key (callable 1)) (:test (callable 2))
848 (:test-not (callable 2)))
849 cons (flushable call))
851 (defknown (union intersection set-difference set-exclusive-or)
852 (list list &key (:key (callable 1)) (:test (callable 2)) (:test-not (callable 2)))
853 list
854 (foldable flushable call))
856 (defknown (nunion nintersection nset-difference nset-exclusive-or)
857 (list list &key (:key (callable 1)) (:test (callable 2)) (:test-not (callable 2)))
858 list
859 (foldable flushable call important-result)
860 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1 2))
862 (defknown subsetp
863 (list list &key (:key (callable 1)) (:test (callable 2)) (:test-not (callable 2)))
864 boolean
865 (foldable flushable call))
867 (defknown acons (t t t) cons (movable flushable))
868 (defknown pairlis (t t &optional t) list (flushable))
870 (defknown (rassoc assoc)
871 (t list &key (:key (callable 1)) (:test (callable 2)) (:test-not (callable 2)))
872 list (foldable flushable call))
873 (defknown (assoc-if-not assoc-if rassoc-if rassoc-if-not)
874 ((callable 1) list &key (:key (callable 1))) list (foldable flushable call))
876 (defknown (memq assq) (t list) list (foldable flushable))
877 (defknown delq (t list) list (flushable)
878 :destroyed-constant-args (nth-constant-nonempty-sequence-args 2))
880 ;;;; from the "Hash Tables" chapter:
882 (defknown make-hash-table
883 (&key (:test callable) (:size unsigned-byte)
884 (:rehash-size (or (integer 1) (float (1.0))))
885 (:rehash-threshold (real 0 1))
886 (:hash-function (or null callable))
887 (:weakness (member nil :key :value :key-and-value :key-or-value))
888 (:synchronized t))
889 hash-table
890 (flushable))
891 (defknown hash-table-p (t) boolean (movable foldable flushable))
892 (defknown gethash (t hash-table &optional t) (values t boolean)
893 (flushable)) ; not FOLDABLE, since hash table contents can change
894 (defknown sb!impl::gethash3 (t hash-table t) (values t boolean)
895 (flushable)) ; not FOLDABLE, since hash table contents can change
896 (defknown %puthash (t hash-table t) t ()
897 :destroyed-constant-args (nth-constant-args 2)
898 :derive-type #'result-type-last-arg)
899 (defknown remhash (t hash-table) boolean ()
900 :destroyed-constant-args (nth-constant-args 2))
901 (defknown maphash ((callable 2) hash-table) null (flushable call))
902 (defknown clrhash (hash-table) hash-table ()
903 :destroyed-constant-args (nth-constant-args 2))
904 (defknown hash-table-count (hash-table) index (flushable))
905 (defknown hash-table-rehash-size (hash-table) (or index (single-float (1.0)))
906 (foldable flushable))
907 (defknown hash-table-rehash-threshold (hash-table) (single-float (0.0) 1.0)
908 (foldable flushable))
909 (defknown hash-table-size (hash-table) index (flushable))
910 (defknown hash-table-test (hash-table) symbol (foldable flushable))
911 (defknown sxhash (t) hash (#-sb-xc-host foldable flushable))
912 (defknown psxhash (t &optional t) hash (#-sb-xc-host foldable flushable))
913 (defknown hash-table-equalp (hash-table hash-table) boolean (foldable flushable))
915 ;;;; from the "Arrays" chapter
917 (defknown make-array ((or index list)
918 &key
919 (:element-type type-specifier)
920 (:initial-element t)
921 (:initial-contents t)
922 (:adjustable t)
923 (:fill-pointer (or index boolean))
924 (:displaced-to (or array null))
925 (:displaced-index-offset index))
926 array (flushable))
928 (defknown %make-array ((or index list)
929 (unsigned-byte #.sb!vm:n-widetag-bits)
930 (unsigned-byte 16)
931 &key
932 (:element-type type-specifier)
933 (:initial-element t)
934 (:initial-contents t)
935 (:adjustable t)
936 (:fill-pointer (or index boolean))
937 (:displaced-to (or array null))
938 (:displaced-index-offset index))
939 array (flushable))
941 (defknown sb!impl::fill-data-vector (vector list sequence) t ())
943 (defknown vector (&rest t) simple-vector (flushable))
945 (defknown aref (array &rest index) t (foldable))
946 (defknown row-major-aref (array index) t (foldable))
948 (defknown array-element-type (array) (or list symbol)
949 (foldable flushable))
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))
987 (defknown sb!impl::fill-pointer-error (t &optional t) nil)
989 (defknown vector-push (t complex-vector) (or index null) ()
990 :destroyed-constant-args (nth-constant-args 2))
991 (defknown vector-push-extend (t complex-vector &optional (and index (integer 1))) index
993 :destroyed-constant-args (nth-constant-args 2))
994 (defknown vector-pop (complex-vector) t ()
995 :destroyed-constant-args (nth-constant-args 1))
997 ;;; FIXME: complicated :DESTROYED-CONSTANT-ARGS
998 ;;; Also, an important-result warning could be provided if the array
999 ;;; is known to be not expressly adjustable.
1000 (defknown adjust-array
1001 (array (or index list) &key (:element-type type-specifier)
1002 (:initial-element t) (:initial-contents t)
1003 (:fill-pointer (or index boolean))
1004 (:displaced-to (or array null))
1005 (:displaced-index-offset index))
1006 array ())
1007 ; :derive-type 'result-type-arg1) Not even close...
1009 ;;;; from the "Strings" chapter:
1011 (defknown char (string index) character (foldable flushable))
1012 (defknown schar (simple-string index) character (foldable flushable))
1014 (defknown (string= string-equal)
1015 (string-designator string-designator &key (:start1 index) (:end1 sequence-end)
1016 (:start2 index) (:end2 sequence-end))
1017 boolean
1018 (foldable flushable))
1020 (defknown (string< string> string<= string>= string/= string-lessp
1021 string-greaterp string-not-lessp string-not-greaterp
1022 string-not-equal)
1023 (string-designator string-designator &key (:start1 index) (:end1 sequence-end)
1024 (:start2 index) (:end2 sequence-end))
1025 (or index null)
1026 (foldable flushable))
1028 (defknown make-string (index &key (:element-type type-specifier)
1029 (:initial-element character))
1030 simple-string (flushable))
1032 (defknown (string-trim string-left-trim string-right-trim)
1033 (sequence string-designator) string (flushable))
1035 (defknown (string-upcase string-downcase string-capitalize)
1036 (string-designator &key (:start index) (:end sequence-end))
1037 simple-string (flushable))
1039 (defknown (nstring-upcase nstring-downcase nstring-capitalize)
1040 (string &key (:start index) (:end sequence-end))
1041 string ()
1042 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
1044 (defknown string (string-designator) string (flushable))
1046 ;;;; internal non-keyword versions of string predicates:
1048 (defknown (string<* string>* string<=* string>=* string/=*)
1049 (string-designator string-designator index sequence-end index sequence-end)
1050 (or index null)
1051 (foldable flushable))
1053 (defknown string=*
1054 (string-designator string-designator index sequence-end index sequence-end)
1055 boolean
1056 (foldable flushable))
1058 ;;;; from the "Eval" chapter:
1060 (defknown eval (t) * (recursive))
1061 (defknown constantp (t &optional lexenv-designator) boolean
1062 (foldable flushable))
1064 ;;;; from the "Streams" chapter:
1066 (defknown make-synonym-stream (symbol) stream (flushable))
1067 (defknown make-broadcast-stream (&rest stream) stream (unsafely-flushable))
1068 (defknown make-concatenated-stream (&rest stream) stream (unsafely-flushable))
1069 (defknown make-two-way-stream (stream stream) stream (unsafely-flushable))
1070 (defknown make-echo-stream (stream stream) stream (flushable))
1071 (defknown make-string-input-stream (string &optional index sequence-end)
1072 stream
1073 (flushable))
1074 (defknown make-string-output-stream
1075 (&key (:element-type type-specifier)) sb!impl::string-output-stream
1076 (flushable))
1077 (defknown get-output-stream-string (stream) simple-string ())
1078 (defknown streamp (t) boolean (movable foldable flushable))
1079 (defknown stream-element-type (stream) type-specifier ; can it return a CLASS?
1080 (movable foldable flushable))
1081 (defknown stream-external-format (stream) t (flushable))
1082 (defknown (output-stream-p input-stream-p) (stream) boolean
1083 (movable foldable flushable))
1084 (defknown open-stream-p (stream) boolean (flushable))
1085 (defknown close (stream &key (:abort t)) (eql t) ())
1086 (defknown file-string-length (ansi-stream (or string character))
1087 (or unsigned-byte null)
1088 (flushable))
1090 ;;;; from the "Input/Output" chapter:
1092 ;;; (The I/O functions are given effects ANY under the theory that
1093 ;;; code motion over I/O operations is particularly confusing and not
1094 ;;; very important for efficiency.)
1096 (defknown copy-readtable (&optional (or readtable null) (or readtable null))
1097 readtable
1099 (defknown readtablep (t) boolean (movable foldable flushable))
1101 (defknown set-syntax-from-char
1102 (character character &optional readtable (or readtable null)) (eql t)
1105 (defknown set-macro-character (character (callable 2) &optional t (or readtable null))
1106 (eql t)
1107 (call))
1108 (defknown get-macro-character (character &optional (or readtable null))
1109 (values callable boolean) (flushable))
1111 (defknown make-dispatch-macro-character (character &optional t readtable)
1112 (eql t) ())
1113 (defknown set-dispatch-macro-character
1114 (character character callable &optional (or readtable null)) (eql t)
1116 (defknown get-dispatch-macro-character
1117 (character character &optional (or readtable null)) (or callable null)
1120 (defknown copy-pprint-dispatch
1121 (&optional (or sb!pretty:pprint-dispatch-table null))
1122 sb!pretty:pprint-dispatch-table
1124 (defknown pprint-dispatch
1125 (t &optional (or sb!pretty:pprint-dispatch-table null))
1126 (values callable boolean)
1128 (defknown (pprint-fill pprint-linear)
1129 (stream-designator t &optional t t)
1130 null
1132 (defknown pprint-tabular
1133 (stream-designator t &optional t t unsigned-byte)
1134 null
1136 (defknown pprint-indent
1137 ((member :block :current) real &optional stream-designator)
1138 null
1140 (defknown pprint-newline
1141 ((member :linear :fill :miser :mandatory) &optional stream-designator)
1142 null
1144 (defknown pprint-tab
1145 ((member :line :section :line-relative :section-relative)
1146 unsigned-byte unsigned-byte &optional stream-designator)
1147 null
1149 (defknown set-pprint-dispatch
1150 (type-specifier (or null callable)
1151 &optional real sb!pretty:pprint-dispatch-table)
1152 null
1155 ;;; may return any type due to eof-value...
1156 ;;; and because READ generally returns anything.
1157 (defknown (read read-preserving-whitespace)
1158 (&optional stream-designator t t t) t ())
1160 (defknown read-char (&optional stream-designator t t t) t ()
1161 :derive-type (read-elt-type-deriver nil 'character nil))
1162 (defknown read-char-no-hang (&optional stream-designator t t t) t ()
1163 :derive-type (read-elt-type-deriver nil 'character t))
1165 (defknown read-delimited-list (character &optional stream-designator t) list ())
1166 ;; FIXME: add a type-deriver => (values (or string eof-value) boolean)
1167 (defknown read-line (&optional stream-designator t t t) (values t boolean) ())
1168 (defknown unread-char (character &optional stream-designator) t ())
1169 (defknown peek-char (&optional (or character (member nil t))
1170 stream-designator t t t) t
1172 :derive-type (read-elt-type-deriver t 'character nil))
1174 (defknown listen (&optional stream-designator) boolean (flushable))
1176 (defknown clear-input (&optional stream-designator) null ())
1178 (defknown read-from-string
1179 (string &optional t t
1180 &key
1181 (:start index)
1182 (:end sequence-end)
1183 (:preserve-whitespace t))
1184 (values t index))
1185 (defknown parse-integer
1186 (string &key
1187 (:start index)
1188 (:end sequence-end)
1189 (:radix (integer 2 36))
1190 (:junk-allowed t))
1191 (values (or integer null ()) index))
1193 (defknown read-byte (stream &optional t t) t ()
1194 :derive-type (read-elt-type-deriver nil 'integer nil))
1196 (defknown (prin1 print princ) (t &optional stream-designator)
1198 (any)
1199 :derive-type #'result-type-first-arg)
1201 (defknown output-object (t stream) null (any))
1202 (defknown %write (t stream-designator) t (any))
1204 (defknown (pprint) (t &optional stream-designator) (values)
1207 (macrolet
1208 ((deffrob (name keys returns attributes &rest more)
1209 `(defknown ,name
1210 (t &key ,@keys
1211 (:escape t)
1212 (:radix t)
1213 (:base (integer 2 36))
1214 (:circle t)
1215 (:pretty t)
1216 (:readably t)
1217 (:level (or unsigned-byte null))
1218 (:length (or unsigned-byte null))
1219 (:case t)
1220 (:array t)
1221 (:gensym t)
1222 (:lines (or unsigned-byte null))
1223 (:right-margin (or unsigned-byte null))
1224 (:miser-width (or unsigned-byte null))
1225 (:pprint-dispatch t)
1226 (:suppress-errors t))
1227 ,returns ,attributes ,@more)))
1228 (deffrob write ((:stream stream-designator)) t (any)
1229 :derive-type #'result-type-first-arg)
1230 ;;; xxx-TO-STRING functions are not foldable because they depend on
1231 ;;; the dynamic environment, the state of the pretty printer dispatch
1232 ;;; table, and probably other run-time factors.
1233 (deffrob write-to-string () simple-string
1234 (unsafely-flushable)))
1236 (defknown (prin1-to-string princ-to-string) (t) simple-string (flushable))
1237 (defknown sb!impl::stringify-object (t) simple-string)
1239 (defknown write-char (character &optional stream-designator) character ()
1240 :derive-type #'result-type-first-arg)
1242 (defknown (write-string write-line)
1243 (string &optional stream-designator &key (:start index) (:end sequence-end))
1244 string
1246 :derive-type #'result-type-first-arg)
1248 (defknown (terpri finish-output force-output clear-output)
1249 (&optional stream-designator) null
1252 (defknown fresh-line (&optional stream-designator) boolean ())
1254 (defknown write-byte (integer stream) integer ()
1255 :derive-type #'result-type-first-arg)
1257 ;;; FIXME: complicated :DESTROYED-CONSTANT-ARGS
1258 (defknown format ((or (member nil t) stream string)
1259 (or string function) &rest t)
1260 (or string null)
1262 (defknown sb!format::args-exhausted (string integer) nil)
1264 (defknown (y-or-n-p yes-or-no-p) (&optional string &rest t) boolean
1267 ;;;; from the "File System Interface" chapter:
1269 ;;; (No pathname functions are FOLDABLE because they all potentially
1270 ;;; depend on *DEFAULT-PATHNAME-DEFAULTS*, e.g. to provide a default
1271 ;;; host when parsing a namestring. They are not FLUSHABLE because
1272 ;;; parsing of a PATHNAME-DESIGNATOR might signal an error.)
1274 (defknown wild-pathname-p (pathname-designator
1275 &optional
1276 (member nil :host :device
1277 :directory :name
1278 :type :version))
1279 generalized-boolean
1280 (recursive))
1282 (defknown pathname-match-p (pathname-designator pathname-designator)
1283 generalized-boolean
1286 (defknown translate-pathname (pathname-designator
1287 pathname-designator
1288 pathname-designator &key)
1289 pathname
1292 (defknown logical-pathname (pathname-designator) logical-pathname ())
1293 (defknown translate-logical-pathname (pathname-designator &key) pathname
1294 (recursive))
1295 (defknown load-logical-pathname-translations (string) t ())
1296 (defknown logical-pathname-translations (logical-host-designator) list ())
1298 (defknown pathname (pathname-designator) pathname ())
1299 (defknown truename (pathname-designator) pathname ())
1301 (defknown parse-namestring
1302 (pathname-designator &optional
1303 (or list host string (member :unspecific))
1304 pathname-designator
1305 &key
1306 (:start index)
1307 (:end sequence-end)
1308 (:junk-allowed t))
1309 (values (or pathname null) sequence-end)
1310 (recursive))
1312 (defknown merge-pathnames
1313 (pathname-designator &optional pathname-designator pathname-version)
1314 pathname
1317 (defknown make-pathname
1318 (&key (:defaults pathname-designator)
1319 (:host (or string pathname-host))
1320 (:device (or string pathname-device))
1321 (:directory (or pathname-directory string (member :wild)))
1322 (:name (or pathname-name string (member :wild)))
1323 (:type (or pathname-type string (member :wild)))
1324 (:version pathname-version) (:case (member :local :common)))
1325 pathname (unsafely-flushable))
1327 (defknown pathnamep (t) boolean (movable flushable))
1329 (defknown pathname-host (pathname-designator
1330 &key (:case (member :local :common)))
1331 pathname-host (flushable))
1332 (defknown pathname-device (pathname-designator
1333 &key (:case (member :local :common)))
1334 pathname-device (flushable))
1335 (defknown pathname-directory (pathname-designator
1336 &key (:case (member :local :common)))
1337 pathname-directory (flushable))
1338 (defknown pathname-name (pathname-designator
1339 &key (:case (member :local :common)))
1340 pathname-name (flushable))
1341 (defknown pathname-type (pathname-designator
1342 &key (:case (member :local :common)))
1343 pathname-type (flushable))
1344 (defknown pathname-version (pathname-designator)
1345 pathname-version (flushable))
1347 (defknown pathname= (pathname pathname) boolean (movable foldable flushable))
1349 (defknown (namestring file-namestring directory-namestring host-namestring)
1350 (pathname-designator) (or simple-string null)
1351 (unsafely-flushable))
1353 (defknown enough-namestring (pathname-designator &optional pathname-designator)
1354 simple-string
1355 (unsafely-flushable))
1357 (defknown user-homedir-pathname (&optional t) pathname (flushable))
1359 (defknown open
1360 (pathname-designator &key
1361 (:class symbol)
1362 (:direction (member :input :output :io :probe))
1363 (:element-type type-specifier)
1364 (:if-exists (member :error :new-version :rename
1365 :rename-and-delete :overwrite
1366 :append :supersede nil))
1367 (:if-does-not-exist (member :error :create nil))
1368 (:external-format external-format-designator))
1369 (or stream null))
1371 (defknown rename-file (pathname-designator filename)
1372 (values pathname pathname pathname))
1373 (defknown delete-file (pathname-designator) (eql t))
1374 (defknown probe-file (pathname-designator) (or pathname null) ())
1375 (defknown file-write-date (pathname-designator) (or unsigned-byte null)
1377 (defknown file-author (pathname-designator) (or simple-string null)
1380 (defknown file-position (stream &optional
1381 (or unsigned-byte (member :start :end)))
1382 (or unsigned-byte (member t nil)))
1383 (defknown file-length (stream) (or unsigned-byte null) (unsafely-flushable))
1385 (defknown load
1386 ((or filename stream)
1387 &key
1388 (:verbose t)
1389 (:print t)
1390 (:if-does-not-exist t)
1391 (:external-format external-format-designator))
1392 boolean)
1394 (defknown directory (pathname-designator &key (:resolve-symlinks t))
1395 list ())
1397 ;;;; from the "Conditions" chapter:
1399 (defknown error (t &rest t) nil)
1400 (defknown cerror (format-control t &rest t) null)
1401 (defknown invalid-method-error (t format-control &rest t) *) ; FIXME: first arg is METHOD
1402 (defknown method-combination-error (format-control &rest t) *)
1403 (defknown signal (t &rest t) null)
1404 (defknown warn (t &rest t) null)
1405 (defknown invoke-debugger (condition) nil)
1406 (defknown break (&optional format-control &rest t) null)
1407 (defknown make-condition (type-specifier &rest t) condition ())
1408 (defknown compute-restarts (&optional (or condition null)) list)
1409 (defknown find-restart (restart-designator &optional (or condition null))
1410 (or restart null))
1411 (defknown invoke-restart (restart-designator &rest t) *)
1412 (defknown invoke-restart-interactively (restart-designator) *)
1413 (defknown restart-name (restart) symbol)
1414 (defknown (abort muffle-warning) (&optional (or condition null)) nil)
1415 (defknown continue (&optional (or condition null)) null)
1416 (defknown (store-value use-value) (t &optional (or condition null))
1417 null)
1419 ;;; and analogous SBCL extension:
1420 (defknown sb!impl::%failed-aver (t) nil)
1421 (defknown bug (t &rest t) nil) ; never returns
1422 (defknown sb!int:simple-reader-error (stream string &rest t) nil)
1423 (defknown sb!kernel:reader-eof-error (stream string) nil)
1426 ;;;; from the "Miscellaneous" Chapter:
1428 (defknown compile ((or symbol cons) &optional (or list function null))
1429 (values (or function symbol cons) boolean boolean))
1431 (defknown compile-file
1432 (pathname-designator
1433 &key
1435 ;; ANSI options
1436 (:output-file (or pathname-designator
1437 null
1438 ;; FIXME: This last case is a non-ANSI hack.
1439 (member t)))
1440 (:verbose t)
1441 (:print t)
1442 (:external-format external-format-designator)
1444 ;; extensions
1445 (:trace-file t)
1446 (:block-compile t)
1447 (:emit-cfasl t))
1448 (values (or pathname null) boolean boolean))
1450 (defknown (compile-file-pathname)
1451 (pathname-designator &key (:output-file (or pathname-designator
1452 null
1453 (member t)))
1454 &allow-other-keys)
1455 pathname)
1457 ;; FIXME: consider making (OR CALLABLE CONS) something like
1458 ;; EXTENDED-FUNCTION-DESIGNATOR
1459 (defknown disassemble ((or callable cons) &key
1460 (:stream stream) (:use-labels t))
1461 null)
1463 (defknown describe (t &optional (or stream (member t nil))) (values))
1464 (defknown function-lambda-expression (function) (values t boolean t))
1465 (defknown inspect (t) (values))
1466 (defknown room (&optional (member t nil :default)) (values))
1467 (defknown ed (&optional (or symbol cons filename))
1469 (defknown dribble (&optional filename &key (:if-exists t)) (values))
1471 (defknown apropos (string-designator &optional package-designator t) (values))
1472 (defknown apropos-list (string-designator &optional package-designator t) list
1473 (flushable recursive))
1475 (defknown get-decoded-time ()
1476 (values (integer 0 59) (integer 0 59) (integer 0 23) (integer 1 31)
1477 (integer 1 12) unsigned-byte (integer 0 6) boolean (rational -24 24))
1478 (flushable))
1480 (defknown get-universal-time () unsigned-byte (flushable))
1482 (defknown decode-universal-time
1483 (unsigned-byte &optional (or null (rational -24 24)))
1484 (values (integer 0 59) (integer 0 59) (integer 0 23) (integer 1 31)
1485 (integer 1 12) unsigned-byte (integer 0 6) boolean (rational -24 24))
1486 (flushable))
1488 (defknown encode-universal-time
1489 ((integer 0 59) (integer 0 59) (integer 0 23) (integer 1 31)
1490 (integer 1 12) unsigned-byte &optional (or null (rational -24 24)))
1491 unsigned-byte
1492 (flushable))
1494 (defknown (get-internal-run-time get-internal-real-time)
1495 () internal-time (flushable))
1497 (defknown sleep ((real 0)) null ())
1499 (defknown call-with-timing (callable callable &rest t) *
1500 (call))
1502 ;;; Even though ANSI defines LISP-IMPLEMENTATION-TYPE and
1503 ;;; LISP-IMPLEMENTATION-VERSION to possibly punt and return NIL, we
1504 ;;; know that there's no valid reason for our implementations to ever
1505 ;;; do so, so we can safely guarantee that they'll return strings.
1506 (defknown (lisp-implementation-type lisp-implementation-version)
1507 () simple-string (flushable))
1509 ;;; For any of these functions, meaningful information might not be
1510 ;;; available, so -- unlike the related LISP-IMPLEMENTATION-FOO
1511 ;;; functions -- these really can return NIL.
1512 (defknown (machine-type machine-version machine-instance
1513 software-type software-version
1514 short-site-name long-site-name)
1515 () (or simple-string null) (flushable))
1517 (defknown identity (t) t (movable foldable flushable)
1518 :derive-type #'result-type-first-arg)
1520 (defknown constantly (t) function (movable flushable))
1521 (defknown complement (function) function (movable flushable))
1523 ;;;; miscellaneous extensions
1525 (defknown symbol-global-value (symbol) t ())
1526 (defknown set-symbol-global-value (symbol t) t ()
1527 :derive-type #'result-type-last-arg)
1529 (defknown get-bytes-consed () unsigned-byte (flushable))
1530 (defknown mask-signed-field ((integer 0 *) integer) integer
1531 (movable flushable foldable))
1533 (defknown array-storage-vector (array) (simple-array * (*))
1534 (any))
1536 ;;;; magical compiler frobs
1538 (defknown %rest-values (t t t) * (always-translatable))
1539 (defknown %rest-ref (t t t t &optional boolean) * (always-translatable))
1540 (defknown %rest-length (t t t) * (always-translatable))
1541 (defknown %rest-null (t t t t) * (always-translatable))
1542 (defknown %rest-true (t t t) * (always-translatable))
1544 (defknown %unary-truncate/single-float (single-float) integer (movable foldable flushable))
1545 (defknown %unary-truncate/double-float (double-float) integer (movable foldable flushable))
1547 ;;; We can't fold this in general because of SATISFIES. There is a
1548 ;;; special optimizer anyway.
1549 (defknown %typep (t (or type-specifier ctype)) boolean (movable flushable))
1550 (defknown %instance-typep (t (or type-specifier ctype)) boolean
1551 (movable flushable always-translatable))
1552 ;;; We should never emit a call to %typep-wrapper
1553 (defknown %typep-wrapper (t t (or type-specifier ctype)) t
1554 (movable flushable always-translatable))
1556 (defknown %cleanup-point () t)
1557 (defknown %special-bind (t t) t)
1558 (defknown %special-unbind (t) t)
1559 (defknown %listify-rest-args (t index) list (flushable))
1560 (defknown %more-arg-context (t t) (values t index) (flushable))
1561 (defknown %more-arg (t index) t)
1562 #!+stack-grows-downward-not-upward
1563 ;;; FIXME: The second argument here should really be NEGATIVE-INDEX, but doing that
1564 ;;; breaks the build, and I cannot seem to figure out why. --NS 2006-06-29
1565 (defknown %more-kw-arg (t fixnum) (values t t))
1566 (defknown %more-arg-values (t index index) * (flushable))
1568 #!-precise-arg-count-error
1569 (defknown %verify-arg-count (index index) (values))
1571 (defknown %arg-count-error (t t) nil)
1572 (defknown %unknown-values () *)
1573 (defknown %catch (t t) t)
1574 (defknown %unwind-protect (t t) t)
1575 (defknown (%catch-breakup %unwind-protect-breakup) () t)
1576 (defknown %lexical-exit-breakup (t) t)
1577 (defknown %continue-unwind (t t t) nil)
1578 (defknown %throw (t &rest t) nil) ; This is MV-called.
1579 (defknown %nlx-entry (t) *)
1580 (defknown %%primitive (t t &rest t) *)
1581 (defknown %pop-values (t) t)
1582 (defknown %nip-values (t t &rest t) (values))
1583 (defknown %dummy-dx-alloc (t t) t)
1584 (defknown %allocate-closures (t) *)
1585 (defknown %type-check-error (t t) nil)
1586 (defknown %type-check-error/c (t t) nil)
1588 ;; FIXME: This function does not return, but due to the implementation
1589 ;; of FILTER-LVAR we cannot write it here.
1590 (defknown %compile-time-type-error (t t t t t) *)
1591 (defknown case-failure (t t t) nil)
1593 (defknown %odd-key-args-error () nil)
1594 (defknown %unknown-key-arg-error (t) nil)
1595 (defknown (%ldb %mask-field) (bit-index bit-index integer) unsigned-byte
1596 (movable foldable flushable))
1597 (defknown (%dpb %deposit-field) (integer bit-index bit-index integer) integer
1598 (movable foldable flushable))
1599 (defknown %negate (number) number (movable foldable flushable))
1600 (defknown (%check-bound check-bound) (array index t) index
1601 (dx-safe))
1602 (defknown data-vector-ref (simple-array index) t
1603 (foldable unsafely-flushable always-translatable))
1604 (defknown data-vector-ref-with-offset (simple-array fixnum fixnum) t
1605 (foldable unsafely-flushable always-translatable))
1606 (defknown data-nil-vector-ref (simple-array index) nil
1607 (always-translatable))
1608 (defknown data-vector-set (array index t) t
1609 (always-translatable))
1610 (defknown data-vector-set-with-offset (array fixnum fixnum t) t
1611 (always-translatable))
1612 (defknown hairy-data-vector-ref (array index) t (foldable))
1613 (defknown hairy-data-vector-set (array index t) t ())
1614 (defknown hairy-data-vector-ref/check-bounds (array index) t (foldable))
1615 (defknown hairy-data-vector-set/check-bounds (array index t) t ())
1616 (defknown %caller-frame () t (flushable))
1617 (defknown %caller-pc () system-area-pointer (flushable))
1618 (defknown %with-array-data (array index (or index null))
1619 (values (simple-array * (*)) index index index)
1620 (foldable flushable))
1621 (defknown %with-array-data/fp (array index (or index null))
1622 (values (simple-array * (*)) index index index)
1623 (foldable flushable))
1624 (defknown %set-symbol-package (symbol t) t ())
1625 (defknown %coerce-callable-to-fun (callable) function (flushable))
1626 (defknown array-bounding-indices-bad-error (t t t) nil)
1627 (defknown sequence-bounding-indices-bad-error (t t t) nil)
1628 (defknown %find-position
1629 (t sequence t index sequence-end function function)
1630 (values t (or index null))
1631 (flushable call))
1632 (defknown (%find-position-if %find-position-if-not)
1633 (function sequence t index sequence-end function)
1634 (values t (or index null))
1635 (call))
1636 (defknown effective-find-position-test (callable callable)
1637 function
1638 (flushable foldable))
1639 (defknown effective-find-position-key (callable)
1640 function
1641 (flushable foldable))
1643 (defknown (%adjoin %adjoin-eq)
1644 (t list)
1645 list
1646 (flushable))
1648 (defknown (%member %member-eq
1649 %assoc %assoc-eq %rassoc %rassoc-eq)
1650 (t list)
1651 list
1652 (foldable flushable))
1654 (defknown (%adjoin-key %adjoin-key-eq)
1655 (t list function)
1656 list
1657 (flushable call))
1659 (defknown (%member-key %member-key-eq
1660 %assoc-key %assoc-key-eq %rassoc-key %rassoc-key-eq)
1661 (t list function)
1662 list
1663 (foldable flushable call))
1665 (defknown (%assoc-if %assoc-if-not %rassoc-if %rassoc-if-not
1666 %member-if %member-if-not)
1667 (function list)
1668 list
1669 (foldable flushable call))
1671 (defknown (%assoc-if-key %assoc-if-not-key %rassoc-if-key %rassoc-if-not-key
1672 %member-if-key %member-if-not-key)
1673 (function list function)
1674 list
1675 (foldable flushable call))
1677 (defknown (%adjoin-test %adjoin-test-not)
1678 (t list function)
1679 list
1680 (flushable call))
1682 (defknown (%member-test %member-test-not
1683 %assoc-test %assoc-test-not
1684 %rassoc-test %rassoc-test-not)
1685 (t list function)
1686 list
1687 (foldable flushable call))
1689 (defknown (%adjoin-key-test %adjoin-key-test-not)
1690 (t list function function)
1691 list
1692 (flushable call))
1694 (defknown (%member-key-test %member-key-test-not
1695 %assoc-key-test %assoc-key-test-not
1696 %rassoc-key-test %rassoc-key-test-not)
1697 (t list function function)
1698 list
1699 (foldable flushable call))
1701 (defknown %check-vector-sequence-bounds (vector index sequence-end)
1702 index
1703 (unwind))
1705 ;;;; SETF inverses
1707 (defknown (setf aref) (t array &rest index) t ()
1708 :destroyed-constant-args (nth-constant-args 2)
1709 :derive-type #'result-type-first-arg)
1710 (defknown %set-row-major-aref (array index t) t ()
1711 :destroyed-constant-args (nth-constant-args 1))
1712 (defknown (%rplaca %rplacd) (cons t) t ()
1713 :destroyed-constant-args (nth-constant-args 1)
1714 :derive-type #'result-type-last-arg)
1715 (defknown %put (symbol t t) t ())
1716 (defknown %setelt (sequence index t) t ()
1717 :destroyed-constant-args (nth-constant-args 1)
1718 :derive-type #'result-type-last-arg)
1719 (defknown %svset (simple-vector index t) t ()
1720 :destroyed-constant-args (nth-constant-args 1))
1721 (defknown (setf bit) (bit (array bit) &rest index) bit ()
1722 :destroyed-constant-args (nth-constant-args 2))
1723 (defknown (setf sbit) (bit (simple-array bit) &rest index) bit ()
1724 :destroyed-constant-args (nth-constant-args 2))
1725 (defknown %charset (string index character) character ()
1726 :destroyed-constant-args (nth-constant-args 1))
1727 (defknown %scharset (simple-string index character) character ()
1728 :destroyed-constant-args (nth-constant-args 1))
1729 (defknown %set-symbol-value (symbol t) t ())
1730 (defknown (setf symbol-function) (function symbol) function ())
1731 (defknown %set-symbol-plist (symbol list) list ()
1732 :derive-type #'result-type-last-arg)
1733 (defknown %setnth (unsigned-byte list t) t ()
1734 :destroyed-constant-args (nth-constant-args 2)
1735 :derive-type #'result-type-last-arg)
1736 (defknown %set-fill-pointer (complex-vector index) index ()
1737 :destroyed-constant-args (nth-constant-args 1)
1738 :derive-type #'result-type-last-arg)
1740 ;;;; ALIEN and call-out-to-C stuff
1742 ;; Used by WITH-PINNED-OBJECTS
1743 #!+(or x86 x86-64)
1744 (defknown sb!vm::touch-object (t) (values)
1745 (always-translatable))
1747 #!+linkage-table
1748 (defknown foreign-symbol-dataref-sap (simple-string)
1749 system-area-pointer
1750 (movable flushable))
1752 (defknown foreign-symbol-sap (simple-string &optional boolean)
1753 system-area-pointer
1754 (movable flushable))
1756 (defknown foreign-symbol-address (simple-string &optional boolean)
1757 (values integer boolean)
1758 (movable flushable))
1760 ;;;; miscellaneous internal utilities
1762 (defknown %fun-name (function) t (flushable))
1763 (defknown (setf %fun-name) (t function) t ())
1765 (defknown policy-quality (policy symbol) policy-quality
1766 (flushable))
1768 (defknown compiler-error (t &rest t) nil ())
1769 (defknown (compiler-warn compiler-style-warn) (t &rest t) (values) ())
1770 (defknown (compiler-notify maybe-compiler-notify) ((or string symbol) &rest t)
1771 (values)
1773 (defknown style-warn (t &rest t) null ())
1775 (defknown coerce-to-condition ((or condition symbol string function)
1776 list type-specifier symbol)
1777 condition
1780 (defknown coerce-symbol-to-fun (symbol)
1781 function
1784 (defknown sc-number-or-lose (symbol) sc-number
1785 (foldable))
1787 (defknown set-info-value (t info-number t) t ()
1788 :derive-type #'result-type-last-arg)
1790 ;;;; memory barriers
1792 (defknown sb!vm:%compiler-barrier () (values) ())
1793 (defknown sb!vm:%memory-barrier () (values) ())
1794 (defknown sb!vm:%read-barrier () (values) ())
1795 (defknown sb!vm:%write-barrier () (values) ())
1796 (defknown sb!vm:%data-dependency-barrier () (values) ())
1798 #!+sb-safepoint
1799 ;;; Note: This known function does not have an out-of-line definition;
1800 ;;; and if such a definition were needed, it would not need to "call"
1801 ;;; itself inline, but could be a no-op, because the compiler inserts a
1802 ;;; use of the VOP in the function prologue anyway.
1803 (defknown sb!kernel::gc-safepoint () (values) ())
1805 ;;;; atomic ops
1806 (defknown %compare-and-swap-svref (simple-vector index t t) t
1808 (defknown %compare-and-swap-symbol-value (symbol t t) t
1809 (unwind))
1810 (defknown (%atomic-dec-symbol-global-value %atomic-inc-symbol-global-value)
1811 (symbol fixnum) fixnum)
1812 (defknown (%atomic-dec-car %atomic-inc-car %atomic-dec-cdr %atomic-inc-cdr)
1813 (cons fixnum) fixnum)
1814 (defknown spin-loop-hint () (values)
1815 (always-translatable))
1817 ;;;; PCL
1819 (defknown sb!pcl::pcl-instance-p (t) boolean
1820 (movable foldable flushable))
1822 ;; FIXME: should T be be (OR INSTANCE FUNCALLABLE-INSTANCE) etc?
1823 (defknown slot-value (t symbol) t (any))
1824 (defknown (slot-boundp slot-exists-p) (t symbol) boolean)
1825 (defknown sb!pcl::set-slot-value (t symbol t) t (any))
1827 (defknown find-class (symbol &optional t lexenv-designator) (or class null) ())
1828 (defknown class-of (t) class (flushable))
1829 (defknown class-name (class) symbol (flushable))