/[cmucl]/src/compiler/fndb.lisp
ViewVC logotype

Contents of /src/compiler/fndb.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.148 - (show annotations)
Thu Feb 17 02:47:21 2011 UTC (3 years, 1 month ago) by rtoy
Branch: MAIN
CVS Tags: GIT-CONVERSION, snapshot-2011-09, snapshot-2011-06, snapshot-2011-07, snapshot-2011-04, snapshot-2011-03, HEAD
Changes since 1.147: +2 -2 lines
The :OUTPUT-FILE for COMPILE-FILE can be a stream.
This fixes ansi-test COMPILE-FILE.14.

compiler/fndb.lisp:
o Tell compiler that :OUTPUT-FILE can also be a stream.

general-info/release-20c.txt:
o Update.
1 ;;; -*- Package: C; Log: C.Log -*-
2 ;;;
3 ;;; **********************************************************************
4 ;;; This code was written as part of the CMU Common Lisp project at
5 ;;; Carnegie Mellon University, and has been placed in the public domain.
6 ;;;
7 (ext:file-comment
8 "$Header: /tiger/var/lib/cvsroots/cmucl/src/compiler/fndb.lisp,v 1.148 2011/02/17 02:47:21 rtoy Exp $")
9 ;;;
10 ;;; **********************************************************************
11 ;;;
12 ;;; This file defines all the standard functions to be known functions.
13 ;;; Each function has type and side-effect information, and may also have IR1
14 ;;; optimizers.
15 ;;;
16 ;;; Written by Rob MacLachlan
17 ;;;
18 (in-package "C")
19 (intl:textdomain "cmucl")
20
21 (in-package "LISP")
22 (import '(
23 %aset
24 %bitset
25 %charset
26 %primitive
27 %put
28 %puthash
29 %rplaca
30 %rplacd
31 %sbitset
32 %scharset
33 %set-fdefinition
34 %set-fill-pointer
35 %set-row-major-aref
36 %setelt
37 %setnth
38 %standard-char-p
39 %svset
40 %typep
41 array-header-p
42 base-char-p
43 double-float-p
44 long-float-p
45 short-float-p
46 single-float-p
47 string<*
48 string>*
49 string<=*
50 string>=*
51 string=*
52 string/=*
53 %sp-string-compare
54 )
55 "C")
56
57 (in-package "KERNEL")
58
59 (export '(%caller-frame-and-pc %with-array-data))
60
61 (in-package "C")
62
63 (deftype lexenv-or-null () '(or null lexical-environment))
64
65
66 ;;;; Information for known functions:
67
68 (defknown coerce (t type-specifier) t
69 (movable foldable) ; Is defined to signal errors.
70 ;; :derive-type (result-type-specifier-nth-arg 2)
71 ;; This is wrong. (coerce 1 'complex) returns 1, not COMPLEX.
72 )
73
74 (defknown type-of (t) t (foldable flushable))
75
76 ;;; Can be affected by type definitions...
77 (defknown (upgraded-complex-part-type upgraded-array-element-type)
78 (type-specifier &optional lexenv-or-null)
79 type-specifier
80 (flushable))
81
82
83 ;;;; In the "Predicates" chapter:
84
85 (defknown typep (t type-specifier &optional lexenv-or-null)
86 boolean (foldable flushable))
87 (defknown subtypep (type-specifier type-specifier &optional lexenv-or-null)
88 (values boolean boolean)
89 (foldable flushable))
90
91 (defknown (null symbolp atom consp listp numberp integerp rationalp floatp
92 complexp characterp stringp bit-vector-p vectorp
93 simple-vector-p simple-string-p simple-bit-vector-p arrayp
94 packagep functionp compiled-function-p not)
95 (t) boolean (movable foldable flushable))
96
97
98 (defknown (eq eql) (t t) boolean (movable foldable flushable))
99 (defknown (equal equalp) (t t) boolean (foldable flushable recursive))
100
101
102 ;;;; Classes:
103
104 (defknown kernel::find-class (t &optional t lexenv-or-null)
105 (or kernel::class null) ())
106 (defknown kernel::class-of (t) kernel::class (flushable))
107 (defknown layout-of (t) layout (flushable))
108 (defknown copy-structure (structure-object) structure-object
109 (flushable unsafe))
110
111
112 ;;;; In the "Control Structure" chapter:
113
114 ;;; Not flushable, since required to signal an error if unbound.
115 (defknown symbol-value (symbol) t ())
116 (defknown symbol-function (symbol) function ())
117
118 (defknown boundp (symbol) boolean (flushable))
119 (defknown fboundp ((or symbol cons)) boolean (flushable explicit-check))
120 (defknown special-operator-p (symbol) t (movable foldable flushable)) ; They never change...
121 (defknown set (symbol t) t (unsafe)
122 :derive-type #'result-type-last-arg)
123 (defknown fdefinition ((or symbol cons)) function (unsafe explicit-check))
124 (defknown %set-fdefinition ((or symbol cons) function) function
125 (unsafe explicit-check))
126 (defknown makunbound (symbol) symbol)
127 (defknown fmakunbound ((or symbol cons)) (or symbol cons)
128 (unsafe explicit-check))
129 (defknown get-setf-expansion ((or list symbol) &optional lexenv-or-null)
130 (values list list list form form)
131 (flushable))
132
133 (defknown apply (callable t &rest t) *) ; ### Last arg must be List...
134 (defknown funcall (callable &rest t) *)
135
136 (defknown (mapcar maplist mapcan mapcon) (callable list &rest list) list
137 (call dynamic-extent-closure-safe))
138
139 (defknown (mapc mapl) (callable list &rest list) list
140 (foldable call dynamic-extent-closure-safe))
141
142 ;;; We let values-list be foldable, since constant-folding will turn it into
143 ;;; VALUES. VALUES is not foldable, since MV constants are represented by a
144 ;;; call to VALUES.
145 ;;;
146 (defknown values (&rest t) * (movable flushable unsafe))
147 (defknown values-list (list) * (movable foldable flushable))
148
149
150 ;;;; In the "Macros" chapter:
151
152 (defknown macro-function (symbol &optional lexenv-or-null)
153 (or function null)
154 (flushable))
155 (defknown (macroexpand macroexpand-1) (t &optional lexenv-or-null)
156 (values form &optional boolean))
157
158 (defknown compiler-macro-function (t &optional lexenv-or-null)
159 (or function null)
160 (flushable))
161
162
163 ;;;; In the "Declarations" chapter:
164
165 (defknown proclaim (list) void)
166
167
168 ;;;; In the "Symbols" chapter:
169
170 (defknown get (symbol t &optional t) t (flushable))
171 (defknown remprop (symbol t) t)
172 (defknown symbol-plist (symbol) list (flushable))
173 (defknown getf (list t &optional t) t (foldable flushable))
174 (defknown get-properties (list list) (values t t list) (foldable flushable))
175 (defknown symbol-name (symbol) simple-string (movable foldable flushable))
176 (defknown make-symbol (string) symbol (flushable))
177 (defknown copy-symbol (symbol &optional t) symbol (flushable))
178 (defknown gensym (&optional (or string unsigned-byte)) symbol ())
179 (defknown symbol-package (symbol) (or package null) (flushable))
180 (defknown keywordp (t) boolean (flushable)) ; If someone uninterns it...
181
182
183 ;;;; In the "Packages" chapter:
184
185
186 (deftype packagelike () '(or stringable package))
187 (deftype symbols () '(or list symbol))
188
189 ;;; Should allow a package name, I think, tho CLtL II doesn't say so...
190 (defknown gentemp (&optional string packagelike) symbol)
191
192 (defknown make-package (stringable &key (:use list) (:nicknames list)
193 ;; ### Extensions...
194 (:internal-symbols index) (:external-symbols index))
195 package)
196 (defknown find-package (packagelike) (or package null) (flushable))
197 (defknown package-name (packagelike) (or simple-string null) (flushable))
198 (defknown package-nicknames (packagelike) list (flushable))
199 (defknown rename-package (packagelike packagelike &optional list) package)
200 (defknown package-use-list (packagelike) list (flushable))
201 (defknown package-used-by-list (packagelike) list (flushable))
202 (defknown package-shadowing-symbols (packagelike) list (flushable))
203 (defknown list-all-packages () list (flushable))
204 (defknown intern (string &optional packagelike)
205 (values symbol (member :internal :external :inherited nil))
206 ())
207 (defknown find-symbol (string &optional packagelike)
208 (values symbol (member :internal :external :inherited nil))
209 (flushable))
210 (defknown (export import) (symbols &optional packagelike) truth)
211 (defknown unintern (symbol &optional packagelike) boolean)
212 (defknown unexport (symbols &optional packagelike) truth)
213 (defknown shadowing-import (symbols &optional packagelike) truth)
214 (defknown shadow ((or symbol character string list) &optional packagelike) truth)
215 (defknown (use-package unuse-package) ((or list packagelike) &optional packagelike) truth)
216 (defknown find-all-symbols (stringable) list (flushable))
217
218
219 ;;;; In the "Numbers" chapter:
220
221 (defknown zerop (number) boolean (movable foldable flushable explicit-check))
222 (defknown (plusp minusp) (real) boolean
223 (movable foldable flushable explicit-check))
224 (defknown (oddp evenp) (integer) boolean
225 (movable foldable flushable explicit-check))
226 (defknown (= /=) (number &rest number) boolean
227 (movable foldable flushable explicit-check))
228 (defknown (< > <= >=) (real &rest real) boolean
229 (movable foldable flushable explicit-check))
230 (defknown (max min) (real &rest real) real
231 (movable foldable flushable explicit-check))
232
233 (defknown + (&rest number) number
234 (movable foldable flushable explicit-check))
235 (defknown - (number &rest number) number
236 (movable foldable flushable explicit-check))
237 (defknown * (&rest number) number
238 (movable foldable flushable explicit-check))
239 (defknown / (number &rest number) number
240 (movable foldable flushable explicit-check))
241 (defknown (1+ 1-) (number) number
242 (movable foldable flushable explicit-check))
243
244 (defknown conjugate (number) number
245 (movable foldable flushable explicit-check))
246
247 (defknown gcd (&rest integer) unsigned-byte
248 (movable foldable flushable explicit-check)
249 #|:derive-type 'boolean-result-type|#)
250 (defknown lcm (&rest integer) unsigned-byte
251 (movable foldable flushable explicit-check))
252
253 (defknown exp (number) irrational
254 (movable foldable flushable explicit-check recursive))
255
256
257 (defknown expt (number number) number
258 (movable foldable flushable explicit-check recursive))
259 (defknown log (number &optional real) irrational
260 (movable foldable flushable explicit-check))
261 (defknown sqrt (number) irrational
262 (movable foldable flushable explicit-check))
263 (defknown isqrt (unsigned-byte) unsigned-byte
264 (movable foldable flushable explicit-check))
265
266 (defknown (abs phase signum) (number) number
267 (movable foldable flushable explicit-check))
268 (defknown cis (real) (complex float)
269 (movable foldable flushable explicit-check))
270
271 (defknown (sin cos) (number)
272 (or (float -1.0 1.0) (complex float))
273 (movable foldable flushable explicit-check recursive))
274
275 (defknown atan
276 (number &optional real) irrational
277 (movable foldable flushable explicit-check recursive))
278
279 (defknown (tan sinh cosh tanh asinh)
280 (number) irrational (movable foldable flushable explicit-check recursive))
281
282 (defknown (asin acos acosh atanh)
283 (number) irrational
284 (movable foldable flushable explicit-check recursive))
285
286 (defknown float (real &optional float) float
287 (movable foldable flushable explicit-check))
288
289 (defknown (rational rationalize) (real) rational
290 (movable foldable flushable explicit-check))
291
292 (defknown (numerator denominator) (rational) integer
293 (movable foldable flushable))
294
295 (defknown (floor ceiling truncate round)
296 (real &optional real) (values integer real)
297 (movable foldable flushable explicit-check))
298
299 (defknown (mod rem) (real real) real
300 (movable foldable flushable explicit-check))
301
302 (defknown (ffloor fceiling fround ftruncate)
303 (real &optional real) (values float real)
304 (movable foldable flushable explicit-check))
305
306 (defknown decode-float (float)
307 (values (float 0.5d0 (1d0))
308 float-exponent
309 (member 1f0 -1f0 -1d0 1d0))
310 (movable foldable flushable explicit-check))
311 (defknown scale-float (float float-exponent) float
312 (movable foldable flushable explicit-check))
313 (defknown float-radix (float) float-radix
314 (movable foldable flushable explicit-check))
315 (defknown float-sign (float &optional float) float
316 (movable foldable flushable explicit-check))
317 (defknown (float-digits float-precision) (float) float-digits
318 (movable foldable flushable explicit-check))
319 (defknown integer-decode-float (float)
320 (values integer float-exponent (member -1 1))
321 (movable foldable flushable explicit-check))
322
323 (defknown complex (real &optional real) number
324 (movable foldable flushable explicit-check))
325
326 (defknown (realpart imagpart) (number) real (movable foldable flushable))
327
328 (defknown (logior logxor logand logeqv) (&rest integer) integer
329 (movable foldable flushable explicit-check))
330
331 (defknown (lognand lognor logandc1 logandc2 logorc1 logorc2)
332 (integer integer) integer
333 (movable foldable flushable explicit-check))
334
335 (defknown boole (boole-code integer integer) integer
336 (movable foldable flushable))
337
338 (defknown lognot (integer) integer (movable foldable flushable explicit-check))
339 (defknown logtest (integer integer) boolean (movable foldable flushable))
340 (defknown logbitp (unsigned-byte integer) boolean (movable foldable flushable))
341 (defknown ash (integer ash-index) integer (movable foldable flushable explicit-check))
342 (defknown (logcount integer-length) (integer) bit-index
343 (movable foldable flushable explicit-check))
344 (defknown byte (bit-index bit-index) byte-specifier
345 (movable foldable flushable))
346 (defknown (byte-size byte-position) (byte-specifier) bit-index
347 (movable foldable flushable))
348 (defknown ldb (byte-specifier integer) integer (movable foldable flushable))
349 (defknown ldb-test (byte-specifier integer) boolean
350 (movable foldable flushable))
351 (defknown mask-field (byte-specifier integer) integer
352 (movable foldable flushable))
353 (defknown dpb (integer byte-specifier integer) integer
354 (movable foldable flushable))
355 (defknown deposit-field (integer byte-specifier integer) integer
356 (movable foldable flushable))
357 (defknown random (real &optional random-state) real ())
358 (defknown make-random-state (&optional (or (member nil t) random-state))
359 random-state (flushable))
360 (defknown random-state-p (t) boolean (movable foldable flushable))
361
362 ;;; In "Characters" chapter:
363 (defknown (standard-char-p graphic-char-p alpha-char-p
364 upper-case-p lower-case-p both-case-p alphanumericp)
365 (character) boolean (movable foldable flushable))
366
367 (defknown digit-char-p (character &optional unsigned-byte)
368 (or (integer 0 35) null) (movable foldable flushable))
369
370 (defknown (char= char/= char< char> char<= char>= char-equal char-not-equal
371 char-lessp char-greaterp char-not-greaterp char-not-lessp)
372 (character &rest character) boolean (movable foldable flushable))
373
374 (defknown character (t) character (movable foldable flushable))
375 (defknown char-code (character) char-code (movable foldable flushable))
376 (defknown code-char (char-code) base-char (movable foldable flushable))
377 (defknown (char-upcase char-downcase) (character) character
378 (movable foldable flushable))
379 (defknown digit-char (integer &optional integer)
380 (or character null) (movable foldable flushable))
381 (defknown char-int (character) char-code (movable foldable flushable))
382 (defknown char-name (character) (or simple-string null)
383 (movable foldable flushable))
384 (defknown name-char (stringable) (or character null)
385 (movable foldable flushable))
386
387
388 ;;;; In the "Sequences" chapter:
389
390 (defknown elt (sequence index) t (foldable flushable))
391
392 (defknown subseq (sequence index &optional sequence-end) consed-sequence
393 (flushable)
394 :derive-type (sequence-result-nth-arg 1))
395
396 (defknown copy-seq (sequence) consed-sequence (flushable)
397 :derive-type (sequence-result-nth-arg 1))
398
399
400 (defknown length (sequence) index (foldable flushable))
401
402 (defknown reverse (sequence) consed-sequence (flushable)
403 :derive-type #'result-type-first-arg/reverse)
404
405 (defknown nreverse (sequence) sequence ()
406 :derive-type #'result-type-first-arg/reverse
407 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1)
408 :result-not-used (list-function-result-not-used 1))
409
410 (defknown make-sequence (type-specifier index &key (:initial-element t)) consed-sequence
411 (movable flushable unsafe)
412 ;; Nope: If the type-specifier isn't a consed-sequence, we get confused.
413 ;;:derive-type (result-type-specifier-nth-arg 1)
414 )
415
416 (defknown concatenate (type-specifier &rest sequence) consed-sequence
417 (flushable)
418 ;; Nope: If the type-specifier isn't a consed-sequence, we get confused.
419 ;;:derive-type (result-type-specifier-nth-arg 1)
420 )
421
422 (defknown map (type-specifier callable sequence &rest sequence) consed-sequence
423 (flushable call dynamic-extent-closure-safe)
424 ; :derive-type 'type-spec-arg1 Nope... (map nil ...) returns null, not nil.
425 )
426
427 (defknown map-into (sequence callable &rest sequence)
428 sequence
429 (call dynamic-extent-closure-safe)
430 :derive-type #'result-type-first-arg
431 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
432
433 ;;; Returns predicate result...
434 (defknown some (callable sequence &rest sequence) t
435 (foldable flushable call dynamic-extent-closure-safe))
436
437 (defknown (every notany notevery) (callable sequence &rest sequence) boolean
438 (foldable flushable call dynamic-extent-closure-safe))
439
440 ;;; Unsafe for :Initial-Value...
441 (defknown reduce (callable sequence &key (:from-end t) (:start index)
442 (:end sequence-end) (:initial-value t) (:key callable))
443 t
444 (foldable flushable call unsafe dynamic-extent-closure-safe))
445
446 (defknown fill (sequence t &key (:start index) (:end sequence-end)) sequence
447 (unsafe)
448 :derive-type #'result-type-first-arg
449 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
450
451 (defknown replace (sequence sequence &key (:start1 index) (:end1 sequence-end)
452 (:start2 index) (:end2 sequence-end))
453 sequence ()
454 :derive-type #'result-type-first-arg
455 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
456
457 (defknown remove
458 (t sequence &key (:from-end t) (:test callable)
459 (:test-not callable) (:start index) (:end sequence-end)
460 (:count sequence-count) (:key callable))
461 consed-sequence
462 (flushable call dynamic-extent-closure-safe)
463 :derive-type (sequence-result-nth-arg 2))
464
465 (defknown substitute
466 (t t sequence &key (:from-end t) (:test callable)
467 (:test-not callable) (:start index) (:end sequence-end)
468 (:count sequence-count) (:key callable))
469 consed-sequence
470 (flushable call dynamic-extent-closure-safe)
471 :derive-type (sequence-result-nth-arg 3))
472
473 (defknown (remove-if remove-if-not)
474 (callable sequence &key (:from-end t) (:start index) (:end sequence-end)
475 (:count sequence-count) (:key callable))
476 consed-sequence
477 (flushable call dynamic-extent-closure-safe)
478 :derive-type (sequence-result-nth-arg 2))
479
480 (defknown (substitute-if substitute-if-not)
481 (t callable sequence &key (:from-end t) (:start index) (:end sequence-end)
482 (:count sequence-count) (:key callable))
483 consed-sequence
484 (flushable call dynamic-extent-closure-safe)
485 :derive-type (sequence-result-nth-arg 3))
486
487 (defknown delete
488 (t sequence &key (:from-end t) (:test callable)
489 (:test-not callable) (:start index) (:end sequence-end)
490 (:count sequence-count) (:key callable))
491 sequence
492 (flushable call dynamic-extent-closure-safe)
493 :derive-type (sequence-result-nth-arg 2)
494 :destroyed-constant-args (nth-constant-nonempty-sequence-args 2)
495 :result-not-used (list-function-result-not-used 2))
496
497 (defknown nsubstitute
498 (t t sequence &key (:from-end t) (:test callable)
499 (:test-not callable) (:start index) (:end sequence-end)
500 (:count sequence-count) (:key callable))
501 sequence
502 (flushable call dynamic-extent-closure-safe)
503 :derive-type (sequence-result-nth-arg 3)
504 :destroyed-constant-args (nth-constant-nonempty-sequence-args 3))
505
506 (defknown (delete-if delete-if-not)
507 (callable sequence &key (:from-end t) (:start index) (:end sequence-end)
508 (:count sequence-count) (:key callable))
509 sequence
510 (flushable call dynamic-extent-closure-safe)
511 :derive-type (sequence-result-nth-arg 2)
512 :destroyed-constant-args (nth-constant-nonempty-sequence-args 2)
513 :result-not-used (list-function-result-not-used 2))
514
515 (defknown (nsubstitute-if nsubstitute-if-not)
516 (t callable sequence &key (:from-end t) (:start index) (:end sequence-end)
517 (:count sequence-count) (:key callable))
518 sequence
519 (flushable call dynamic-extent-closure-safe)
520 :derive-type (sequence-result-nth-arg 3)
521 :destroyed-constant-args (nth-constant-nonempty-sequence-args 3))
522
523 (defknown remove-duplicates
524 (sequence &key (:test callable) (:test-not callable) (:start index) (:from-end t)
525 (:end sequence-end) (:key callable))
526 consed-sequence
527 (flushable call dynamic-extent-closure-safe)
528 :derive-type (sequence-result-nth-arg 1))
529
530 (defknown delete-duplicates
531 (sequence &key (:test callable) (:test-not callable) (:start index) (:from-end t)
532 (:end sequence-end) (:key callable))
533 sequence
534 (flushable call dynamic-extent-closure-safe)
535 :derive-type (sequence-result-nth-arg 1)
536 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1)
537 :result-not-used (list-function-result-not-used 1))
538
539 (defknown find (t sequence &key (:test callable) (:test-not callable)
540 (:start index) (:from-end t) (:end sequence-end) (:key callable))
541 t
542 (foldable flushable call dynamic-extent-closure-safe))
543
544 (defknown (find-if find-if-not)
545 (callable sequence &key (:from-end t) (:start index) (:end sequence-end)
546 (:key callable))
547 t
548 (foldable flushable call dynamic-extent-closure-safe))
549
550 (defknown position (t sequence &key (:test callable) (:test-not callable)
551 (:start index) (:from-end t) (:end sequence-end)
552 (:key callable))
553 (or index null)
554 (foldable flushable call dynamic-extent-closure-safe))
555
556 (defknown (position-if position-if-not)
557 (callable sequence &key (:from-end t) (:start index) (:end sequence-end)
558 (:key callable))
559 (or index null)
560 (foldable flushable call dynamic-extent-closure-safe))
561
562 (defknown count (t sequence &key (:test callable) (:test-not callable)
563 (:start index) (:from-end t) (:end sequence-end)
564 (:key callable))
565 index
566 (foldable flushable call dynamic-extent-closure-safe))
567
568 (defknown (count-if count-if-not)
569 (callable sequence &key (:from-end t) (:start index) (:end sequence-end)
570 (:key callable))
571 index
572 (foldable flushable call dynamic-extent-closure-safe))
573
574 (defknown (mismatch search)
575 (sequence sequence &key (:from-end t) (:test callable) (:test-not callable)
576 (:start1 index) (:end1 sequence-end) (:start2 index) (:end2 sequence-end)
577 (:key callable))
578 (or index null)
579 (foldable flushable call dynamic-extent-closure-safe))
580
581 ;;; Not flushable, since vector sort guaranteed in-place...
582 (defknown (stable-sort sort) (sequence callable &key (:key callable)) sequence
583 (call dynamic-extent-closure-safe)
584 :derive-type (sequence-result-nth-arg 1)
585 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1)
586 :result-not-used (list-function-result-not-used 1))
587
588 (defknown merge (type-specifier sequence sequence callable
589 &key (:key callable))
590 sequence
591 (flushable call dynamic-extent-closure-safe)
592 :derive-type (result-type-specifier-nth-arg 1)
593 :destroyed-constant-args (nth-constant-nonempty-sequence-args 2 3)
594 ;; FIXME! This is a little complicated.
595 ;;:result-not-used #'function-result-not-used-p
596 )
597
598 (defknown read-sequence (sequence stream &key (:start index)
599 (:end sequence-end)
600 (:partial-fill boolean))
601 (index) ())
602
603 (defknown write-sequence (sequence stream &key (:start index)
604 (:end sequence-end))
605 sequence ()
606 :derive-type (sequence-result-nth-arg 1))
607
608
609 ;;;; In the "Manipulating List Structure" chapter:
610
611 (defknown (car cdr caar cadr cdar cddr caaar caadr cadar caddr cdaar cdadr
612 cddar cdddr caaaar caaadr caadar caaddr cadaar cadadr caddar
613 cadddr cdaaar cdaadr cdadar cdaddr cddaar cddadr cdddar cddddr
614 first second third fourth fifth sixth seventh eighth ninth tenth
615 rest)
616 (list) t (foldable flushable))
617
618 (defknown cons (t t) cons (movable flushable unsafe))
619
620 (defknown tree-equal (t t &key (:test callable) (:test-not callable)) boolean
621 (foldable flushable call dynamic-extent-closure-safe))
622 (defknown endp (list) boolean (foldable flushable movable))
623 (defknown list-length (list) (or index null) (foldable flushable))
624 (defknown (nth nthcdr) (unsigned-byte list) t (foldable flushable))
625 (defknown last (list &optional unsigned-byte) list (foldable flushable))
626 (defknown list (&rest t) list (movable flushable unsafe))
627 (defknown list* (t &rest t) t (movable flushable unsafe))
628 (defknown make-list (index &key (:initial-element t)) list
629 (movable flushable unsafe))
630
631 ;;;
632 ;;; All but last must be list...
633 (defknown append (&rest t) t (flushable))
634
635 (defknown copy-list (list) list (flushable))
636 (defknown copy-alist (list) list (flushable))
637 (defknown copy-tree (t) t (flushable))
638 (defknown revappend (list t) t (flushable))
639 (defknown nconc (&rest t) t ()
640 :destroyed-constant-args (remove-non-constants-and-nils #'butlast))
641 (defknown nreconc (list t) list ()
642 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1)
643 :result-not-used #'function-result-not-used-p)
644 (defknown butlast (list &optional unsigned-byte) list (flushable))
645 (defknown nbutlast (list &optional unsigned-byte) list ()
646 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
647 (defknown ldiff (list t) list (flushable))
648 (defknown (rplaca rplacd) (cons t) list (unsafe)
649 :destroyed-constant-args (nth-constant-args 1))
650
651 (defknown subst (t t t &key (:key callable) (:test callable)
652 (:test-not callable))
653 t (flushable unsafe call))
654
655 (defknown (nsubst) (t t t &key (:key callable) (:test callable)
656 (:test-not callable))
657 list (flushable unsafe call dynamic-extent-closure-safe)
658 :destroyed-constant-args (nth-constant-nonempty-sequence-args 3))
659
660 (defknown (subst-if subst-if-not nsubst-if nsubst-if-not)
661 (t t t &key (:key callable))
662 list (flushable unsafe call dynamic-extent-closure-safe)
663 :destroyed-constant-args (nth-constant-nonempty-sequence-args 3))
664
665 (defknown (sublis) (list t &key (:key callable) (:test callable)
666 (:test-not callable))
667 list (flushable unsafe call dynamic-extent-closure-safe))
668
669 (defknown nsublis (list t &key (:key callable) (:test callable)
670 (:test-not callable))
671 t (flushable unsafe call)
672 :destroyed-constant-args (nth-constant-nonempty-sequence-args 2))
673
674 (defknown member (t list &key (:key callable) (:test callable)
675 (:test-not callable))
676 list (foldable flushable call dynamic-extent-closure-safe))
677 (defknown (member-if member-if-not) (callable list &key (:key callable))
678 list (foldable flushable call dynamic-extent-closure-safe))
679
680 (defknown tailp (t list) boolean (foldable flushable))
681
682 (defknown adjoin (t list &key (:key callable) (:test callable)
683 (:test-not callable))
684 list (foldable flushable unsafe call dynamic-extent-closure-safe))
685
686 (defknown (union intersection set-difference set-exclusive-or)
687 (list list &key (:key callable) (:test callable) (:test-not callable))
688 list
689 (foldable flushable call dynamic-extent-closure-safe))
690
691 (defknown (nunion nintersection nset-difference nset-exclusive-or)
692 (list list &key (:key callable) (:test callable) (:test-not callable))
693 list
694 (foldable flushable call dynamic-extent-closure-safe)
695 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1 2)
696 :result-not-used #'function-result-not-used-p)
697
698 (defknown subsetp (list list &key (:key callable) (:test callable)
699 (:test-not callable))
700 boolean
701 (foldable flushable call dynamic-extent-closure-safe))
702
703 (defknown acons (t t t) list (movable flushable unsafe))
704 (defknown pairlis (t t &optional t) list (flushable unsafe))
705
706 (defknown (rassoc assoc)
707 (t list &key (:key callable) (:test callable) (:test-not callable))
708 list (foldable flushable call dynamic-extent-closure-safe))
709 (defknown (assoc-if-not assoc-if rassoc-if rassoc-if-not)
710 (callable list &key (:key callable)) list
711 (foldable flushable call dynamic-extent-closure-safe))
712
713 (defknown (memq assq) (t list) list (foldable flushable unsafe))
714 (defknown delq (t list) list (flushable unsafe)
715 :destroyed-constant-args (nth-constant-nonempty-sequence-args 2))
716
717
718 ;;;; In the "Hash Tables" chapter:
719
720 (defknown make-hash-table
721 (&key (:test callable) (:size index)
722 (:rehash-size (or (integer 1) (float (1.0))))
723 (:rehash-threshold (real 0 1))
724 (:weak-p t))
725 hash-table
726 (flushable unsafe))
727 (defknown hash-table-p (t) boolean (movable foldable flushable))
728 (defknown gethash (t hash-table &optional t) (values t boolean)
729 (foldable flushable unsafe))
730 (defknown %puthash (t hash-table t) t (unsafe)
731 :destroyed-constant-args (nth-constant-args 2))
732 (defknown remhash (t hash-table) boolean ()
733 :destroyed-constant-args (nth-constant-args 2))
734 (defknown maphash (callable hash-table) null
735 (foldable flushable call dynamic-extent-closure-safe))
736 (defknown clrhash (hash-table) hash-table ()
737 :destroyed-constant-args (nth-constant-args 1))
738 (defknown hash-table-count (hash-table) index (foldable flushable))
739 (defknown hash-table-rehash-size (hash-table) (or (integer 1) (float (1.0)))
740 (foldable flushable))
741 (defknown hash-table-rehash-threshold (hash-table) (real 0 1)
742 (foldable flushable))
743 (defknown hash-table-size (hash-table) index (foldable flushable))
744 (defknown hash-table-test (hash-table) symbol (foldable flushable))
745 (deftype non-negative-fixnum () `(integer 0 ,most-positive-fixnum))
746 (defknown sxhash (t) non-negative-fixnum (foldable flushable))
747
748
749 ;;;; In the "Arrays" chapter:
750
751 (defknown make-array ((or index list) &key (:element-type type-specifier)
752 (:initial-element t) (:initial-contents t)
753 (:adjustable t) (:fill-pointer t)
754 (:displaced-to (or array null))
755 (:displaced-index-offset index)
756 (:allocation (member nil :malloc)))
757 array (flushable unsafe))
758
759 (defknown vector (&rest t) simple-vector (flushable unsafe))
760
761 (defknown aref (array &rest index) t (foldable flushable))
762 (defknown row-major-aref (array index) t (foldable flushable))
763
764 (defknown array-element-type (array) type-specifier (foldable flushable))
765 (defknown array-rank (array) array-rank (foldable flushable))
766 (defknown array-dimension (array array-rank) index (foldable flushable))
767 (defknown array-dimensions (array) list (foldable flushable))
768 (defknown array-in-bounds-p (array &rest integer) boolean (foldable flushable))
769 (defknown array-row-major-index (array &rest index) array-total-size
770 (foldable flushable))
771 (defknown array-total-size (array) array-total-size (foldable flushable))
772 (defknown adjustable-array-p (array) boolean (movable foldable flushable))
773
774 (defknown svref (simple-vector index) t (foldable flushable))
775 (defknown bit ((array bit) &rest index) bit (foldable flushable))
776 (defknown sbit ((simple-array bit) &rest index) bit (foldable flushable))
777
778 ;;; FIXME: :DESTROYED-CONSTANT-ARGS for these is complicated.
779 (defknown (bit-and bit-ior bit-xor bit-eqv bit-nand bit-nor bit-andc1 bit-andc2
780 bit-orc1 bit-orc2)
781 ((array bit) (array bit) &optional (or (array bit) (member nil t)))
782 (array bit)
783 (foldable)
784 #|:derive-type #'result-type-last-arg|#)
785
786 (defknown bit-not ((array bit) &optional (or (array bit) (member nil t)))
787 (array bit)
788 (foldable)
789 #|:derive-type #'result-type-last-arg|#)
790
791 (defknown array-has-fill-pointer-p (array) boolean (movable foldable flushable))
792 (defknown fill-pointer (vector) index (foldable flushable))
793 (defknown vector-push (t vector) (or index null) ()
794 :destroyed-constant-args (nth-constant-args 2))
795 (defknown vector-push-extend (t vector &optional index) index ()
796 :destroyed-constant-args (nth-constant-args 2))
797 (defknown vector-pop (vector) t ()
798 :destroyed-constant-args (nth-constant-args 1))
799
800 ;;; FIXME: complicated :DESTROYED-CONSTANT-ARGS
801 ;;; Also, an important-result warning could be provided if the array
802 ;;; is known to be not expressly adjustable.
803 (defknown adjust-array
804 (array (or index list) &key (:element-type type-specifier)
805 (:initial-element t) (:initial-contents t)
806 (:fill-pointer t) (:displaced-to (or array null))
807 (:displaced-index-offset index))
808 array (unsafe)
809 :result-not-used #'adjust-array-result-not-used-p)
810 ; :derive-type 'result-type-arg1) Not even close...
811
812
813 ;;;; In the "Strings" chapter:
814
815 (defknown char (string index) character (foldable flushable))
816 (defknown schar (simple-string index) character (foldable flushable))
817
818 (deftype stringable () '(or character string symbol))
819
820 ;; Case folding mode (in case we want language-specific converssions)
821 #+unicode
822 (deftype case-folding-type ()
823 `(member :simple :full))
824
825 ;; Case conversion mode (in case we ever want language-specific conversions)
826 #+unicode
827 (deftype case-conversion-type ()
828 `(member :simple :full))
829
830 (defknown (string= string-equal)
831 (stringable stringable &key (:start1 index) (:end1 sequence-end)
832 (:start2 index) (:end2 sequence-end))
833 boolean
834 (foldable flushable))
835
836 (defknown (string< string> string<= string>= string/= string-lessp
837 string-greaterp string-not-lessp string-not-greaterp
838 string-not-equal)
839 (stringable stringable &key (:start1 index) (:end1 sequence-end)
840 (:start2 index) (:end2 sequence-end))
841 (or index null)
842 (foldable flushable))
843
844 (defknown make-string (index &key (:element-type type-specifier)
845 (:initial-element character))
846 simple-string (flushable))
847
848 (defknown (string-trim string-left-trim string-right-trim)
849 (sequence stringable) simple-string (flushable))
850
851 (defknown (string-upcase string-downcase)
852 (stringable &key (:start index) (:end sequence-end) #+unicode (:casing case-conversion-type))
853 simple-string (flushable))
854
855 (defknown (string-capitalize)
856 (stringable &key (:start index) (:end sequence-end)
857 #+unicode (:casing case-conversion-type)
858 #+unicode (:unicode-word-break boolean))
859 simple-string (flushable))
860
861 (defknown (nstring-upcase nstring-downcase nstring-capitalize)
862 (string &key (:start index) (:end sequence-end))
863 string ()
864 :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
865
866 (defknown string (stringable) string
867 (flushable explicit-check))
868
869
870 ;;; Internal non-keyword versions of string predicates:
871
872 (defknown (string<* string>* string<=* string>=* string/=*)
873 (stringable stringable index sequence-end index sequence-end)
874 (or index null)
875 (foldable flushable))
876
877 (defknown string=*
878 (stringable stringable index sequence-end index sequence-end)
879 boolean
880 (foldable flushable))
881
882
883 ;;;; In the "Eval" chapter:
884
885 (defknown eval (t) *)
886 (defknown constantp (t &optional lexenv-or-null) boolean
887 (foldable flushable))
888
889
890 ;;;; In the "Streams" chapter:
891
892 (defknown make-synonym-stream (symbol) stream (flushable))
893 (defknown make-broadcast-stream (&rest stream) stream (flushable))
894 (defknown make-concatenated-stream (&rest stream) stream (flushable))
895 (defknown make-two-way-stream (stream stream) stream (flushable))
896 (defknown make-echo-stream (stream stream) stream (flushable))
897 (defknown make-string-input-stream (string &optional index index) stream (flushable unsafe))
898 (defknown make-string-output-stream (&key (:element-type type-specifier))
899 stream
900 (flushable))
901 (defknown get-output-stream-string (stream) simple-string ())
902 (defknown streamp (t) boolean (movable foldable flushable))
903 (defknown stream-element-type (stream) type-specifier (movable foldable flushable))
904 (defknown (output-stream-p input-stream-p) (stream) boolean (movable foldable
905 flushable))
906 (defknown close (stream &key (:abort t)) t ())
907
908
909 ;;;; In the "Input/Output" chapter:
910
911 ;;; The I/O functions are currently given effects ANY under the theory that
912 ;;; code motion over I/O operations is particularly confusing and not very
913 ;;; important for efficency.
914
915 (defknown copy-readtable (&optional (or readtable null) (or readtable null))
916 readtable
917 ())
918 (defknown readtablep (t) boolean (movable foldable flushable))
919
920 (defknown set-syntax-from-char
921 (character character &optional (or readtable null) readtable) void
922 ())
923
924 (defknown set-macro-character (character callable &optional t readtable) void
925 (unsafe))
926 (defknown get-macro-character (character &optional (or readtable null))
927 (values callable boolean) (flushable))
928
929 (defknown make-dispatch-macro-character (character &optional t readtable)
930 void ())
931 (defknown set-dispatch-macro-character
932 (character character callable &optional readtable) void
933 (unsafe))
934 (defknown get-dispatch-macro-character
935 (character character &optional (or readtable null)) callable
936 ())
937
938 ;;; May return any type due to eof-value...
939 (defknown (read read-preserving-whitespace read-char-no-hang read-char)
940 (&optional streamlike t t t) t (explicit-check))
941
942 (defknown read-delimited-list (character &optional streamlike t) list
943 (explicit-check))
944 (defknown read-line (&optional streamlike t t t) (values t boolean)
945 (explicit-check))
946 (defknown unread-char (character &optional streamlike) t
947 (explicit-check))
948 (defknown peek-char (&optional (or character (member nil t)) streamlike t t t)
949 t
950 (explicit-check))
951 (defknown listen (&optional streamlike
952 (or null (integer 1 10) (member character)))
953 boolean (flushable explicit-check))
954
955 (defknown clear-input (&optional stream boolean) null (explicit-check))
956
957 (defknown read-from-string
958 (string &optional t t &key (:start index) (:end sequence-end)
959 (:preserve-whitespace t))
960 (values t index))
961 (defknown parse-integer
962 (string &key (:start index) (:end sequence-end) (:radix (integer 2 36))
963 (:junk-allowed t))
964 (values (or integer null ()) index))
965
966 (defknown read-byte (stream &optional t t) t (explicit-check))
967
968 (defknown write
969 (t &key (:stream streamlike) (:escape t) (:radix t) (:base (integer 2 36))
970 (:circle t) (:pretty t) (:level (or unsigned-byte null)) (:readably t)
971 (:length (or unsigned-byte null)) (:case t) (:array t) (:gensym t)
972 (:lines (or unsigned-byte null)) (:right-margin (or unsigned-byte null))
973 (:miser-width (or unsigned-byte null)) (:pprint-dispatch t))
974 t
975 (any explicit-check)
976 :derive-type #'result-type-first-arg)
977
978 (defknown (prin1 print princ) (t &optional streamlike) t (any explicit-check)
979 :derive-type #'result-type-first-arg)
980
981 ;;; xxx-TO-STRING not foldable because they depend on the dynamic environment.
982 (defknown write-to-string
983 (t &key (:escape t) (:radix t) (:base (integer 2 36)) (:readably t)
984 (:circle t) (:pretty t) (:level (or unsigned-byte null))
985 (:length (or unsigned-byte null)) (:case t) (:array t) (:gensym t)
986 (:lines (or unsigned-byte null)) (:right-margin (or unsigned-byte null))
987 (:miser-width (or unsigned-byte null)) (:pprint-dispatch t))
988 simple-string
989 (foldable flushable explicit-check))
990
991 (defknown (prin1-to-string princ-to-string) (t) simple-string (flushable))
992
993 (defknown write-char (character &optional streamlike) character
994 (explicit-check))
995 (defknown (write-string write-line)
996 (string &optional streamlike &key (:start index) (:end sequence-end))
997 string
998 (explicit-check))
999
1000 (defknown (terpri finish-output force-output clear-output)
1001 (&optional streamlike) null
1002 (explicit-check))
1003
1004 (defknown fresh-line (&optional streamlike) boolean
1005 (explicit-check))
1006
1007 (defknown write-byte (integer stream) integer
1008 (explicit-check))
1009
1010 ;;; FIXME: complicated :DESTROYED-CONSTANT-ARGS
1011 (defknown format ((or streamlike string) (or string function) &rest t)
1012 (or string null)
1013 (explicit-check))
1014
1015 (defknown (y-or-n-p yes-or-no-p) (&optional string &rest t) boolean
1016 (explicit-check))
1017
1018
1019 ;;;; In the "File System Interface" chapter:
1020
1021 ;;; No pathname functions are foldable because they all potentially depend on
1022 ;;; *default-pathname-defaults*, e.g. to provide a default host when parsing a
1023 ;;; namestring.
1024
1025 (defknown wild-pathname-p (pathnamelike &optional (member nil :host :device
1026 :directory :name
1027 :type :version))
1028 boolean
1029 (flushable))
1030 (defknown pathname-match-p (pathnamelike pathnamelike) boolean
1031 (flushable))
1032 (defknown translate-pathname (pathnamelike pathnamelike pathnamelike &key)
1033 pathname
1034 (flushable))
1035
1036 ;;; Need to add the logical pathname stuff here.
1037
1038 (defknown pathname (pathnamelike) pathname (flushable))
1039 (defknown truename (pathnamelike) pathname ())
1040
1041 (defknown parse-namestring
1042 (pathnamelike &optional (or string pathname-host) pathnamelike
1043 &key (:start index) (:end sequence-end) (:junk-allowed t))
1044 (values (or pathname null) sequence-end)
1045 ())
1046
1047 (defknown merge-pathnames
1048 (pathnamelike &optional pathnamelike pathname-version)
1049 pathname
1050 (flushable))
1051
1052 (defknown make-pathname
1053 (&key (:defaults pathnamelike)
1054 (:host (or null string pathname-host))
1055 (:device (or string pathname-device))
1056 (:directory (or pathname-directory string (member :wild)))
1057 (:name (or pathname-name string (member :wild)))
1058 (:type (or pathname-type string (member :wild)))
1059 (:version pathname-version) (:case (member :local :common)))
1060 pathname (flushable))
1061
1062 (defknown pathnamep (t) boolean (movable flushable))
1063
1064 (defknown pathname-host (pathnamelike &key (:case (member :local :common)))
1065 (or simple-string null) (flushable))
1066 (defknown pathname-device (pathnamelike &key (:case (member :local :common)))
1067 pathname-device (flushable))
1068 (defknown pathname-directory (pathnamelike &key (:case (member :local :common)))
1069 pathname-directory (flushable))
1070 (defknown pathname-name (pathnamelike &key (:case (member :local :common)))
1071 pathname-name (flushable))
1072 (defknown pathname-type (pathnamelike &key (:case (member :local :common)))
1073 pathname-type (flushable))
1074 (defknown pathname-version (pathnamelike)
1075 pathname-version (flushable))
1076
1077 (defknown (namestring file-namestring directory-namestring host-namestring)
1078 (pathnamelike) (or null simple-string)
1079 (flushable))
1080
1081 (defknown enough-namestring (pathnamelike &optional pathnamelike)
1082 simple-string
1083 (flushable))
1084
1085 (defknown user-homedir-pathname (&optional t) pathname (flushable))
1086
1087 (defknown open (t &rest t
1088 &key (:direction (member :input :output :io :probe))
1089 (:element-type type-specifier)
1090 (:if-exists (member :error :new-version :rename
1091 :rename-and-delete :overwrite
1092 :append :supersede nil))
1093 (:if-does-not-exist (member :error :create nil))
1094 (:external-format (or symbol list))
1095 (:class (or symbol class))
1096 (:mapped boolean)
1097 (:input-handle (or null fixnum stream))
1098 (:output-handle (or null fixnum stream))
1099 (:decoding-error (or null symbol function))
1100 (:encoding-error (or null symbol function))
1101 &allow-other-keys)
1102 (or stream null)
1103 ()
1104 :derive-type #'result-type-open-class)
1105
1106 (defknown rename-file (pathnamelike filename) (values pathname pathname pathname))
1107 (defknown delete-file (pathnamelike) t)
1108 (defknown probe-file (pathnamelike) (or pathname null) (flushable))
1109 (defknown file-write-date (pathnamelike) (or unsigned-byte null) (flushable))
1110 (defknown file-author (pathnamelike) (or simple-string null) (flushable))
1111
1112 (defknown file-position (stream &optional
1113 (or unsigned-byte (member :start :end)))
1114 (or unsigned-byte (member t nil)))
1115 (defknown file-length (stream) (or unsigned-byte null) (flushable))
1116
1117 (defknown load
1118 ((or filename stream)
1119 &key (:verbose t) (:print t) (:if-does-not-exist (member :error :create nil))
1120 (:if-source-newer (member :load-source :load-object :query :compile))
1121 (:contents (or null (member :source :binary)))
1122 (:external-format t))
1123 t)
1124
1125 (defknown directory (pathnamelike &key (:check-for-subdirs t) (:all t)
1126 (:truenamep t) (:follow-links t))
1127 list (flushable))
1128
1129
1130 ;;;; In the "Errors" chapter:
1131
1132 (defknown error (t &rest t) nil) ; Never returns...
1133 (defknown cerror ((or string function) t &rest t) null)
1134 (defknown warn (t &rest t) null)
1135 (defknown break (&optional t &rest t) null)
1136
1137
1138 ;;;; In the "Miscellaneous" Chapter.
1139
1140 ;;; ### Compiler interface non-standard...
1141 (defknown compile ((or symbol cons) &optional (or list function null))
1142 (values (or function symbol cons) boolean boolean))
1143
1144 (deftype optional-filename () '(or filename (member t nil)))
1145
1146 (defknown compile-file
1147 ((or optional-filename stream list) &key (:output-file (or optional-filename stream))
1148 (:error-file optional-filename)
1149 (:trace-file optional-filename) (:error-output t) (:load t) (:verbose t)
1150 (:print t) (:progress t)
1151 (:block-compile (member t nil :specified))
1152 (:entry-points list)
1153 (:byte-compile (member t nil :maybe))
1154 (:external-format symbol)
1155 (:decoding-error (or null symbol function))
1156 (:xref t))
1157 (values (or pathname null) boolean boolean))
1158
1159 (defknown disassemble ((or callable cons)
1160 &key (:stream stream) (:backend backend)
1161 (:use-labels t))
1162 (values))
1163
1164 (defknown documentation (t symbol)
1165 (or string null)
1166 (flushable))
1167
1168 (defknown describe (t &optional (or stream (member t nil))) (values))
1169 (defknown inspect (t) t)
1170
1171 (defknown room (&optional (member t nil :default)) (values))
1172 (defknown ed (&optional (or symbol cons filename) &key (:init t) (:display t))
1173 t)
1174 (defknown dribble (&optional filename &key (:if-exists t)) (values))
1175
1176 (defknown apropos (stringable &optional packagelike) (values))
1177 (defknown apropos-list (stringable &optional packagelike) list (flushable))
1178
1179 (defknown get-decoded-time ()
1180 (values (integer 0 59) (integer 0 59) (integer 0 23) (integer 1 31)
1181 (integer 1 12) unsigned-byte (integer 0 6) boolean (rational -24 24))
1182 (flushable))
1183
1184 (defknown get-universal-time () unsigned-byte (flushable))
1185
1186 (defknown decode-universal-time
1187 (unsigned-byte &optional (or null (rational -24 24)))
1188 (values (integer 0 59) (integer 0 59) (integer 0 23) (integer 1 31)
1189 (integer 1 12) unsigned-byte (integer 0 6) boolean (rational -24 24))
1190 (flushable))
1191
1192 (defknown encode-universal-time
1193 ((integer 0 59) (integer 0 59) (integer 0 23) (integer 1 31)
1194 (integer 1 12) unsigned-byte &optional (or null (rational -24 24)))
1195 unsigned-byte
1196 (flushable))
1197
1198 (defknown (get-internal-run-time get-internal-real-time)
1199 () internal-time (flushable))
1200
1201 (defknown sleep ((or (rational 0) (float 0.0))) null)
1202
1203 (defknown (lisp-implementation-type
1204 lisp-implementation-version machine-type machine-version
1205 machine-instance software-type software-version short-site-name
1206 long-site-name)
1207 () simple-string (flushable))
1208
1209 (defknown identity (t) t (movable foldable flushable unsafe)
1210 :derive-type #'result-type-first-arg)
1211
1212 ;;; &optional is to agree with the optimization in the interpreter stub.
1213 (defknown constantly (t &optional t t &rest t) function (movable flushable))
1214 (defknown complement (function) function (movable flushable))
1215
1216
1217 ;;;; Magical compiler frobs:
1218
1219 ;;; Can't fold in general because of SATISFIES. There is a special optimizer
1220 ;;; anyway.
1221 (defknown %typep (t (or type-specifier ctype)) boolean
1222 (movable flushable explicit-check))
1223 (defknown %instance-typep (t (or type-specifier ctype)) boolean
1224 (movable flushable explicit-check))
1225
1226 (defknown %dynamic-extent (t t) void)
1227 (defknown %dynamic-extent-start () t)
1228 (defknown %dynamic-extent-end (t t) void)
1229 (defknown %cleanup-point () void)
1230 (defknown %special-bind (t t) void)
1231 (defknown %special-unbind (t) void)
1232 (defknown %listify-rest-args (t index t) list (flushable))
1233 (defknown %more-arg-context (t t) (values t index) (flushable))
1234 (defknown %more-arg (t index) t)
1235 (defknown %more-arg-values (t index index) * (flushable))
1236 (defknown %verify-argument-count (index index) (values))
1237 (defknown %argument-count-error (t) nil)
1238 (defknown %unknown-values () *)
1239 (defknown %catch (t t) void)
1240 (defknown %unwind-protect (t t) void)
1241 (defknown (%catch-breakup %unwind-protect-breakup) () void)
1242 (defknown %lexical-exit-breakup (t) void)
1243 (defknown %continue-unwind (t t t) nil)
1244 (defknown %throw (t &rest t) nil); This is MV-called.
1245 (defknown %nlx-entry (t) *)
1246 (defknown %%primitive (t t &rest t) *)
1247 (defknown %pop-values (t) void)
1248 (defknown %type-check-error (t t) nil)
1249 (defknown %odd-keyword-arguments-error () nil)
1250 (defknown %unknown-keyword-argument-error (t) nil)
1251 (defknown (%ldb %mask-field) (bit-index bit-index integer) unsigned-byte
1252 (movable foldable flushable explicit-check))
1253 (defknown (%dpb %deposit-field) (integer bit-index bit-index integer) integer
1254 (movable foldable flushable explicit-check))
1255 (defknown %negate (number) number (movable foldable flushable explicit-check))
1256 (defknown %check-bound (array index fixnum) index (movable foldable flushable))
1257 (defknown data-vector-ref (array index) t (foldable flushable explicit-check))
1258 (defknown data-vector-set (array index t) t (unsafe explicit-check))
1259 (defknown kernel:%caller-frame-and-pc () (values t t) (flushable))
1260 (defknown kernel:%with-array-data (array index (or index null))
1261 (values (simple-array * (*)) index index index)
1262 (foldable flushable))
1263 (defknown %set-symbol-package (symbol t) t (unsafe))
1264 (defknown %coerce-to-function (t) function (flushable))
1265 (defknown lisp::shrink-vector (vector fixnum) vector
1266 (unsafe)
1267 :result-not-used #'function-result-not-used-p)
1268
1269 ;;; Structure slot accessors or setters are magically "known" to be these
1270 ;;; functions, although the var remains the Slot-Accessor describing the actual
1271 ;;; function called.
1272 ;;;
1273 (defknown %slot-accessor (t) t (flushable))
1274 (defknown %slot-setter (t t) t (unsafe))
1275
1276
1277 ;;;; Setf inverses:
1278
1279 (defknown %aset (array &rest t) t (unsafe)
1280 :destroyed-constant-args (nth-constant-args 1))
1281 (defknown %set-row-major-aref (array index t) t (unsafe)
1282 :destroyed-constant-args (nth-constant-args 1))
1283 (defknown %rplaca (cons t) t (unsafe)
1284 :destroyed-constant-args (nth-constant-args 1))
1285 (defknown %rplacd (cons t) t (unsafe))
1286 (defknown %put (symbol t t) t (unsafe))
1287 (defknown %setelt (sequence index t) t (unsafe)
1288 :destroyed-constant-args (nth-constant-args 1))
1289 (defknown %svset (simple-vector index t) t (unsafe)
1290 :destroyed-constant-args (nth-constant-args 1))
1291 (defknown %bitset ((array bit) &rest index) bit (unsafe)
1292 :destroyed-constant-args (nth-constant-args 1))
1293 (defknown %sbitset ((simple-array bit) &rest index) bit (unsafe)
1294 :destroyed-constant-args (nth-constant-args 1))
1295 (defknown %charset (string index character) character (unsafe)
1296 :destroyed-constant-args (nth-constant-args 1))
1297 (defknown %scharset (simple-string index character) character (unsafe)
1298 :destroyed-constant-args (nth-constant-args 1))
1299 (defknown %set-symbol-value (symbol t) t (unsafe))
1300 (defknown fset (symbol function) function (unsafe))
1301 (defknown %set-symbol-plist (symbol t) t (unsafe))
1302 (defknown (setf documentation) ((or string null) t symbol)
1303 (or string null)
1304 ())
1305 (defknown %setnth (index list t) t (unsafe)
1306 :destroyed-constant-args (nth-constant-args 2))
1307 (defknown %set-fill-pointer (vector index) index (unsafe)
1308 :destroyed-constant-args (nth-constant-args 1))
1309
1310
1311 ;;;; Internal type predicates:
1312 ;;;
1313 ;;; Simple typep uses that don't have any standard predicate are translated
1314 ;;; into non-standard unary predicates.
1315
1316 (defknown (fixnump bignump ratiop short-float-p single-float-p double-float-p
1317 long-float-p base-char-p %standard-char-p %instancep
1318 array-header-p)
1319 (t) boolean (movable foldable flushable))
1320
1321
1322 ;;;; Miscellaneous "sub-primitives":
1323
1324 (defknown %sp-string-compare
1325 (simple-string index index simple-string index index)
1326 (or index null)
1327 (foldable flushable))
1328
1329 (defknown compiler-error (string &rest t) nil ())
1330 (defknown (compiler-warning compiler-note compiler-mumble)
1331 (string &rest t) (values) ())
1332

  ViewVC Help
Powered by ViewVC 1.1.5