Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#109 closed defect (fixed)

x86-64 inspector fails to print closed-over value correctly

Reported by: rme Owned by: rme
Priority: minor Milestone:
Component: Compiler Version: 1.1
Keywords: Cc:


CL-USER> (defun make-adder (n)
	   #'(lambda (x)
	       (+ x n)))
CL-USER> (setf junk (make-adder 100))
CL-USER> (inspect *)
[0]     #<COMPILED-LEXICAL-CLOSURE #x3000411258BF>
[1]     Name: NIL
[2]     Arglist (analysis): (X)
[3]     Inner lfun: #<Anonymous Function #x30004112C3AF>
        Closed over values
[5]     N: #<error printing SINGLE-FLOAT #xF2000000000051>

The value for N is obviously printed incorrectly.

Change History (3)

comment:1 Changed 14 years ago by rme

inspector::line-n (INSPECTOR::CLOSURE-INSPECTOR T) should probably be using ccl::closure-closed-over-values.

Maybe something like:

--- describe.lisp	(revision 7287)
+++ describe.lisp	(working copy)
@@ -1174,8 +1174,9 @@
        (if (disasm-p f) 1 0))))      ; "Disassembly"
 (defmethod line-n ((f closure-inspector) n)
-  (let ((o (inspector-object f))
-        (nclosed (closure-n-closed f)))
+  (let* ((o (inspector-object f))
+	 (nclosed (closure-n-closed f))
+	 (closed-over-values (ccl::closure-closed-over-values o)))
     (if (<= (decf n 2) 0)
       (cond ((eql (decf n) 0)
@@ -1183,15 +1184,10 @@
             ((eql (decf n) 0)
              (values nclosed "Closed over values" :comment #'prin1-comment))
             ((< (decf n) nclosed)
-             (let* ((value (ccl::%svref o (1+ (- nclosed n))))
-                    (map (car (ccl::function-symbol-map (ccl::closure-function o))))
-                    (label (or (and map (svref map (+ n (- (length map) nclosed))))
-                               n))
-                    (cellp (ccl::closed-over-value-p value)))
-               (when cellp
-                 (setq value (ccl::closed-over-value value)
-                       label (format nil "(~a)" label)))
-               (values value label (if cellp :normal :static) #'prin1-colon-line)))
+	     (let* ((item (nth n closed-over-values))
+		    (var (car item))
+		    (val (cadr item)))
+	       (values val var :normal #'prin1-colon-line)))
             ((eql (decf n nclosed) 0)
              (values 0 "Disassembly" :comment #'prin1-comment))
             (t (disassembly-line-n f (- n 1)))))))

(Though I don't appreciate the :normal/:static return values distinction at the moment.)

(setf line-n) would need to be fixed, too.

comment:2 Changed 14 years ago by rme

  • Owner changed from gb to rme

comment:3 Changed 14 years ago by rme

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r7342.

Note: See TracTickets for help on using tickets.