[Soot-list] Question about PostDominators

Arie Zilberstein arie.zilberstein at gmail.com
Thu Jan 14 12:41:37 EST 2010


Hi,

I have the following Java method:

protected double action() {
// create a new object
Point p = new Point(2.5, 4.3);
p.x = 500.2;
p.y = 600.1;
 double z = 0;
for (int i=0; i<1000; ++i)
{
// read from the new object
z  += (p.x+p.y)*i;
}
 return z;
}

Where Point is a simple container class.
After converting to Jimple, the method looks like this:

    protected double action()
    {
        micro.MicroBench2 this;
        micro.Point $r0, p;
        double z, $d0, $d1;
        int i;

        this := @this: micro.MicroBench2;
        $r0 = new micro.Point;
        specialinvoke $r0.<micro.Point: void <init>(double,double)>(2.5,
4.3);
        p = $r0;
        p.<micro.Point: double x> = 500.2;
        p.<micro.Point: double y> = 600.1;
        z = 0.0;
        i = 0;
        goto label1;

     label0:
        $d0 = p.<micro.Point: double x>;
        $d1 = p.<micro.Point: double y>;
        $d0 = $d0 + $d1;
        $d1 = (double) i;
        $d0 = $d0 * $d1;
        z = z + $d0;
        i = i + 1;

     label1:
        if i < 1000 goto label0;

        return z;
    }


I wish to find the postdominators of the statement marked in yellow, that
is:         p.<micro.Point: double y> = 600.1;

What I expect to find is: the postdominators of this statement are all the
statements that appear to the bottom of that statement.
Is that a correct expectation or is it wrong?

I use the post dominators finder, like this:

MHGPostDominatorsFinder pd = new
MHGPostDominatorsFinder(new BriefUnitGraph(body));
List postDominators = pd.getDominators(stmt);

And this is the contents of the returned list:

[return z, p.<micro.Point: double y> = 600.1, z = 0.0, i = 0, goto [?=
(branch)], if i < 1000 goto $d0 = p.<micro.Point: double x>]

So, basically the post dominators analysis did not "expand" the goto
statement and therefore all the statements under the label0 label except the
first, are not considered post dominators.

Is that the correct behavior?

If yes -- does anyone know if there is another analysis which would give me
what I expect. Which is: "give me all statements which may be executed after
stmt in whatever control-flow".

Thanks! And sorry for the extremely detailed post.

Best,
Arie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20100114/f6b97b2b/attachment.html 


More information about the Soot-list mailing list