Class AbstractOptimizer<T extends IOptimizerTarget>
java.lang.Object
com.pnfsoftware.jeb.core.AbstractPlugin
com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.AbstractOptimizer<T>
- Type Parameters:
T-
- All Implemented Interfaces:
IPlugin,IOptimizer<T>
- Direct Known Subclasses:
AbstractCOptimizer,AbstractEOptimizer
public abstract class AbstractOptimizer<T extends IOptimizerTarget>
extends AbstractPlugin
implements IOptimizer<T>
Skeleton for a generic artifact optimizer.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ILoggerPublic logger accessible by the implementing optimizer.Fields 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 voidRetrieve the optional master optimizer that manages this optimizer.getName()Retrieve basic information about the plugin, such as name, version, author, and organization.intThis method is used for on-demand optimizers only.final doubleThe standard implementation provides astandard priority of 0.Specify the minimum bar requested from the orchestrator in order to run.getTags()Get the optimizer tags.getType()Retrieve the type of this optimizer.protected voidvoidSet an optional master optimizer that manages this optimizer.protected voidprotected voidsetPreferredExecutionStage(int preferredExecStage) Use only for typeOptimizerType.ON_DEMAND.protected voidsetPriority(double priority) Set the optimizer priority.protected voidsetRequiredModeThreshold(OptimizerMode threshold) Set the threshold.protected voidsetType(OptimizerType type) Set the type of optimizer.Methods 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
performOnTarget
-
Field Details
-
logger
Public logger accessible by the implementing optimizer. Writing to the logger should be favored over writing directly tostdout.
-
-
Constructor Details
-
AbstractOptimizer
public AbstractOptimizer() -
AbstractOptimizer
-
-
Method Details
-
setName
-
getName
-
getPluginInformation
Description copied from interface:IPluginRetrieve basic information about the plugin, such as name, version, author, and organization.- Specified by:
getPluginInformationin interfaceIPlugin- Returns:
- the plugin information
-
setMasterOptimizer
Description copied from interface:IOptimizerSet an optional master optimizer that manages this optimizer.- Specified by:
setMasterOptimizerin interfaceIOptimizer<T extends IOptimizerTarget>- Parameters:
mo- optional
-
getMasterOptimizer
Description copied from interface:IOptimizerRetrieve the optional master optimizer that manages this optimizer.- Specified by:
getMasterOptimizerin interfaceIOptimizer<T extends IOptimizerTarget>- Returns:
- optional reference
-
setType
Set the type of optimizer. The default isOptimizerType.NORMAL. Optimizers with a typeOptimizerType.ON_DEMANDmust also set theirpreferred execution stage(else they will never run).- Parameters:
type-
-
getRequiredModeThreshold
Description copied from interface:IOptimizerSpecify the minimum bar requested from the orchestrator in order to run. If that bar is not met, the orchestrator should not run the optimizer. Refer toAbstractMasterOptimizerfor existing thresholds.- Specified by:
getRequiredModeThresholdin interfaceIOptimizer<T extends IOptimizerTarget>- Returns:
-
setRequiredModeThreshold
Set the threshold. The default valueAbstractMasterOptimizer#MODE_NORMAL.- Parameters:
threshold-
-
getType
Description copied from interface:IOptimizerRetrieve the type of this optimizer.- Specified by:
getTypein interfaceIOptimizer<T extends IOptimizerTarget>- Returns:
-
addTag
-
removeTag
-
getTags
Description copied from interface:IOptimizerGet the optimizer tags. An optimizer may have 0, 1, or more tags. A tag is a non-null, non-empty string.- Specified by:
getTagsin interfaceIOptimizer<T extends IOptimizerTarget>- Returns:
- a collection of tags; may be empty (tags are optional), but never null
-
setPreferredExecutionStage
protected void setPreferredExecutionStage(int preferredExecStage) Use only for typeOptimizerType.ON_DEMAND. Disregarded for other types. Leave to 0 for pure on-demand.- Parameters:
preferredExecStage- id such that abs(id) is in [1, 99] ; use positive value for post-stage execution, negative value for pre-stage execution
-
getPreferredExecutionStage
public int getPreferredExecutionStage()Description copied from interface:IOptimizerThis method is used for on-demand optimizers only.- Specified by:
getPreferredExecutionStagein interfaceIOptimizer<T extends IOptimizerTarget>- Returns:
-
setPriority
protected void setPriority(double priority) Set the optimizer priority. To be used by the constructor.- Parameters:
priority- the new priority (high means higher priority). When optimizers are managed and run by an orchestrator, the optimizers with a higher priority are run before those having a lower priority. The default priority is 0.
-
getPriority
public final double getPriority()The standard implementation provides astandard priority of 0.- Specified by:
getPriorityin interfaceIOptimizer<T extends IOptimizerTarget>- Returns:
- the optimizer priority
-