public interface

IDMasterOptimizer

com.pnfsoftware.jeb.core.units.code.android.ir.IDMasterOptimizer

Class Overview

A manager of IR optimizers. A master optimizer (MO) orchestrates and executes optimizers. This class is currently not meant to be implemented by third-party code. To create a master optimizer instance, use createMasterOptimizer(IDMethodContext). Most IR optimizers will not need to create and use MOs on their own. However, some multi-stage advanced optimizers may need intermediate code clean-up before proceeding to a later phase. In such cases, using an MO may be necessary.

Implementation note: the master optimizer may call optimizers repeatedly until no more optimizations are performed.

Summary

Public Methods
abstract boolean add(IDOptimizer optimizer)
Register an external optimizer.
abstract <T extends IDOptimizer> T findOptimizer(Class<T> cl)
Find an optimizer by type.
abstract List<IDOptimizer> getListOfOptimizers()
Retrieve the list of all optimizers.
abstract IDMethodContext getTarget()
Retrieve the IR method context to be optimized.
abstract boolean isEnableUnsafeOptimizers()
This method is deprecated. No replacement.
abstract boolean isSafeMode()
Determine whether safe mode is enabled.
abstract int perform()
Perform optimizations on the target.
abstract boolean remove(IDOptimizer optimizer)
Unregister an external optimizer.
abstract void setEnableUnsafeOptimizers(boolean enabled)
This method is deprecated. No replacement.
abstract void setOptimizerEnabled(IDOptimizer opt, boolean enabled)
Enable or disable an optimizer.
abstract void setSafeMode(boolean enabled)
Enable or disable safe mode.

Public Methods

public abstract boolean add (IDOptimizer optimizer)

Register an external optimizer.

Parameters
optimizer an optimizer
Returns
  • true if the optimizer was registered

public abstract T findOptimizer (Class<T> cl)

Find an optimizer by type. If multiple optimizers of the same type were registered (a practice that is not recommended), the first one is returned.

Parameters
cl optimizer type
Returns
  • a registered optimizer of the provided type or null

public abstract List<IDOptimizer> getListOfOptimizers ()

Retrieve the list of all optimizers. The returned list contains all optimizers (built-in, external, etc.) registered with this MO. While the list is immutable, the optimizer objects can be acted upon. For example, optimizers (including internal optimizers) may be selectively enabled or disabled via setOptimizerEnabled(IDOptimizer, boolean).

Returns
  • read-only list of currently registered optimizers

public abstract IDMethodContext getTarget ()

Retrieve the IR method context to be optimized.

public abstract boolean isEnableUnsafeOptimizers ()

This method is deprecated.
No replacement.

public abstract boolean isSafeMode ()

Determine whether safe mode is enabled. In safe mode, the only optimizers that are run are those whose type is NORMAL.

public abstract int perform ()

Perform optimizations on the target.

Returns
  • the number of optimizations performed

public abstract boolean remove (IDOptimizer optimizer)

Unregister an external optimizer.

Parameters
optimizer a previously-registered optimizer
Returns
  • true if the optimizer was unregistered

public abstract void setEnableUnsafeOptimizers (boolean enabled)

This method is deprecated.
No replacement.

public abstract void setOptimizerEnabled (IDOptimizer opt, boolean enabled)

Enable or disable an optimizer.

public abstract void setSafeMode (boolean enabled)

Enable or disable safe mode. In safe mode, the only optimizers that are run are those whose type is NORMAL.