[Soot-list] SwitchStmt

Patrick Lam plam at sable.mcgill.ca
Mon Sep 19 11:24:11 EDT 2011


On 19/09/11 10:58 AM, 左小强   wrote:
> Hi,
>
> I'm a PhD student from Singapore. I am trying to use the soot for some
> research purposes.
>
> Now I have a question. What's the difference between TableSwitchStmt and
> LookupSwitchStmt? I have known that the switch statement in the source
> code will be converted to the LookupSwitchStmt in the corresponding
> Jimple code. So what about the TableSwitchStmt? How it is generated?

These are generated by the Java compiler javac depending on the 
structure of the cases. I believe that if you write a switch statement 
with contiguous values, then javac will generate a LookupSwitch bytecode 
instruction, while a range of values will generate a TableSwitch 
bytecode instruction. In either case, Soot just converts the bytecode 
into Jimple directly.

pat


More information about the Soot-list mailing list