1.0.29.41: inline CTOR caches for MAKE-INSTANCE
[sbcl.git] / src / pcl / print-object.lisp
index c1cde7e..b5c2500 100644 (file)
@@ -73,7 +73,9 @@
                   (and generic-function
                        (generic-function-name generic-function))
                   (method-qualifiers method)
-                  (unparse-specializers method)))
+                  (if generic-function
+                      (unparse-specializers generic-function (method-specializers method))
+                      (method-specializers method))))
         ;; FIXME: Why do we do CALL-NEXT-METHOD in this method (and
         ;; in the PRINT-OBJECT STANDARD-ACCESSOR-METHOD method too)?
         (call-next-method))))
@@ -86,7 +88,9 @@
                   (and generic-function
                        (generic-function-name generic-function))
                   (accessor-method-slot-name method)
-                  (unparse-specializers method)))
+                  (if generic-function
+                      (unparse-specializers generic-function (method-specializers method))
+                      (method-specializers method))))
         (call-next-method))))
 
 (defmethod print-object ((mc standard-method-combination) stream)
 
 (defun named-object-print-function (instance stream
                                     &optional (extra nil extra-p))
-  (print-unreadable-object (instance stream :type t)
-    (if extra-p
-        (format stream
-                "~S ~:S"
-                (slot-value-or-default instance 'name)
-                extra)
-        (format stream
-                "~S"
-                (slot-value-or-default instance 'name)))))
+  (let ((name (slot-value-or-default instance 'name)))
+    (print-unreadable-object (instance stream :type t :identity (not name))
+      (if extra-p
+          (format stream "~S ~:S" name extra)
+          (format stream "~S" name)))))
 
 (defmethod print-object ((class class) stream)
   (named-object-print-function class stream))
 
 (defmethod print-object ((cache cache) stream)
   (print-unreadable-object (cache stream :type t :identity t)
-    (format stream
-            "~W ~S ~W"
-            (cache-nkeys cache)
-            (cache-valuep cache)
-            (cache-nlines cache))))
+    (multiple-value-bind (lines-used lines-total max-depth depth-limit)
+        (cache-statistics cache)
+      (format stream
+              "~D key~P, ~:[no value~;value~], ~D/~D lines, depth ~D/~D"
+              (cache-key-count cache)
+              (cache-key-count cache)
+              (cache-value cache)
+              lines-used
+              lines-total
+              max-depth
+              depth-limit))))
 
 (defmethod print-object ((wrapper wrapper) stream)
   (print-unreadable-object (wrapper stream :type t :identity t)
 (defmethod print-object ((dfun-info dfun-info) stream)
   (declare (type stream stream))
   (print-unreadable-object (dfun-info stream :type t :identity t)))
+
+(defmethod print-object ((ctor ctor) stream)
+  (print-unreadable-object (ctor stream :type t)
+    (format stream "~S ~:S" (ctor-class-or-name ctor) (ctor-initargs ctor)))
+  ctor)