1.0.1.7:
authorJuho Snellman <jsnell@iki.fi>
Tue, 2 Jan 2007 21:11:56 +0000 (21:11 +0000)
committerJuho Snellman <jsnell@iki.fi>
Tue, 2 Jan 2007 21:11:56 +0000 (21:11 +0000)
        Display closed over variables in the debugger for code compiled with
        high debug settings.

        * Use :ENVIRONMENT TNs for all closure variables.
        * Allow the debug-info dumper to store debug information for
          variables that were not defined in the function whose debug
          information is being dumped.

NEWS
src/compiler/debug-dump.lisp
src/compiler/life.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 0c8219f..c66e659 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ changes in sbcl-1.0.2 relative to sbcl-1.0.1:
     to use.
   * improvement: support for GBK external format.
     (thanks to Chun Tian (binghe))
+  * improvement: the debugger now displays variables that have been closed
+    over, in code compiled with (DEBUG 2) or higher
   * bug fix: an error is signaled for attempts to use READ-SEQUENCE
     for a (SIGNED-BYTE 8) stream and (UNSIGNED-BYTE 8) vector, or vice versa.
     (thanks to Tony Martinez)
index a286675..6c3d347 100644 (file)
 ;;; environment live and is an argument. If a :DEBUG-ENVIRONMENT TN,
 ;;; then we also exclude set variables, since the variable is not
 ;;; guaranteed to be live everywhere in that case.
-(defun dump-1-var (fun var tn id minimal buffer)
-  (declare (type lambda-var var) (type (or tn null) tn) (type index id)
-           (type clambda fun))
+(defun dump-1-var (var tn id minimal buffer)
+  (declare (type lambda-var var) (type (or tn null) tn) (type index id))
   (let* ((name (leaf-debug-name var))
          (save-tn (and tn (tn-save-tn tn)))
          (kind (and tn (tn-kind tn)))
                    (and (eq kind :debug-environment)
                         (null (basic-var-sets var))))
                (not (gethash tn (ir2-component-spilled-tns
-                                 (component-info *component-being-compiled*))))
-               (eq (lambda-var-home var) fun))
+                                 (component-info *component-being-compiled*)))))
       (setq flags (logior flags compiled-debug-var-environment-live)))
     (when save-tn
       (setq flags (logior flags compiled-debug-var-save-loc-p)))
                  (incf id))
                 (t
                  (setq id 0  prev-name name)))
-          (dump-1-var fun var (cdr x) id nil buffer)
+          (dump-1-var var (cdr x) id nil buffer)
           (setf (gethash var var-locs) i))
         (incf i))
       (coerce buffer 'simple-vector))))
   (declare (type clambda fun))
   (let ((buffer (make-array 0 :fill-pointer 0 :adjustable t)))
     (dolist (var (lambda-vars fun))
-      (dump-1-var fun var (leaf-info var) 0 t buffer))
+      (dump-1-var var (leaf-info var) 0 t buffer))
     (coerce buffer 'simple-vector)))
 
 ;;; Return VAR's relative position in the function's variables (determined
index 8d81428..5e9d9a3 100644 (file)
       (setf (tn-global-conflicts tn) nil)))
 
   (values))
+
+;;; On high debug levels, for all variables that a lambda closes over
+;;; convert the TNs to :ENVIRONMENT TNs (in the physical environment
+;;; of that lambda). This way the debugger can display the variables.
+(defun maybe-environmentalize-closure-tns (component)
+  (dolist (lambda (component-lambdas component))
+    (when (policy lambda (>= debug 2))
+      (let ((physenv (lambda-physenv lambda)))
+        (dolist (closure-var (physenv-closure physenv))
+          (let ((tn (find-in-physenv closure-var physenv)))
+            (when (member (tn-kind tn) '(:normal :debug-environment))
+              (convert-to-environment-tn tn physenv))))))))
+
 \f
 (defun lifetime-analyze (component)
   (lifetime-pre-pass component)
+  (maybe-environmentalize-closure-tns component)
   (setup-environment-live-conflicts component)
   (lifetime-flow-analysis component)
   (lifetime-post-pass component)
index 49adfa8..41968f7 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".)
-"1.0.1.6"
+"1.0.1.7"