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)
;;; 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
(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)