简体   繁体   中英

Running the Soot Jimple Optimizer on a class

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM