I was planning to send this note next week, but I guess I should know
better than to put something on the wiki and think it won't be noticed,
even if it is in a crusty dark corner :-)
I see on #gcc that my debuglocus document has been discovered. It
describes the work Aldy and I are experimenting with. It can be found on
http://gcc.gnu.org/wiki/AndrewMacLeod
I've been trying to find alternative implementations or approaches to
Alex's VTA work to see if its possible to avoid introducing a whole new
class of instructions into the IL. So far this has shown the most
promise. VTA works because the information is duplicated and thus
survives being deleted and moved around. Debuglocus on the other hand
doesn't introduce anything intrusive like that, instead it tags
statements using the source locus field. When statements are deleted,
these tags are attached to other statements, and thus survive being
deleted. They also get moved around with the statements they are
attached to.
The crux of whether or not debuglocus can approach the level of detail
and precision that VTA does depends primarily on what is admittedly
glossed over in 'stage 3'. This introduces the concept of ordering to
the tags. The theory is that all the debuglocus tags are given a
position in the original source code relative to each other. When we go
to emit debug info, an analysis phase will go through the program
examining these orderings and where they are now, and try to put the
debug information back where it belongs based their relative orderings
and other such bits of info that gets tucked away.
Yes, its vague and handwavy, but the idea is to move all the heavy
lifting to the debug emitter, and away from each optimization. It seems
plausible on my small scale experiments, and the only way to figure out
whether I can make it work on a large scale is to get enough
infrastructure in place to actually implement it and iterate a full
blown solution. And then see if it succeeds or fails :-)
It will also give us another comparison point for the previous
implementations. Initially, the ranges may be wrong sometimes, but it
shouldn't lose any information. In particular, inline parameters and
coalesced variables should still be present in the debug info. I think
it should do most of what Honza's patch in the pretty-ipa branch does in
this respect, but I haven't taken a close look to be sure. Once enough
is in place we can check that. Then I will continue work on this
reordering bit and see where it leads.
In any case, I have cut a branch 'debuglocus' and work is beginning on
it. Its the weekend now, but since I discovered the commentary on #gcc
from last night, I figured I might as well send this out now :-). I'll
be around on monday if anyone wants to bug me about it :-).
Andrew