public interface

IMasterOptimizer

com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IMasterOptimizer<T>
Known Indirect Subclasses

Class Overview

Definition of a master optimizer, whose role is to manage and orchestrate the execution of individual optimizers.

Note about optimizer groups: currently, the way optimizers are run is as follows:

  • group 0: executed once, at first
  • group 1..N:
    • group 1 executed repeatedly until no more optimizations can be performed
    • group 2 is executed once; if optimizations were made, we go back to group 1; else, we move to group 3
    • group 3 is executed once; if optimizations were made, we go back to group 1; else, we move to group 4
    • etc.
  • group -1: executed once, at last
  • group -2: executed on-demand only (passive container)

Summary

Constants
int DEFAULT_GROUP
Public Methods
abstract OptimizerMode getMode()
Retrieve the current operating mode for this MO.
abstract int getOptimizationCount(boolean deobfuscationOnly)
abstract OptimizerEntry<T> getOptimizer(Class<? extends IOptimizer<T>> clazz)
abstract IOptimizer<T> getOptimizerObject(Class<? extends IOptimizer<T>> clazz)
abstract List<OptimizerEntry<T>> getRegisteredOptimizers(int groupId)
Get a copy of the lists of optimizer entries registered with this MO and belonging to the provided optimizer group.
abstract List<OptimizerEntry<T>> getRegisteredOptimizers()
Get a copy of the list of optimizer entries registered with this MO.
abstract T getTarget()
Get the target onto which the optimizations will be performed.
abstract int getTotalOptimizationCount()
abstract int perform()
Perform an optimization pass.
abstract int performMultiple(List<OptimizerEntry<T>> list)
Perform the provided optimizations, in sequence (which must have been previously registered).
abstract int performSingle(OptimizerEntry<T> e)
Perform a single optimization, using the provided optimizer (which must have been previously registered).
abstract void registerInstrumenter(IMasterOptimizerInstrumenter<T> instrumenter)
Register an instrumenter.
abstract OptimizerEntry<T> registerOptimizer(int group, IOptimizer<T> opt)
Register an optimizer, using the optimizer's provided default priority.
abstract OptimizerEntry<T> registerOptimizer(IOptimizer<T> opt)
Register an optimizer to the main group, using the optimizer's provided default priority.
abstract OptimizerEntry<T> registerOptimizer(int group, IOptimizer<T> opt, double priority)
Register an optimizer.
abstract OptimizerMode setMode(OptimizerMode OptimizerMode)
abstract void setTarget(T t)
Set the optimizer's target.
abstract boolean unregisterInstrumenter(IMasterOptimizerInstrumenter<T> instrumenter)
Unregister an instrumenter
abstract boolean unregisterOptimizer(OptimizerEntry<T> entry)
Remove an optimizer.

Constants

public static final int DEFAULT_GROUP

Constant Value: 1 (0x00000001)

Public Methods

public abstract OptimizerMode getMode ()

Retrieve the current operating mode for this MO.

Returns
  • the current operating mode

public abstract int getOptimizationCount (boolean deobfuscationOnly)

public abstract OptimizerEntry<T> getOptimizer (Class<? extends IOptimizer<T>> clazz)

public abstract IOptimizer<T> getOptimizerObject (Class<? extends IOptimizer<T>> clazz)

public abstract List<OptimizerEntry<T>> getRegisteredOptimizers (int groupId)

Get a copy of the lists of optimizer entries registered with this MO and belonging to the provided optimizer group.

public abstract List<OptimizerEntry<T>> getRegisteredOptimizers ()

Get a copy of the list of optimizer entries registered with this MO.

public abstract T getTarget ()

Get the target onto which the optimizations will be performed.

public abstract int getTotalOptimizationCount ()

public abstract int perform ()

Perform an optimization pass. All the optimizers will be run according to this master's schedule. They may be run multiple times.

Returns
  • the total number of optimizations performed

public abstract int performMultiple (List<OptimizerEntry<T>> list)

Perform the provided optimizations, in sequence (which must have been previously registered).

public abstract int performSingle (OptimizerEntry<T> e)

Perform a single optimization, using the provided optimizer (which must have been previously registered).

public abstract void registerInstrumenter (IMasterOptimizerInstrumenter<T> instrumenter)

Register an instrumenter. Instrumenters will be called following their registration order.

public abstract OptimizerEntry<T> registerOptimizer (int group, IOptimizer<T> opt)

Register an optimizer, using the optimizer's provided default priority. Refer to getDefaultPriority().

public abstract OptimizerEntry<T> registerOptimizer (IOptimizer<T> opt)

Register an optimizer to the main group, using the optimizer's provided default priority. Refer to getDefaultPriority().

public abstract OptimizerEntry<T> registerOptimizer (int group, IOptimizer<T> opt, double priority)

Register an optimizer.

public abstract OptimizerMode setMode (OptimizerMode OptimizerMode)

Returns
  • the previous mode

public abstract void setTarget (T t)

Set the optimizer's target.

public abstract boolean unregisterInstrumenter (IMasterOptimizerInstrumenter<T> instrumenter)

Unregister an instrumenter

Returns
  • true if the instrumenter was removed, false otherwise

public abstract boolean unregisterOptimizer (OptimizerEntry<T> entry)

Remove an optimizer.