Running the Soot Jimple Optimizer on a class

85 views Asked by At

Is it possible to run the JOP optimizer on a SootClass? I'd like to optimize a class that I've generated manually with Jimple statements through the Java API. As far as I understand, the optimizer is only run at resolve-time, so not every time after Jimple bodies have been manipulated. Is it possible to rerun this optimalization manually, from within Java?

1

There are 1 answers

0
gandreadis On BEST ANSWER

I found the right function calls, after some searching!

PhaseOptions.v().setPhaseOption("jop", "enabled:true")
PackManager.v().getPack("jop").apply(jimpleBody)

Run this on every method body of the class you want to optimize (with jimpleBody being replaced by that method body), and it will run the JOP optimizer on the Jimple code.