[Mono-devel-list] Re: Abcremoval
Massimiliano Mantione
massi at ximian.com
Tue Feb 1 04:37:02 EST 2005
I cc the list because this could be of general interest, hope
you don't mind...
On Mon, 2005-01-31 at 16:48, Willibald Krenn wrote:
> As you are the author of the abcrem, you can surely tell me what I have
> to change in the code blow in order to make abcrem remove the check in
> the Read method... Any hints greatly appreciated and thanks for your time!
You're out of luck :-(
> public int Read() {
> return pos < xml.Length ? (int) xml [pos++] : -1;
> }
There are two issues:
- pos is not a local variable, and as such is not tracked by SSA
(the problem is that its value could change at any method call,
because also methods called on other objects could obtain a
reference to "this" and alter it).
It is true that there are no method calls here, but tracking it
is a job for alias analysis (which is exactly what I'm doing).
But in any case in the beginning I'll just focus on local
variables.
And honestly, when we'll have the linear IR representation, and
redundancy elimination will work properly on address related
operations as well (which now it cannot do because of the risk
of aliasing), it is possible that this will "just work" :-)
The reason I think so is that field addresses (the results of
ldfld operations) will be local variables after all.
- Second issue: ABCREM works on arrays, not strings!
If you look at the generated IR, you'll see strlen and getchar
opcodes... in principle, you could modify 'abcrem.c' to handle
them (instead of only ldlen and ldelema).
This is much easier than the above, but since I made abcrem
sort of "type safe" (see bug 71062) it is a bit harder seeing
how to do it in a clean way (I plan to handle all sort of
redundant checks in that file, so it is important that the
symbolic analyzer stays clean).
Moreover, currently there is a flag in MonoCompile that tracks
the presence of ldelema operations, and abcrem is not even
invoked on methods that lack them...
Anyway this is easy, and I could do it quickly, I'm just giving
priority to a nasty SSAPRE bug.
If you really want to work on it, read the doc file I wrote (it
is in 'docs/abc-removal.txt'), and the paper I reference there.
Then, ask for specific doubts ;-)
Ciao,
Massi
More information about the Mono-devel-list
mailing list