Class AbstractEExpressionOptimizer
java.lang.Object
com.pnfsoftware.jeb.core.AbstractPlugin
com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.AbstractOptimizer<IERoutineContext>
com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.opt.AbstractEOptimizer
com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.opt.AbstractEExpressionOptimizer
- All Implemented Interfaces:
IPlugin,IEOptimizer,IOptimizer<IERoutineContext>
Skeleton for a top-down, recursive,
IEGeneric optimizer. Expressions are provided in
depth-first, pre-order way: parent expressions are provided before their constituting children.
By default, IEStatements are not candidates for optimization (although they can be).
Generally, IEStatements should be optimized via the use an
AbstractEStatementOptimizer.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classOptimized Expression -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IEStatementThis field holds a reference to the top-level parent statement of the expression currently being optimized.protected booleanDo not process left-side ofstatement.protected booleanOptimize only the constituents of the IRE statements, not the statements themselves.
Default value: true.Fields inherited from class com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.opt.AbstractEOptimizer
cfg, ectxFields inherited from class com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.AbstractOptimizer
loggerFields inherited from interface com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IOptimizer
DEAD_CODE_REMOVER, DEOBFUSCATOR, PRIORITY_HIGH, PRIORITY_LOW, PRIORITY_STANDARD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected IEGenericdoSubstitution(IEGeneric e, SubstitutionDefinition... substitutions) Attempt to apply the first matchingSubstitutionDefinitionon anIEGenericexpression.protected abstract AbstractEExpressionOptimizer.EORAttempt to optimize expressions.protected intperform()Perform the optimization pass.performOnExpression(IEGeneric exp, IERoutineContext ectx) The default implementation does nothing and returns null.Methods inherited from class com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.opt.AbstractEOptimizer
cleanCfg, deleteUnreachableTrampoline, dumpCfg, getDataChainsUpdatePolicy, getMasterOptimizer, getMasterOptimizerSafe, performOnTarget, postPerform, postPerform, setDataChainsUpdatePolicy, verifyCfgMethods inherited from class com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.AbstractOptimizer
addTag, getName, getPluginInformation, getPreferredExecutionStage, getPriority, getRequiredModeThreshold, getTags, getType, removeTag, setMasterOptimizer, setName, setPreferredExecutionStage, setPriority, setRequiredModeThreshold, setTypeMethods inherited from class com.pnfsoftware.jeb.core.AbstractPlugin
dispose, getData, setDataMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IOptimizer
getPreferredExecutionStage, getPriority, getRequiredModeThreshold, getTags, getType, setMasterOptimizerMethods inherited from interface com.pnfsoftware.jeb.core.IPlugin
dispose, getData, getPluginInformation, setData
-
Field Details
-
skipStatementProcessing
protected boolean skipStatementProcessingOptimize only the constituents of the IRE statements, not the statements themselves.
Default value: true. -
skipLeftSideOfAssignment
protected boolean skipLeftSideOfAssignment -
currentStatement
This field holds a reference to the top-level parent statement of the expression currently being optimized.
-
-
Constructor Details
-
AbstractEExpressionOptimizer
- Parameters:
dataChainsUpdatePolicy- expression optimizers should have a policy ofDataChainsUpdatePolicy.UPDATE_IF_OPTIMIZEDorDataChainsUpdatePolicy.UPDATE_IF_REQUIRED
-
-
Method Details
-
perform
protected int perform()Description copied from class:AbstractEOptimizerPerform the optimization pass. The caller may request that data chains not be updated, whenever possible. (They may be updated internally by the optimizer, which has the final say as to how and when DFA calculations should be run.)The above means that data chains after running this method may or may not have been modified, and may or may not be in a consistent state with the optimized CFG.
- Specified by:
performin classAbstractEOptimizer- Returns:
- the result of a call to one of
postPerform(...)or a negative number indicating an error has occurred and the optimizing process should be aborted
-
performOnExpression
Description copied from class:AbstractEOptimizerThe default implementation does nothing and returns null.- Specified by:
performOnExpressionin interfaceIEOptimizer- Overrides:
performOnExpressionin classAbstractEOptimizer- Parameters:
exp- IR expression to optimizeectx- helper routine context- Returns:
- non-null if the expression was optimized; null otherwise
-
optimizeExpression
Attempt to optimize expressions. Sub-expressions may be examined. The implementor should not attempt to modify parent or cousins expressions.- Parameters:
e- IRE- Returns:
- the new (optimized) expression as well as DFA update hints, or null if the expression could not be optimized
-
doSubstitution
Attempt to apply the first matchingSubstitutionDefinitionon anIEGenericexpression.- Parameters:
e- the target expression to be matched and modifiedsubstitutions- a list of candidate substitutions- Returns:
- null if no substitution was performed, else the new expression
-