[Soot-list] Locals vs Stack locations when writing class files

Patrick Lam plam at sable.mcgill.ca
Wed Sep 16 15:32:56 EDT 2009


David Mohr wrote:
> Hi,
> I'm generating some code with soot using Jimple. For some computation,
> I get intermediate values and I store them in Locals. When the Jimple
> code gets translated into a class file, I end up with many true local
> variables for my intermediate values, although I think they should
> just live on the stack. Is there any way to influence what Jimple
> Local variables become stack locations and which become local
> variables in the byte code?

Hi David,

It shouldn't really matter, for a number of reasons.

* Our CC2000 paper describes how we generate bytecode from Jimple. The 
default path is through Baf, and we do load/store optimizations to get 
code which looks similar to javac-generated code. Even if you add more 
Locals, it should not make a difference, and Soot should still generate 
reasonable code.

* Most JVMs do a lot of optimization these days, so that the bytecode 
doesn't really influence what gets run on the machine. Also, there's a 
lot that goes on at the CPU level, so it's really hard to say what 
happens in the end.

By "many", do you mean a few dozen or a few thousand? A few dozen 
shouldn't really make a difference.

pat


More information about the Soot-list mailing list