Interface IDOptimizer

All Superinterfaces:
IPlugin
All Known Implementing Classes:
AbstractDCollectionOptimizer, AbstractDOptimizer

public interface IDOptimizer extends IPlugin
Plugin interface for dexdec (DEX decompiler) IR optimizer plugins. They are used to optimize a method's IR or a collection of methods IRs.

Implementors should not implement this interface directly: extend AbstractDOptimizer instead.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    A well-known optimizer tag used to indicate that an optimizer is categorized as an explicit deobfuscator.
    static final String
    A well-known optimizer tag used to indicate that an optimizer inlines method invocations.
    static final String
    A well-known optimizer tag indicating that this optimizer, as part of its work, reorders the graph's nodes into a more natural way, better suitable for AST generation.
    static final String
    A well-known optimizer tag used to indicate that an optimizer is likely to perform slowly on large graphs.
  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieve the plugin name.
    double
    Get the optimizer priority.
    Get the optimizer tags.
    Get the optimizer type.
    boolean
    Determine whether this optimizer performs on a single method or an a collection of methods.
    boolean
    Determine whether the optimizer is enabled or not.
    int
    Run the optimizer on the provided target method.
    int
    Run the optimizer on the provided collection of methods.

    Methods inherited from interface com.pnfsoftware.jeb.core.IPlugin

    dispose, getData, getPluginInformation, setData
  • Field Details

    • DEOBFUSCATOR

      static final String DEOBFUSCATOR
      A well-known optimizer tag used to indicate that an optimizer is categorized as an explicit deobfuscator.
      See Also:
    • INLINER

      static final String INLINER
      A well-known optimizer tag used to indicate that an optimizer inlines method invocations.
      See Also:
    • REORDERER

      static final String REORDERER
      A well-known optimizer tag indicating that this optimizer, as part of its work, reorders the graph's nodes into a more natural way, better suitable for AST generation. That process is also called "layouting". Note that such optimizers may report no-optimizations performed but still have reordered the graph.
      See Also:
    • SLOW

      static final String SLOW
      A well-known optimizer tag used to indicate that an optimizer is likely to perform slowly on large graphs.
      See Also:
  • Method Details

    • getName

      String getName()
      Retrieve the plugin name. Should be consistent with the value returned by getPluginInformation().getName().
      Returns:
    • getType

      DOptimizerType getType()
      Get the optimizer type. Types are used by optimizer orchestrators to determine whether an optimizer should run.
      Returns:
    • getTags

      Set<String> getTags()
      Get the optimizer tags. An optimizer may have 0, 1, or more tags. A tag is a non-null, non-empty string.
      Returns:
      a collection of tags; may be empty (tags are optional), but never null
    • getPriority

      double getPriority()
      Get the optimizer priority. A higher value means a higher priority. Priorities are used by optimizer orchestrators to determine in which order optimizers should be executed.
      Returns:
      the default priority
    • isEnabled

      boolean isEnabled()
      Determine whether the optimizer is enabled or not. This method is used by optimizer orchestrators to determine whether an optimizer can be scheduled for execution.
      Returns:
      true if this optimizer is enabled
    • isCollectionOptimizer

      boolean isCollectionOptimizer()
      Determine whether this optimizer performs on a single method or an a collection of methods.
      Returns:
    • perform

      int perform(IDMethodContext ctx)
      Run the optimizer on the provided target method.

      For this method to be called by an orchestrator, isCollectionOptimizer() must return false.

      Parameters:
      ctx - a method context
      Returns:
      number of optimizations performed
    • performOnCollection

      int performOnCollection(List<IDMethodContext> ctxlist, Map<IDMethodContext,Integer> pmcntmap)
      Run the optimizer on the provided collection of methods.

      For this method to be called by an orchestrator, isCollectionOptimizer() must return true.

      Parameters:
      ctxlist - a collection of method contexts
      pmcntmap - optional output map that will receive the per-method optimization counts
      Returns:
      number of optimizations performed