# Class: com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.AbstractMasterOptimizer

Standard implementation of a generic master optimizer.

## Constructor: AbstractMasterOptimizer
- parameter: `t`, type: `T`
- parameter: `grp1NMaxRunCount`, type: `int`

Description: Create a master optimizer.
parameter: t: the default target, may be null
parameter: grp1NMaxRunCount: maximum run count for the group \[1..N\]

## Protected Field: decryptorSupport
Type: `int`
Description: disabled \(0\) by default; client code must explicitly set to non\-zero to allow the execution of decryptors.

## Protected Field: enableDeobfuscators
Type: `boolean`
Description: false by default; client code must explicitly set to true to allow the execution of deobfuscators.

## Protected Field: enableUnsafeOptimizers
Type: `boolean`
Description: false by default; client code must explicitly set to true to allow the execution of unsafe optimizers.

## Protected Field: grp1NMaxRunCount
Type: `int`
Description: maximum run count for the group \[1..N\] \(`<0` means no limit\)

## Protected Field: instrumenters
Type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IMasterOptimizerInstrumenter<T>>`
Description: instrumenters

## Protected Field: optGrpMap
Type: `java.util.SortedMap<java.lang.Integer,java.util.List<com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerEntry<T>>>`
Description: groups of optimizers; groups 0 and \-1 are entry and exit groups, respectively

## Protected Field: optList
Type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerEntry<T>>`
Description: list of all optimizers

## Protected Field: t
Type: `T`
Description: default target

## Method: getDecryptorSupport
- return type: `int`

Description: Retrieve decryptor support level.
return: decryptor support level

## Method: getMode
- return type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerMode`


## Method: getOptimizationCount
- parameter: `deobfuscationOnly`, type: `boolean`
- return type: `int`


## Method: getOptimizer
- parameter: `clazz`, type: `java.lang.Class<? extends com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IOptimizer<T>>`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerEntry<T>`


## Method: getOptimizerObject
- parameter: `clazz`, type: `java.lang.Class<? extends com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IOptimizer<T>>`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IOptimizer<T>`


## Method: getRegisteredOptimizers
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerEntry<T>>`


## Method: getRegisteredOptimizers
- parameter: `groupId`, type: `int`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerEntry<T>>`


## Method: getTarget
- return type: `T`


## Protected Method: getTargetAddress
- parameter: `target`, type: `T`
- return type: `java.lang.String`


## Method: getTotalOptimizationCount
- return type: `int`


## Method: isEnableDeobfuscators
- return type: `boolean`

Description: Determine whether deobfuscators are enabled.
return: true if deobfuscators are enabled

## Method: isEnableUnsafeOptimizers
- return type: `boolean`

Description: Determine whether unsafe optimizers are enabled.
return: true if unsafe optimizers are enabled

## Protected Method: onOptimizerException
- parameter: `target`, type: `T`
- parameter: `opt`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IOptimizer<T>`
- parameter: `ex`, type: `java.lang.Exception`
- return type: `boolean`

Description: This method is called when an optimizer hard\-failed and generated an exception. 

 **Implementation note:** the default implementation logs an error to the console, reports the error, and will let the master optimizer resume execution if allowed.
parameter: target: the target that being optimized
parameter: opt: the failing optimizer
parameter: ex: the generated exception
return: if true, the exception will be neutered and the master optimizer will resume the         optimizing process; else, the exception will be thrown

## Method: perform
- return type: `int`


## Method: performMultiple
- parameter: `list`, type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerEntry<T>>`
- return type: `int`


## Method: performSingle
- parameter: `e`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerEntry<T>`
- return type: `int`


## Protected Method: performV1
- return type: `int`


## Protected Method: performV2
- parameter: `rerunFromStartAfterOpt`, type: `boolean`
- return type: `int`


## Protected Method: postAllOptimizationsCallback
- parameter: `target`, type: `T`

Description: This method might be overridden, but the parent should be called first.

## Protected Method: postOptimizationCallback
- parameter: `target`, type: `T`
- parameter: `e`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerEntry<T>`
- parameter: `cnt`, type: `int`
- parameter: `executionTimeMs`, type: `long`

Description: This method might be overridden, but the parent should be called first. Note that this method might have a big impact on decompilation performance, so override carefully.

## Protected Method: preAllOptimizationsCallback
- parameter: `target`, type: `T`

Description: This method might be overridden, but the parent should be called first.

## Protected Method: preOptimizationCallback
- parameter: `target`, type: `T`
- parameter: `e`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerEntry<T>`

Description: This method might be overridden, but the parent should be called first. Note that this method might have a big impact on decompilation performance, so override carefully.

## Method: registerInstrumenter
- parameter: `instrumenter`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IMasterOptimizerInstrumenter<T>`


## Method: registerOptimizer
- parameter: `opt`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IOptimizer<T>`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerEntry<T>`


## Method: registerOptimizer
- parameter: `group`, type: `int`
- parameter: `opt`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IOptimizer<T>`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerEntry<T>`


## Method: retrievePerformanceCounters
- return type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizersPerformanceCounters`

Description: Retrieve optimizer performance counters.
return: performance counters

## Method: setDecryptorSupport
- parameter: `value`, type: `int`

Description: Set decryptor support level.
parameter: value: decryptor support level

## Method: setEnableDeobfuscators
- parameter: `enabled`, type: `boolean`

Description: Enable or disable deobfuscators.
parameter: enabled: true to allow deobfuscators

## Method: setEnableUnsafeOptimizers
- parameter: `enabled`, type: `boolean`

Description: Enable or disable unsafe optimizers.
parameter: enabled: true to allow unsafe optimizers

## Method: setMode
- parameter: `mode`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerMode`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerMode`


## Method: setPolicyForOptimizerTag
- parameter: `tag`, type: `java.lang.String`
- parameter: `allowed`, type: `boolean`


## Method: setTarget
- parameter: `t`, type: `T`


## Method: unregisterAllOptimizers

Description: Unregister all optimizers.

## Method: unregisterInstrumenter
- parameter: `instrumenter`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IMasterOptimizerInstrumenter<T>`
- return type: `boolean`


## Method: unregisterOptimizer
- parameter: `e`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerEntry<T>`
- return type: `boolean`


