org.dellroad.jc.cgen
Class DefaultMethodOptimizer

java.lang.Object
  extended byorg.dellroad.jc.cgen.DefaultMethodOptimizer
All Implemented Interfaces:
MethodOptimizer

public class DefaultMethodOptimizer
extends Object
implements MethodOptimizer

Method optimizer that does a few things beyond the normal Soot stuff:

These are local optimizations only (not using a global call graph).


Field Summary
static boolean INLINE_VERBOSE
           
static int MAX_CALLEE_SIZE
           
static int MAX_CALLER_SIZE
           
static double MAX_EXPANSION
           
static int MAX_STACK_ALLOC
           
static int MIN_CALLEE_SIZE
           
static int MIN_CALLER_SIZE
           
 
Constructor Summary
DefaultMethodOptimizer()
           
 
Method Summary
 CompleteUnitGraph optimize(SootMethod method, Set deps)
          Optimize the given method's body.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_EXPANSION

public static final double MAX_EXPANSION

MAX_CALLER_SIZE

public static final int MAX_CALLER_SIZE

MAX_CALLEE_SIZE

public static final int MAX_CALLEE_SIZE

MIN_CALLER_SIZE

public static final int MIN_CALLER_SIZE

MIN_CALLEE_SIZE

public static final int MIN_CALLEE_SIZE

MAX_STACK_ALLOC

public static final int MAX_STACK_ALLOC

INLINE_VERBOSE

public static final boolean INLINE_VERBOSE
Constructor Detail

DefaultMethodOptimizer

public DefaultMethodOptimizer()
Method Detail

optimize

public CompleteUnitGraph optimize(SootMethod method,
                                  Set deps)
Description copied from interface: MethodOptimizer
Optimize the given method's body.

Depedencies should be added to deps when the class may not be explicitly referenced in the new body. For example, if a call to Arrays.sort() were inlined, then Arrays would need to be added as an explicit dependency, because the inlined code might not explicitly refer to the Arrays class.

Specified by:
optimize in interface MethodOptimizer
Parameters:
method - method to optimize
deps - set to which to add any class file dependencies which may not be reflected in the byte code. To add a dependency, add the class' SootClass object.
Returns:
control flow graph of optimized method body