public abstract class

AbstractEPatternOptimizer

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

Class Overview

Pattern-Matcher-Replacer optimizers run with the policy UPDATE_IF_OPTIMIZED or UPDATE_IF_REQUIRED.

Summary

[Expand]
Inherited Constants
From interface com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IOptimizer
[Expand]
Inherited Fields
From class com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.opt.AbstractEOptimizer
From class com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.AbstractOptimizer
Public Constructors
AbstractEPatternOptimizer()
Create a default matcher with a IF_OPTIMIZED policy.
AbstractEPatternOptimizer(boolean updateChainsIfOptimized)
Create a matcher.
Public Methods
IEGeneric performOnExpression(IEGeneric exp, IERoutineContext ectx)
The default implementation does nothing and returns null.
Protected Methods
abstract Collection<EPatternCompiler.EPattern> getPatterns()
int perform()
Perform the optimization pass.
[Expand]
Inherited Methods
From class com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.opt.AbstractEOptimizer
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.ir.opt.IEOptimizer
From interface com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IOptimizer

Public Constructors

public AbstractEPatternOptimizer ()

Create a default matcher with a IF_OPTIMIZED policy.

public AbstractEPatternOptimizer (boolean updateChainsIfOptimized)

Create a matcher.

Parameters
updateChainsIfOptimized if true, the DFA update policy is set to IF_OPTIMIZED; else, it is set to IF_REQUIRED and the requirement comes from a successful match-and-replace on a pattern having the FLAG_INVALIDATE_DFA flag.

Public Methods

public IEGeneric performOnExpression (IEGeneric exp, IERoutineContext ectx)

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 abstract Collection<EPatternCompiler.EPattern> getPatterns ()

protected int perform ()

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.

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