[Soot-list] How to optimize final static methods?

Robert Baruch robert.c.baruch at gmail.com
Mon Feb 20 12:49:39 EST 2012


Hi all,

I'm sure this has been asked before, but I can't seem to find anything about it. I'm using Soot 2.5.0 and Java 6 on OSX.

I have a simple test program:

public class TestOpt 
{
	private static final long ubtol(byte b) { return ((long)b)&0xFF; }

	public static void main(String[] args)
	{
		byte b = Byte.parseByte(args[0]);
		long l = ubtol(b);
		System.out.println("Long is " + Long.toHexString(l));
	}
	
}

I'd like to optimize the ubtol() call by inlining it. My invocation of Soot is as follows:

java -jar soot-2.5.0.jar -cp . -pp -O -v TestOp

That certainly doesn't do it, since looking at the decompiled code shows an invokestatic to ubtol().

However, invoking using the -W or -app or -w options seems to load lots and lots of the Java runtime classes, processing them. This takes a long, long time, and after fifteen minutes I just aborted the program.

So is there any way to run Soot to optimize static finals into inline calls without having to wait and wait and wait?

Thanks,

--Rob

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


More information about the Soot-list mailing list