[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: method call doesn't end basic block



>>>>> "olhotak" == Ondrej Lhotak <olhotak@sable.mcgill.ca> writes:

    olhotak> On Mon, Jul 26, 2004 at 09:41:48PM +0200, Robert Mittermayr wrote:
    >> 
    >> I created a complete BlockGraph in SOOT and everything
    >> works and looked fine. But now i found out that a method
    >> call to a method of my application classes doesn't end a
    >> basic block. Is there a way to tell SOOT on which method
    >> calls it should begin a new Block?

    olhotak> You could subclass BlockGraph (or
    olhotak> CompleteBlockGraph) and override computeLeaders() to
    olhotak> include the block leaders that you want.

Just to anticipate a possible source of confusion:
BlockGraph.computeLeaders() is not in any released version of
Soot. It is part of the post-2.1.0 reimplementation of the CFG
classes.  To use computeLeaders(), you need to use the
development version of Soot, either by checking it out of the
subversion repository at http://svn.sable.mcgill.ca, or by
downloading a copy from Ondrej's unofficial nightly builds at
http://www.sable.mcgill.ca/~olhota/build/.

In the released versions, I don't see any way to change the
criteria for starting new blocks other than changing the code in
soot.toolkits.graph.BlockGraph (that's one of the motivations for
my reorganization of the code).

If you do opt for the new CFG implementation, I'd suggest
subclassing ExceptionalBlockGraph rather than
CompleteBlockGraph. CompleteBlockGraph is just a wrapper around
ExceptionalBlockGraph, which exists for backwards compatibility;
if you're going to be using the new stuff, you might as well do
so knowingly.

If you need to add new block leaders without removing any of
the existing ones, your computeLeaders() could just
augment the the result of calling the super.computeLeaders()
inherited from ExceptionalBlockGraph, the way that
ZonedBlockGraph.graphLeaders() adds the units at Trap boundaries
to the leaders it gets the computerLeaders() it inherits from
BlockGraph.