From: Alexey D. <ade...@co...> - 2004-03-26 09:55:07
|
Dave Roberts <ld...@dr...> writes: > (defun decode-mx-rdata (buffer size index) > (let ((length (get16 buffer size index)) > (preference (get16 buffer size (+ 2 index)))) > (multiple-value-bind (exchange end-idx) (decode-name buffer size > (+ 4 index)) > (assert nil) ;(= (+ index length 2) end-idx)) > (values (list preference exchange) end-idx)))) > > Basically, when this broke, I was trying to find out the value of index > and length. Index is a function argument, and I could find that with > either the LIST-LOCALS command or SB-DEBUG:ARG. I could not figure out > how to determine the value of LENGTH, however. Obstacles to dumping debug information: 1. If a variable is not referenced (e.g. LENGTH above), or all references are optimized away, it is discarded. 2. If <var1> is never set and its definition is (LET ((var1 var2)) ...), it is substituted with <var2>. 3. If a variable is never set and is referenced exactly once, the reference is substituted with the variable initial value. I am not sure about case 1: unused variable seems to be only useful for debugging, and in this case it can be replaced with a special. Regarding cases 2 and 3, I think these optimizations should be disabled according to the general policy (debug>=2 for interned and =3 for uninterned symbols), except for IR1-TRANSFORMed lambdas. Case 2 has an interesting consequence: variables, introduced with MULTIPLE-VALUE-BIND, are not recorded with DEBUG=3: with this policy, a variable is considered live everywhere in its scope, but M-V-BIND is translated to M-V-CALL of (lambda (&optional v1 v2 ...) ...), its body is in the scope of variables from the varargs entry, but actually uses variables from the last &optional entry, which are considered to be dead :-). We can try to prolong their scope, but it looks easier to just disable let-substitution. BTW, what about compiling open-coded lambdas with (DEBUG 0)? We already had to disable CATCH insertion, and now there are two new optimizations to be enabled. -- Regards, Alexey Dejneka "Alas, the spheres of truth are less transparent than those of illusion." -- L.E.J. Brouwer |