[Soot-list] jimple, detecting loops in methods

Raghav Karol raghav.karol at gmail.com
Sat Jun 24 15:20:46 EDT 2006


Hello *,

I am using the jimple IR to try and determine which units occur inside
loops and hence may execute more than once during a method invocation.

I figured I could use the unit.getBoxesPointingToThis() method, to get
StmtBoxes that point to the calling unit. But this is not what the
method does; see details below.

Could someone suggest a hint to do this.

Thanks in advance,
Raghav

Details
=====

Original Method:
-----------------------
public void run() {
	for(int i = 0; i < 1000; i ++) {
		methodOne();
	}
}

unit.getPointingToThis() Info
-----------------------------------------
// Method body dump
<experiment.test.ThreadFinderTest: void run()>
{
 this := @this: experiment.test.ThreadFinderTest
 j = 100
 i = 0
 goto [?= (branch)]
 virtualinvoke this.<experiment.test.ThreadFinderTest: void methodOne()>()
 i = i + 1
 if i < 1000 goto virtualinvoke
this.<experiment.test.ThreadFinderTest: void methodOne()>()
 return
}

// Units with getBoxesPointingToThis().size() > 0
Unit: virtualinvoke this.<experiment.test.ThreadFinderTest: void methodOne()>()
 GetPointingToThis().getUnit(): virtualinvoke
this.<experiment.test.ThreadFinderTest: void methodOne()>()
Unit: if i < 1000 goto virtualinvoke
this.<experiment.test.ThreadFinderTest: void methodOne()>()
 GetPointingToThis().getUnit(): if i < 1000 goto virtualinvoke
this.<experiment.test.ThreadFinderTest: void methodOne()>()


More information about the Soot-list mailing list