Class EMasterOptimizer
java.lang.Object
com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.AbstractMasterOptimizer<IERoutineContext>
com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.opt.EMasterOptimizer
- All Implemented Interfaces:
IEMasterOptimizer
,IMasterOptimizer<IERoutineContext>
public class EMasterOptimizer
extends AbstractMasterOptimizer<IERoutineContext>
implements IEMasterOptimizer
Standard master optimizer for
CFG
of IEStatement
IR instructions. Comes with a
bundle of standard expression optimizers, all registered in the IMasterOptimizer.DEFAULT_GROUP
.
Additional optimizers can be registered. Refer to the constructor javadoc. Special use registers
can be specified in order to improve the optimization rate of the dead-code removal and
expression substitution standard optimizers.-
Field Summary
FieldsFields inherited from class com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.AbstractMasterOptimizer
decryptorSupport, enableDeobfuscators, enableUnsafeOptimizers, grp1NMaxRunCount, instrumenters, optGrpMap, optList, t
Fields inherited from interface com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IMasterOptimizer
DEFAULT_GROUP
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a standard IR master optimizer with no maximum runcount (unsafe).EMasterOptimizer
(IERoutineContext ectx, int grp1NMaxRunCount) Create a standard IR master optimizer.EMasterOptimizer
(IERoutineContext ectx, int grp1NMaxRunCount, boolean autoRegisterStandardOptimizers) Create a standard IR master optimizer. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDefaultInput
(int bit, IEImm val) void
addDisregardedOutputBits
(Collection<Integer> disregardedOutputBits) void
void
addDisregardedOutputVariables
(Collection<? extends IEVar> disregardedOutputVars) boolean
canDiscardReachingOutDefinition
(IERoutineContext ectx, long insnAddress, int def) Check if an unused variable definition, bleeding out from the routine, may be safely discarded.boolean
canDiscardUnusedDefinition
(IERoutineContext ectx, long insnAddress, int def) Check if an unused variable definition, not bleeding out from the routine, may be safely discarded.getDefaultInput
(int reg) protected String
getTargetAddress
(IERoutineContext target) protected boolean
onOptimizerException
(IERoutineContext ctx, IOptimizer<IERoutineContext> opt, Exception ex) This method is called when an optimizer hard-failed and generated an exception.protected void
This method might be overridden, but the parent should be called first.protected void
postOptimizationCallback
(IERoutineContext ctx, OptimizerEntry<IERoutineContext> e, int cnt, long executionTimeMs) This method might be overridden, but the parent should be called first.protected void
This method might be overridden, but the parent should be called first.protected void
This method might be overridden, but the parent should be called first.void
setDecryptorSupport
(int value) Methods inherited from class com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.AbstractMasterOptimizer
getDecryptorSupport, getMode, getOptimizationCount, getOptimizer, getOptimizerObject, getRegisteredOptimizers, getRegisteredOptimizers, getTarget, getTotalOptimizationCount, isEnableDeobfuscators, isEnableUnsafeOptimizers, perform, performMultiple, performSingle, performV1, performV2, registerInstrumenter, registerOptimizer, registerOptimizer, retrievePerformanceCounters, setEnableDeobfuscators, setEnableUnsafeOptimizers, setMode, setPolicyForOptimizerTag, setTarget, unregisterAllOptimizers, unregisterInstrumenter, unregisterOptimizer
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IMasterOptimizer
getMode, getOptimizationCount, getOptimizer, getOptimizerObject, getRegisteredOptimizers, getRegisteredOptimizers, getTarget, getTotalOptimizationCount, perform, performMultiple, performSingle, registerInstrumenter, registerOptimizer, registerOptimizer, setMode, setPolicyForOptimizerTag, setTarget, unregisterInstrumenter, unregisterOptimizer
-
Field Details
-
EMPTY
-
defaultMaxRunCount
public static int defaultMaxRunCountno max
-
-
Constructor Details
-
EMasterOptimizer
Create a standard IR master optimizer with no maximum runcount (unsafe).- Parameters:
ectx
- optional default context; the target routine may be set after construction using#setTarget(IERoutineContext)
-
EMasterOptimizer
Create a standard IR master optimizer.- Parameters:
ectx
- optional default context; the target routine may be set after construction using#setTarget(IERoutineContext)
grp1NMaxRunCount
- maximum run count for the group [1..N]
-
EMasterOptimizer
public EMasterOptimizer(IERoutineContext ectx, int grp1NMaxRunCount, boolean autoRegisterStandardOptimizers) Create a standard IR master optimizer.- Parameters:
ectx
- optional default context; the target routine may be set after construction using#setTarget(IERoutineContext)
grp1NMaxRunCount
- maximum run count for the group [1..N]autoRegisterStandardOptimizers
-
-
-
Method Details
-
setDecryptorSupport
public void setDecryptorSupport(int value) - Overrides:
setDecryptorSupport
in classAbstractMasterOptimizer<IERoutineContext>
-
addDisregardedOutputFilter
- Specified by:
addDisregardedOutputFilter
in interfaceIEMasterOptimizer
-
addDisregardedOutputBits
- Specified by:
addDisregardedOutputBits
in interfaceIEMasterOptimizer
-
addDisregardedOutputVariables
- Specified by:
addDisregardedOutputVariables
in interfaceIEMasterOptimizer
-
getDisregardedOutputRegisters
- Specified by:
getDisregardedOutputRegisters
in interfaceIEMasterOptimizer
-
addDefaultInput
- Specified by:
addDefaultInput
in interfaceIEMasterOptimizer
-
getDefaultInput
- Specified by:
getDefaultInput
in interfaceIEMasterOptimizer
-
canDiscardReachingOutDefinition
Description copied from interface:IEMasterOptimizer
Check if an unused variable definition, bleeding out from the routine, may be safely discarded.The implementation may depend on the master optimizer's
mode
.- Specified by:
canDiscardReachingOutDefinition
in interfaceIEMasterOptimizer
insnAddress
- instruction addressdef
- defined, unused variable- Returns:
-
canDiscardUnusedDefinition
Description copied from interface:IEMasterOptimizer
Check if an unused variable definition, not bleeding out from the routine, may be safely discarded.The implementation may depend on the master optimizer's
mode
.- Specified by:
canDiscardUnusedDefinition
in interfaceIEMasterOptimizer
insnAddress
- instruction addressdef
- defined, unused variable- Returns:
-
onOptimizerException
protected boolean onOptimizerException(IERoutineContext ctx, IOptimizer<IERoutineContext> opt, Exception ex) Description copied from class:AbstractMasterOptimizer
This method is called when an optimizer hard-failed and generated an exception.- Overrides:
onOptimizerException
in classAbstractMasterOptimizer<IERoutineContext>
- Parameters:
ctx
- the target that being optimizedopt
- the failing optimizerex
- the generated exception- Returns:
- if true, the exception will be neutered and the master optimizer will resume the optimizing process; else, the exception will be thrown
-
preAllOptimizationsCallback
Description copied from class:AbstractMasterOptimizer
This method might be overridden, but the parent should be called first.- Overrides:
preAllOptimizationsCallback
in classAbstractMasterOptimizer<IERoutineContext>
-
preOptimizationCallback
Description copied from class:AbstractMasterOptimizer
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.- Overrides:
preOptimizationCallback
in classAbstractMasterOptimizer<IERoutineContext>
-
postOptimizationCallback
protected void postOptimizationCallback(IERoutineContext ctx, OptimizerEntry<IERoutineContext> e, int cnt, long executionTimeMs) Description copied from class:AbstractMasterOptimizer
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.- Overrides:
postOptimizationCallback
in classAbstractMasterOptimizer<IERoutineContext>
-
postAllOptimizationsCallback
Description copied from class:AbstractMasterOptimizer
This method might be overridden, but the parent should be called first.- Overrides:
postAllOptimizationsCallback
in classAbstractMasterOptimizer<IERoutineContext>
-
getTargetAddress
- Specified by:
getTargetAddress
in classAbstractMasterOptimizer<IERoutineContext>
-