10.\7f\7fCVS: ----------------------------------------------------------------------
[sbcl.git] / src / compiler / fndb.lisp
index 4d0debb..5d2af7c 100644 (file)
@@ -16,9 +16,9 @@
 ;;;; information for known functions:
 
 (defknown coerce (t type-specifier) t
-  ;; Note:
-  ;; This is not FLUSHABLE because it's defined to signal errors.
-  (movable)
+    ;; Note:
+    ;; This is not FLUSHABLE because it's defined to signal errors.
+    (movable)
   ;; :DERIVE-TYPE RESULT-TYPE-SPEC-NTH-ARG 2 ? Nope... (COERCE 1 'COMPLEX)
   ;; returns REAL/INTEGER, not COMPLEX.
   )
@@ -29,8 +29,8 @@
 
 ;;; These can be affected by type definitions, so they're not FOLDABLE.
 (defknown (sb!xc:upgraded-complex-part-type sb!xc:upgraded-array-element-type)
-          (type-specifier &optional lexenv-designator) type-specifier
-  (unsafely-flushable))
+    (type-specifier &optional lexenv-designator) type-specifier
+    (unsafely-flushable))
 \f
 ;;;; from the "Predicates" chapter:
 
 (defknown unexport (symbols-designator &optional package-designator) (eql t))
 (defknown shadowing-import (symbols-designator &optional package-designator)
   (eql t))
-(defknown shadow ((or symbol string list) &optional package-designator)
+(defknown shadow ((or symbol character string list) &optional package-designator)
   (eql t))
 (defknown (use-package unuse-package)
   ((or list package-designator) &optional package-designator) (eql t))
 (defknown * (&rest number) number
   (movable foldable flushable explicit-check))
 (defknown / (number &rest number) number
-  (movable foldable flushable explicit-check))
+  (movable foldable unsafely-flushable explicit-check))
 (defknown (1+ 1-) (number) number
   (movable foldable flushable explicit-check))
 
   (foldable unsafely-flushable call))
 
 ;;; unsafe for :INITIAL-VALUE...
-(defknown reduce (callable
-                  sequence
-                  &key
-                  (:from-end t)
-                  (:start index)
-                  (:end sequence-end)
-                  (:initial-value t)
-                  (:key callable))
+(defknown reduce (callable sequence &rest t &key (:from-end t) (:start index)
+                  (:end sequence-end) (:initial-value t) (:key callable))
   t
   (foldable flushable call unsafe))
 
-(defknown fill (sequence t &key (:start index) (:end sequence-end)) sequence
+(defknown fill (sequence t &rest t &key
+                         (:start index) (:end sequence-end)) sequence
   (unsafe)
   :derive-type #'result-type-first-arg
   :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
 
-(defknown replace (sequence
-                   sequence
-                   &key
-                   (:start1 index)
-                   (:end1 sequence-end)
-                   (:start2 index)
-                   (:end2 sequence-end))
+(defknown replace (sequence sequence &rest t &key (:start1 index)
+                   (:end1 sequence-end) (:start2 index) (:end2 sequence-end))
   sequence ()
   :derive-type #'result-type-first-arg
   :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
 
 (defknown remove
-  (t sequence &key (:from-end t) (:test callable)
+  (t sequence &rest t &key (:from-end t) (:test callable)
      (:test-not callable) (:start index) (:end sequence-end)
      (:count sequence-count) (:key callable))
   consed-sequence
   :derive-type (sequence-result-nth-arg 2))
 
 (defknown substitute
-  (t t sequence &key (:from-end t) (:test callable)
+  (t t sequence &rest t &key (:from-end t) (:test callable)
      (:test-not callable) (:start index) (:end sequence-end)
      (:count sequence-count) (:key callable))
   consed-sequence
   :derive-type (sequence-result-nth-arg 3))
 
 (defknown (remove-if remove-if-not)
-  (callable sequence &key (:from-end t) (:start index) (:end sequence-end)
-            (:count sequence-count) (:key callable))
+  (callable sequence &rest t &key (:from-end t) (:start index)
+            (:end sequence-end) (:count sequence-count) (:key callable))
   consed-sequence
   (flushable call)
   :derive-type (sequence-result-nth-arg 2))
 
 (defknown (substitute-if substitute-if-not)
-  (t callable sequence &key (:from-end t) (:start index) (:end sequence-end)
-     (:count sequence-count) (:key callable))
+  (t callable sequence &rest t &key (:from-end t) (:start index)
+     (:end sequence-end) (:count sequence-count) (:key callable))
   consed-sequence
   (flushable call)
   :derive-type (sequence-result-nth-arg 3))
 
 (defknown delete
-  (t sequence &key (:from-end t) (:test callable)
+  (t sequence &rest t &key (:from-end t) (:test callable)
      (:test-not callable) (:start index) (:end sequence-end)
      (:count sequence-count) (:key callable))
   sequence
   :destroyed-constant-args (nth-constant-nonempty-sequence-args 2))
 
 (defknown nsubstitute
-  (t t sequence &key (:from-end t) (:test callable)
+  (t t sequence &rest t &key (:from-end t) (:test callable)
      (:test-not callable) (:start index) (:end sequence-end)
      (:count sequence-count) (:key callable))
   sequence
   :destroyed-constant-args (nth-constant-nonempty-sequence-args 3))
 
 (defknown (delete-if delete-if-not)
-  (callable sequence &key (:from-end t) (:start index) (:end sequence-end)
-            (:count sequence-count) (:key callable))
+  (callable sequence &rest t &key (:from-end t) (:start index)
+            (:end sequence-end) (:count sequence-count) (:key callable))
   sequence
   (flushable call important-result)
   :derive-type (sequence-result-nth-arg 2)
   :destroyed-constant-args (nth-constant-nonempty-sequence-args 2))
 
 (defknown (nsubstitute-if nsubstitute-if-not)
-  (t callable sequence &key (:from-end t) (:start index) (:end sequence-end)
-     (:count sequence-count) (:key callable))
+  (t callable sequence &rest t &key (:from-end t) (:start index)
+     (:end sequence-end) (:count sequence-count) (:key callable))
   sequence
   (flushable call)
   :derive-type (sequence-result-nth-arg 3)
   :destroyed-constant-args (nth-constant-nonempty-sequence-args 3))
 
 (defknown remove-duplicates
-  (sequence &key (:test callable) (:test-not callable) (:start index)
+  (sequence &rest t &key (:test callable) (:test-not callable) (:start index)
             (:from-end t) (:end sequence-end) (:key callable))
   consed-sequence
   (unsafely-flushable call)
   :derive-type (sequence-result-nth-arg 1))
 
 (defknown delete-duplicates
-  (sequence &key (:test callable) (:test-not callable) (:start index)
+  (sequence &rest t &key (:test callable) (:test-not callable) (:start index)
             (:from-end t) (:end sequence-end) (:key callable))
   sequence
   (unsafely-flushable call important-result)
   :derive-type (sequence-result-nth-arg 1)
   :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
 
-(defknown find (t sequence &key (:test callable) (:test-not callable)
-                  (:start index) (:from-end t) (:end sequence-end)
-                  (:key callable))
+(defknown find (t sequence &rest t &key (:test callable)
+                (:test-not callable) (:start index) (:from-end t)
+                (:end sequence-end) (:key callable))
   t
   (foldable flushable call))
 
 (defknown (find-if find-if-not)
-  (callable sequence &key (:from-end t) (:start index) (:end sequence-end)
-            (:key callable))
+  (callable sequence &rest t &key (:from-end t) (:start index)
+   (:end sequence-end) (:key callable))
   t
   (foldable flushable call))
 
-(defknown position (t sequence &key (:test callable) (:test-not callable)
-                      (:start index) (:from-end t) (:end sequence-end)
-                      (:key callable))
+(defknown position (t sequence &rest t &key (:test callable)
+                    (:test-not callable) (:start index) (:from-end t)
+                    (:end sequence-end) (:key callable))
   (or index null)
   (foldable flushable call))
 
 (defknown (position-if position-if-not)
-  (callable sequence &key (:from-end t) (:start index) (:end sequence-end)
-            (:key callable))
+  (callable sequence &rest t &key (:from-end t) (:start index)
+   (:end sequence-end) (:key callable))
   (or index null)
   (foldable flushable call))
 
-(defknown count (t sequence &key (:test callable) (:test-not callable)
-                      (:start index) (:from-end t) (:end sequence-end)
-                      (:key callable))
+(defknown count (t sequence &rest t &key
+                   (:test callable) (:test-not callable) (:start index)
+                   (:from-end t) (:end sequence-end) (:key callable))
   index
   (foldable flushable call))
 
 (defknown (count-if count-if-not)
-  (callable sequence &key (:from-end t) (:start index) (:end sequence-end)
-            (:key callable))
+  (callable sequence &rest t &key
+            (:from-end t) (:start index) (:end sequence-end) (:key callable))
   index
   (foldable flushable call))
 
 (defknown (mismatch search)
-  (sequence sequence &key (:from-end t) (:test callable) (:test-not callable)
-            (:start1 index) (:end1 sequence-end)
-            (:start2 index) (:end2 sequence-end)
-            (:key callable))
+  (sequence sequence &rest t &key (:from-end t) (:test callable)
+   (:test-not callable) (:start1 index) (:end1 sequence-end)
+   (:start2 index) (:end2 sequence-end) (:key callable))
   (or index null)
   (foldable flushable call))
 
 ;;; not FLUSHABLE, since vector sort guaranteed in-place...
-(defknown (stable-sort sort) (sequence callable &key (:key callable)) sequence
+(defknown (stable-sort sort) (sequence callable &rest t &key (:key callable))
+  sequence
   (call)
   :derive-type (sequence-result-nth-arg 1)
   :destroyed-constant-args (nth-constant-nonempty-sequence-args 1))
   (&key (:test callable) (:size unsigned-byte)
         (:rehash-size (or (integer 1) (float (1.0))))
         (:rehash-threshold (real 0 1))
-        (:weak-p t))
+        (:weakness (member nil :key :value :key-and-value :key-or-value)))
   hash-table
   (flushable unsafe))
 (defknown hash-table-p (t) boolean (movable foldable flushable))
 (defknown hash-table-test (hash-table) symbol (foldable flushable))
 (defknown sxhash (t) (integer 0 #.sb!xc:most-positive-fixnum)
   (#-sb-xc-host foldable flushable))
+(defknown psxhash (t &optional t) (integer 0 #.sb!xc:most-positive-fixnum)
+  (#-sb-xc-host foldable flushable))
 \f
 ;;;; from the "Arrays" chapter
 
 (defknown load-logical-pathname-translations (string) t ())
 (defknown logical-pathname-translations (logical-host-designator) list ())
 
-(defknown pathname (pathname-designator) pathname (unsafely-flushable))
+(defknown pathname (pathname-designator) pathname ())
 (defknown truename (pathname-designator) pathname ())
 
 (defknown parse-namestring
 (defknown merge-pathnames
   (pathname-designator &optional pathname-designator pathname-version)
   pathname
-  (unsafely-flushable))
+  ())
 
 (defknown make-pathname
  (&key (:defaults pathname-designator)
 (defknown %listify-rest-args (t index) list (flushable))
 (defknown %more-arg-context (t t) (values t index) (flushable))
 (defknown %more-arg (t index) t)
+#!+stack-grows-downward-not-upward
+(defknown %more-kw-arg (t index) (values t t))
 (defknown %more-arg-values (t index index) * (flushable))
 (defknown %verify-arg-count (index index) (values))
 (defknown %arg-count-error (t) nil)
 (defknown %check-bound (array index fixnum) index (movable foldable flushable))
 (defknown data-vector-ref (simple-array index) t
   (foldable explicit-check always-translatable))
+#!+(or x86 x86-64)
+(defknown data-vector-ref-with-offset (simple-array index fixnum) t
+  (foldable explicit-check always-translatable))
 (defknown data-vector-set (array index t) t
   (unsafe explicit-check always-translatable))
+#!+(or x86 x86-64)
+(defknown data-vector-set-with-offset (array index fixnum t) t
+  (unsafe explicit-check always-translatable))
 (defknown hairy-data-vector-ref (array index) t
   (foldable explicit-check))
 (defknown hairy-data-vector-set (array index t) t (unsafe explicit-check))
+(defknown hairy-data-vector-ref/check-bounds (array index) t
+  (foldable explicit-check))
+(defknown hairy-data-vector-set/check-bounds (array index t)
+  t
+  (unsafe explicit-check))
 (defknown %caller-frame-and-pc () (values t t) (flushable))
 (defknown %with-array-data (array index (or index null))
   (values (simple-array * (*)) index index index)
 (defknown policy-quality (policy symbol) policy-quality
           (flushable))
 
-(defknown (compiler-abort compiler-error) (string &rest t) nil ())
+(defknown compiler-error (t &rest t) nil ())
 (defknown (compiler-warn compiler-style-warn) (string &rest t) (values) ())
 (defknown (compiler-notify maybe-compiler-notify) ((or string symbol) &rest t)
   (values)
   ())
 (defknown style-warn (string &rest t) null ())
+
+;;;; atomic ops
+#!+(or x86 x86-64)
+(progn
+  (defknown %simple-vector-compare-and-swap (simple-vector index t t) t
+      (unsafe))
+  (defknown %instance-compare-and-swap (instance index t t) t
+      (unsafe)))