public abstract class

AbstractEOptimizer

extends AbstractOptimizer<T>
java.lang.Object
   ↳ com.pnfsoftware.jeb.core.AbstractPlugin
     ↳ com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.AbstractOptimizer<T>
       ↳ com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.opt.AbstractEOptimizer
Known Direct Subclasses

Class Overview

Base class for IR optimizers.

The no-arg constructor is for standard optimizers, with DFA updates handled internally.

Summary

[Expand]
Inherited Constants
From interface com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IOptimizer
Fields
protected CFG<IEStatement> cfg
protected IERoutineContext ectx
[Expand]
Inherited Fields
From class com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.AbstractOptimizer
Public Constructors
AbstractEOptimizer()
Standard optimizer, DFA updates handled internally.
AbstractEOptimizer(DataChainsUpdatePolicy dataChainsUpdatePolicy)
Standard optimizer.
AbstractEOptimizer(DataChainsUpdatePolicy dataChainsUpdatePolicy, OptimizerType type)
Public Methods
DataChainsUpdatePolicy getDataChainsUpdatePolicy()
Get the data chains update policy after the optimization was performed.
IEMasterOptimizer getMasterOptimizer()
Retrieve the optional master optimizer that manages this optimizer.
final int perform(IERoutineContext ctx)
Same as perform(true).
IEGeneric performOnExpression(IEGeneric exp, IERoutineContext ectx)
Optimize a single expression.
Protected Methods
int cleanCfg()
void debugVerifyCfg()
boolean deleteUnreachableTrampoline(BasicBlock<IEStatement> b)
IEMasterOptimizer getMasterOptimizerSafe()
Safely retrieve a master optimizer.
abstract int perform(boolean updateDFA)
Perform the optimization pass.
final int postPerform(boolean updateDFA, int totalOptimizationCount, boolean requestDFA)
final int postPerform(boolean updateDFA, int totalOptimizationCount)
void setDataChainsUpdatePolicy(DataChainsUpdatePolicy dataChainsUpdatePolicy)
This method should rarely be called; data-chains update policy is set up in the constructor, and should not change under normal circumstances.
[Expand]
Inherited Methods
From class com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.AbstractOptimizer
From class com.pnfsoftware.jeb.core.AbstractPlugin
From class java.lang.Object
From interface com.pnfsoftware.jeb.core.IPlugin
From interface com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IOptimizer

Fields

protected CFG<IEStatement> cfg

protected IERoutineContext ectx

Public Constructors

public AbstractEOptimizer ()

Standard optimizer, DFA updates handled internally.

public AbstractEOptimizer (DataChainsUpdatePolicy dataChainsUpdatePolicy)

Standard optimizer.

public AbstractEOptimizer (DataChainsUpdatePolicy dataChainsUpdatePolicy, OptimizerType type)

Public Methods

public DataChainsUpdatePolicy getDataChainsUpdatePolicy ()

Get the data chains update policy after the optimization was performed.

public IEMasterOptimizer getMasterOptimizer ()

Retrieve the optional master optimizer that manages this optimizer.

Returns
  • optional reference

public final int perform (IERoutineContext ctx)

Same as perform(true). Data chains will be updated according to the optimizer's DFA policy.

The above means that data chains after running this method may be modified, but must be in a consistent state with the CFG.

public IEGeneric performOnExpression (IEGeneric exp, IERoutineContext ectx)

Optimize a single expression. The default implementation does nothing and returns null.

Parameters
exp IR expression to optimize
ectx helper routine context
Returns
  • non-null if the expression was optimized; null otherwise

Protected Methods

protected int cleanCfg ()

protected void debugVerifyCfg ()

protected boolean deleteUnreachableTrampoline (BasicBlock<IEStatement> b)

protected IEMasterOptimizer getMasterOptimizerSafe ()

Safely retrieve a master optimizer. If getMasterOptimizer() provides one, it is returned. Else, an empty immutable generic MO is provided.

Returns
  • never null

protected abstract int perform (boolean updateDFA)

Perform 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.

Parameters
updateDFA must be true / this parameter will be deprecated (previously was: if true, update data chains according to the optimizer's policy; if false, the optimizer should not perform final DFA computations if needed)
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

protected final int postPerform (boolean updateDFA, int totalOptimizationCount, boolean requestDFA)

protected final int postPerform (boolean updateDFA, int totalOptimizationCount)

protected void setDataChainsUpdatePolicy (DataChainsUpdatePolicy dataChainsUpdatePolicy)

This method should rarely be called; data-chains update policy is set up in the constructor, and should not change under normal circumstances.

Parameters
dataChainsUpdatePolicy null means DFA is handled internally, by the optimizer