0.9.3.29:
authorPaul F. Dietz <pfdietz@users.sourceforge.net>
Fri, 5 Aug 2005 03:28:30 +0000 (03:28 +0000)
committerPaul F. Dietz <pfdietz@users.sourceforge.net>
Fri, 5 Aug 2005 03:28:30 +0000 (03:28 +0000)
  Add source transforms to eliminate hairy arg processing in GETHASH.

src/code/target-hash-table.lisp
src/compiler/fndb.lisp
src/compiler/srctran.lisp
version.lisp-expr

index 5adefc9..e4d0a32 100644 (file)
    such entry. Entries can be added using SETF."
   (declare (type hash-table hash-table)
            (values t (member t nil)))
+  (gethash3 key hash-table default))
+
+(defun gethash2 (key hash-table)
+  #!+sb-doc
+  "Two argument version of GETHASH"
+  (declare (type hash-table hash-table)
+           (values t (member t nil)))
+  (gethash3 key hash-table nil))
+
+(defun gethash3 (key hash-table default)
+  #!+sb-doc
+  "Three argument version of GETHASH"
+  (declare (type hash-table hash-table)
+           (values t (member t nil)))
   (without-gcing
    (cond ((= (get-header-data (hash-table-table hash-table))
              sb!vm:vector-must-rehash-subtype)
index 49f9cfe..fdc846c 100644 (file)
 (defknown hash-table-p (t) boolean (movable foldable flushable))
 (defknown gethash (t hash-table &optional t) (values t boolean)
   (flushable unsafe)) ; not FOLDABLE, since hash table contents can change
+(defknown sb!impl::gethash2 (t hash-table) (values t boolean)
+  (flushable unsafe)) ; not FOLDABLE, since hash table contents can change
+(defknown sb!impl::gethash3 (t hash-table t) (values t boolean)
+  (flushable unsafe)) ; not FOLDABLE, since hash table contents can change
 (defknown %puthash (t hash-table t) t (unsafe))
 (defknown remhash (t hash-table) boolean ())
 (defknown maphash (callable hash-table) null (flushable call))
index 620ab2a..7383e72 100644 (file)
 (define-source-transform nth (n l) `(car (nthcdr ,n ,l)))
 
 (define-source-transform last (x) `(sb!impl::last1 ,x))
-;; (define-source-transform last (x)
-;;  `(let* ((x (the list ,x))
-;;          (r (cdr x)))
-;;     (do () ((atom r) x)
-;;       (shiftf x r (cdr r)))))
+(define-source-transform gethash (&rest args)
+  (case (length args)
+   (2 `(sb!impl::gethash2 ,@args))
+   (3 `(sb!impl::gethash3 ,@args))
+   (t (values nil t))))
 
 (defvar *default-nthcdr-open-code-limit* 6)
 (defvar *extreme-nthcdr-open-code-limit* 20)
index febc033..db875ec 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.9.3.28"
+"0.9.3.29"