java.lang.Object | |
↳ | com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.AbstractMasterOptimizer<T extends com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IOptimizerTarget> |
Known Direct Subclasses |
Standard implementation of a generic master optimizer.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IMasterOptimizer
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
protected int | decryptorSupport | disabled (0) by default; client code must explicitly set to non-zero to allow the execution of decryptors. | |||||||||
protected boolean | enableDeobfuscators | false by default; client code must explicitly set to true to allow the execution of deobfuscators. | |||||||||
protected boolean | enableUnsafeOptimizers | false by default; client code must explicitly set to true to allow the execution of unsafe optimizers. | |||||||||
protected int | grp1NMaxRunCount | maximum run count for the group [1..N] (<0 means no limit) | |||||||||
protected List<IMasterOptimizerInstrumenter<T extends IOptimizerTarget>> | instrumenters | instrumenters | |||||||||
protected SortedMap<Integer, List<OptimizerEntry<T extends IOptimizerTarget>>> | optGrpMap | groups of optimizers; groups 0 and -1 are entry and exit groups, respectively | |||||||||
protected List<OptimizerEntry<T extends IOptimizerTarget>> | optList | list of all optimizers | |||||||||
protected T extends IOptimizerTarget | t | default target |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AbstractMasterOptimizer(T t, int grp1NMaxRunCount)
Create a master optimizer.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | getDecryptorSupport() | ||||||||||
OptimizerMode |
getMode()
Retrieve the current operating mode for this MO.
| ||||||||||
int | getOptimizationCount(boolean deobfuscationOnly) | ||||||||||
OptimizerEntry<T> | getOptimizer(Class<? extends IOptimizer<T>> clazz) | ||||||||||
IOptimizer<T> | getOptimizerObject(Class<? extends IOptimizer<T>> clazz) | ||||||||||
List<OptimizerEntry<T>> |
getRegisteredOptimizers(int groupId)
Get a copy of the lists of optimizer entries registered with this MO and belonging to the
provided optimizer group.
| ||||||||||
List<OptimizerEntry<T>> |
getRegisteredOptimizers()
Get a copy of the list of optimizer entries registered with this MO.
| ||||||||||
T |
getTarget()
Get the target onto which the optimizations will be performed.
| ||||||||||
int | getTotalOptimizationCount() | ||||||||||
boolean | isEnableDeobfuscators() | ||||||||||
boolean | isEnableUnsafeOptimizers() | ||||||||||
int |
perform()
Perform an optimization pass.
| ||||||||||
int |
performMultiple(List<OptimizerEntry<T>> list)
Run the list of optimizers, in sequence.
| ||||||||||
int |
performSingle(OptimizerEntry<T> e)
Perform a single optimization, using the provided optimizer (which must have been previously
registered).
| ||||||||||
void |
registerInstrumenter(IMasterOptimizerInstrumenter<T> instrumenter)
Register an instrumenter.
| ||||||||||
OptimizerEntry<T> |
registerOptimizer(int group, IOptimizer<T> opt)
Register an optimizer, using the optimizer's provided default priority.
| ||||||||||
OptimizerEntry<T> |
registerOptimizer(IOptimizer<T> opt)
Register an optimizer to the
main group , using the optimizer's
provided default priority. | ||||||||||
OptimizersPerformanceCounters | retrievePerformanceCounters() | ||||||||||
void | setDecryptorSupport(int value) | ||||||||||
void | setEnableDeobfuscators(boolean enabled) | ||||||||||
void | setEnableUnsafeOptimizers(boolean enabled) | ||||||||||
OptimizerMode | setMode(OptimizerMode mode) | ||||||||||
void |
setPolicyForOptimizerTag(String tag, boolean allowed)
Set the running policy associated to a tag or group of tags.
| ||||||||||
void |
setTarget(T t)
Set the optimizer's target.
| ||||||||||
void | unregisterAllOptimizers() | ||||||||||
boolean |
unregisterInstrumenter(IMasterOptimizerInstrumenter<T> instrumenter)
Unregister an instrumenter
| ||||||||||
boolean |
unregisterOptimizer(OptimizerEntry<T> e)
Remove an optimizer.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract String | getTargetAddress(T target) | ||||||||||
boolean |
onOptimizerException(T target, IOptimizer<T> opt, Exception ex)
This method is called when an optimizer hard-failed and generated an exception.
| ||||||||||
int | performV1() | ||||||||||
int | performV2(boolean rerunFromStartAfterOpt) | ||||||||||
void |
postAllOptimizationsCallback(T target)
This method might be overridden, but the parent should be called first.
| ||||||||||
void |
postOptimizationCallback(T target, OptimizerEntry<T> e, int cnt, long executionTimeMs)
This method might be overridden, but the parent should be called first.
| ||||||||||
void |
preAllOptimizationsCallback(T target)
This method might be overridden, but the parent should be called first.
| ||||||||||
void |
preOptimizationCallback(T target, OptimizerEntry<T> e)
This method might be overridden, but the parent should be called first.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IMasterOptimizer
|
disabled (0) by default; client code must explicitly set to non-zero to allow the execution of decryptors.
false by default; client code must explicitly set to true to allow the execution of deobfuscators.
false by default; client code must explicitly set to true to allow the execution of unsafe optimizers.
maximum run count for the group [1..N] (<0 means no limit)
instrumenters
groups of optimizers; groups 0 and -1 are entry and exit groups, respectively
Create a master optimizer.
t | the default target, may be null |
---|---|
grp1NMaxRunCount | maximum run count for the group [1..N] |
Retrieve the current operating mode for this MO.
Get a copy of the lists of optimizer entries registered with this MO and belonging to the provided optimizer group.
Get a copy of the list of optimizer entries registered with this MO.
Get the target onto which the optimizations will be performed.
Perform an optimization pass. All the optimizers will be run according to this master's schedule. They may be run multiple times.
Run the list of optimizers, in sequence. Each optimizer is run once.
list | a list of optimizers |
---|
Perform a single optimization, using the provided optimizer (which must have been previously registered).
e | an optimizer |
---|
Register an instrumenter. Instrumenters will be called following their registration order.
Register an optimizer, using the optimizer's provided default priority. Refer to IOptimizer#getDefaultPriority().
Register an optimizer to the main group
, using the optimizer's
provided default priority. Refer to IOptimizer#getDefaultPriority().
Set the running policy associated to a tag or group of tags. Policy checks when deciding
whether an optimizer should be run works as follow: 1) the tag must be allowed, 2) if passed,
the tag must not be blocked. By default, all tags are allowed, none are blocked. To reset to
that default policy: first invoke this method with ("*", true)
, then invoke it with
(null,
false)
.
tag | tag name; the special name "*" means all tags; the special name ""
(empty string) or null string means no tag |
---|---|
allowed | true to allow the master optimizer to run the optimizer with the specified tag; false to block it |
Set the optimizer's target.
Unregister an instrumenter
This method is called when an optimizer hard-failed and generated an exception.
target | the target that being optimized |
---|---|
opt | the failing optimizer |
ex | the generated exception |
This method might be overridden, but the parent should be called first.
This method might be overridden, but the parent should be called first. Note that this method might have a big impact on decompilation performance, so override carefully.
This method might be overridden, but the parent should be called first.
This method might be overridden, but the parent should be called first. Note that this method might have a big impact on decompilation performance, so override carefully.