org.dellroad.jc.cgen
Class DefaultMethodOptimizer
java.lang.Object
org.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:
- Convert virtual method invocations to nonvirtual invocations
when the target method is final.
- Inline methods suitable for inlining (i.e., short enough,
nonvirtual invocation, etc.).
These are local optimizations only (not using a global call graph).
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
DefaultMethodOptimizer
public DefaultMethodOptimizer()
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 optimizedeps
- 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