[Soot-list] ForwardBranchedFlowAnalysis visits units in the "wrong" order?

Attila Bartha at.bartha at gmail.com
Sat Nov 28 04:55:48 EST 2009


Hi

 

I am using ForwardBranchedFlowAnalysis, and I have a problem when analyzing
for-loops of the following kind

 

1        r4 = interfaceinvoke r1.<java.util.List: java.util.Iterator
iterator()>();

 

     label0:

2        $z0 = interfaceinvoke r4.<java.util.Iterator: boolean hasNext()>();

3        if $z0 == 0 goto label1;
// for-loop condition

 

4        $r5 = interfaceinvoke r4.<java.util.Iterator: java.lang.Object
next()>();

5        virtualinvoke r3.<java.lang.StringBuffer: java.lang.StringBuffer
append(java.lang.Object)>($r5);

6        virtualinvoke r3.<java.lang.StringBuffer: java.lang.StringBuffer
append(java.lang.String)>("<br><br>");

7        goto label0;

 

     label1:

8        ... code following the loop

 

 

This Jimple is extracted from some bytecode I got. Strangely, my compiler
generates a different bytecode structure for such for-loops: It looks more
like a while-loop, with the condition at the bottom.

 

Anyway, the problem is, that ForwardBranchedFlowAnalysis visits the units in
the following order:

1, 2, 3, 8, 9.. , 4, 5, 6, 7, 2, .

 

Thus, it visits first the units FOLLOWING the loop before visiting the units
IN the loop. 

However, my analysis will only work correctly, if it visits first the loop
body and then the code after the loop.

 

Is this a bug or an intended feature? 

Is there an alternative forward analysis or a possible quick fix that visits
the units in the 'normal' order?

 

Regards

 

Attila

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20091128/9af6e765/attachment.html 


More information about the Soot-list mailing list