[Mono-dev] CIL to CIL optimizer

Massimiliano Mantione massi at ximian.com
Mon Aug 14 07:59:26 EDT 2006


As usual, I reply *late* to these interesting messages... sorry :-(

First things first: it's nice you'll do the CIL-CIL optimizer, but
there are plans to do this in the JIT anyway, where these things
belong.
I say "where these things belong" not to discourage you, but because
the JIT has generally more visibility on how the code will really
look like (it can inline methods, knows that the address of certain
things maybe is a already constant, and in the future will also have
visibility of the method prologue-epilogue), so things like SCCP and
PRE should be performed by the JIT anyway if we want to take full
advantage of them.
Not to mention the issues involved in tuning redundancy elimination,
which can easily get architecture dependent...
That said, obviously until the JIT "is not there" having an external
optimizer can be useful :-)

Then, about the CFG shape and issues when try[/catch]/finally clauses
are present, this discussion already reached mono-devel-list:
http://marc.theaimsgroup.com/?l=mono-devel-list&m=111336503228737&w=2
I'd really like you to comment on that thread.

Finally, about building SSA form, my favorite paper is this:
http://citeseer.ist.psu.edu/sreedhar95linear.html
I really like the dominance algorithm at the beginning of the paper
you mentioned, an implemented it once, it's so easy it just took a
few hours to have it running and fully debugged :-)
But the rest of the paper (about dominance frontiers) was a bit hard
for me, I think the one I linked is well explained.
And BTW, there's already a C implementation of it for Mono in my
old HSSA patch here:
http://marc.theaimsgroup.com/?l=mono-devel-list&m=113235041825001&w=2
Keep in mind that HSSA is a big beast, including GVN and full alias
analysis, tracing also heap bases values, so one can do PRE and SCCP
taking all those things into account, and also register promotion.
That patch implements most of the infrastructure, enough to have a
working deadce implementation.

Ciao,
  Massi





More information about the Mono-devel-list mailing list