[Mono-devel-list] SSA and try/catch/finally regions

Kelly Leahy kellyleahy at swbell.net
Wed Apr 6 09:53:42 EDT 2005


--- Massimiliano Mantione <massi at ximian.com> wrote:
> 
> IMHO, trying to model correctly each edge from each
> point in
> the try region that could throw an exception is
> overkill.
> It is true that the resulting SSA representation
> would be
> "perfect", but in practice all those "large" phi
> nodes would
> not give us any useful information, because we
> cannot really
> know which of those edges will be taken.

You may be correct on this.  I'm not sure, myself, but
we (Ron and I) have always done it with these edges
and never really had any problems.  In reality, the
number of edges is still small compared to the number
of instructions (in general), as there are only a
handful of instructions that can throw an exception. 
Among these are call instructions, hard cast
instructions, integer division, possibly floating
division (don't know about .NET on this one), throw
and rethrow instructions, and I'm sure there's a few I
missed here.  However, in most code blocks, this is
probably not going to be a large percentage of the
code, I think.

Anyway, I think the method you describe works, but I
would recommend implementing both methods (since the
"every possible path" method is quite easy to
implement) so that you can do some testing to see
which actually does perform better, and also so that
you can fall back on the theoretically correct method
in case your heuristic does not in fact work properly.

Kelly



More information about the Mono-devel-list mailing list