Java Code Examples for proguard.classfile.editor.CodeAttributeEditor

The following examples show how to use proguard.classfile.editor.CodeAttributeEditor. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * Creates an array of InstructionSequenceReplacer instances.
 * @param patternConstants        any constants referenced by the pattern
 *                                instruction.
 * @param instructionSequences    the instruction sequences to be replaced,
 *                                with subsequently the sequence pair index,
 *                                the from/to index (0 or 1), and the
 *                                instruction index in the sequence.
 * @param branchTargetFinder      a branch target finder that has been
 *                                initialized to indicate branch targets
 *                                in the visited code.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 * @param extraInstructionVisitor an optional extra visitor for all deleted
 *                                load instructions.
 */
private static InstructionVisitor[] createInstructionSequenceReplacers(Constant[]          patternConstants,
                                                                       Instruction[][][]   instructionSequences,
                                                                       BranchTargetFinder  branchTargetFinder,
                                                                       CodeAttributeEditor codeAttributeEditor,
                                                                       InstructionVisitor extraInstructionVisitor)
{
    InstructionVisitor[] instructionSequenceReplacers =
        new InstructionSequenceReplacer[instructionSequences.length];

    for (int index = 0; index < instructionSequenceReplacers.length; index++)
    {
        Instruction[][] instructionSequencePair = instructionSequences[index];
        instructionSequenceReplacers[index] =
            new InstructionSequenceReplacer(patternConstants,
                                            instructionSequencePair[PATTERN_INDEX],
                                            instructionSequencePair[REPLACEMENT_INDEX],
                                            branchTargetFinder,
                                            codeAttributeEditor,
                                            extraInstructionVisitor);
    }

    return instructionSequenceReplacers;
}
 
Example 2
/**
 * Creates an array of InstructionSequenceReplacer instances.
 * @param patternConstants        any constants referenced by the pattern
 *                                instruction.
 * @param instructionSequences    the instruction sequences to be replaced,
 *                                with subsequently the sequence pair index,
 *                                the from/to index (0 or 1), and the
 *                                instruction index in the sequence.
 * @param branchTargetFinder      a branch target finder that has been
 *                                initialized to indicate branch targets
 *                                in the visited code.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 * @param extraInstructionVisitor an optional extra visitor for all deleted
 *                                load instructions.
 */
private static InstructionVisitor[] createInstructionSequenceReplacers(Constant[]          patternConstants,
                                                                       Instruction[][][]   instructionSequences,
                                                                       BranchTargetFinder  branchTargetFinder,
                                                                       CodeAttributeEditor codeAttributeEditor,
                                                                       InstructionVisitor  extraInstructionVisitor)
{
    InstructionVisitor[] instructionSequenceReplacers =
        new InstructionSequenceReplacer[instructionSequences.length];

    for (int index = 0; index < instructionSequenceReplacers.length; index++)
    {
        Instruction[][] instructionSequencePair = instructionSequences[index];
        instructionSequenceReplacers[index] =
            new InstructionSequenceReplacer(patternConstants,
                                            instructionSequencePair[PATTERN_INDEX],
                                            instructionSequencePair[REPLACEMENT_INDEX],
                                            branchTargetFinder,
                                            codeAttributeEditor,
                                            extraInstructionVisitor);
    }

    return instructionSequenceReplacers;
}
 
Example 3
Source Project: bazel   Source File: InstructionSequencesReplacer.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates an array of InstructionSequenceReplacer instances.
 * @param patternConstants        any constants referenced by the pattern
 *                                instruction.
 * @param instructionSequences    the instruction sequences to be replaced,
 *                                with subsequently the sequence pair index,
 *                                the from/to index (0 or 1), and the
 *                                instruction index in the sequence.
 * @param branchTargetFinder      a branch target finder that has been
 *                                initialized to indicate branch targets
 *                                in the visited code.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 * @param extraInstructionVisitor an optional extra visitor for all deleted
 *                                load instructions.
 */
private static InstructionVisitor[] createInstructionSequenceReplacers(Constant[]          patternConstants,
                                                                       Instruction[][][]   instructionSequences,
                                                                       BranchTargetFinder  branchTargetFinder,
                                                                       CodeAttributeEditor codeAttributeEditor,
                                                                       InstructionVisitor  extraInstructionVisitor)
{
    InstructionVisitor[] instructionSequenceReplacers =
        new InstructionSequenceReplacer[instructionSequences.length];

    for (int index = 0; index < instructionSequenceReplacers.length; index++)
    {
        Instruction[][] instructionSequencePair = instructionSequences[index];
        instructionSequenceReplacers[index] =
            new InstructionSequenceReplacer(patternConstants,
                                            instructionSequencePair[PATTERN_INDEX],
                                            instructionSequencePair[REPLACEMENT_INDEX],
                                            branchTargetFinder,
                                            codeAttributeEditor,
                                            extraInstructionVisitor);
    }

    return instructionSequenceReplacers;
}
 
Example 4
/**
 * Creates a new InstructionSequenceReplacer.
 * @param patternConstants        any constants referenced by the pattern
 *                                instruction.
 * @param patternInstructions     the pattern instruction sequence.
 * @param replacementInstructions the replacement instruction sequence.
 * @param branchTargetFinder      a branch target finder that has been
 *                                initialized to indicate branch targets
 *                                in the visited code.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 */
public InstructionSequenceReplacer(Constant[]          patternConstants,
                                   Instruction[]       patternInstructions,
                                   Instruction[]       replacementInstructions,
                                   BranchTargetFinder  branchTargetFinder,
                                   CodeAttributeEditor codeAttributeEditor)
{
    this(patternConstants,
         patternInstructions,
         replacementInstructions,
         branchTargetFinder,
         codeAttributeEditor,
         null);
}
 
Example 5
/**
 * Creates a new InstructionSequenceReplacer.
 * @param patternConstants        any constants referenced by the pattern
 *                                instruction.
 * @param branchTargetFinder      a branch target finder that has been
 *                                initialized to indicate branch targets
 *                                in the visited code.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 * @param extraInstructionVisitor an optional extra visitor for all deleted
 *                                load instructions.
 */
public InstructionSequenceReplacer(Constant[]          patternConstants,
                                   Instruction[]       patternInstructions,
                                   Instruction[]       replacementInstructions,
                                   BranchTargetFinder  branchTargetFinder,
                                   CodeAttributeEditor codeAttributeEditor,
                                   InstructionVisitor extraInstructionVisitor)
{
    this.instructionSequenceMatcher = new InstructionSequenceMatcher(patternConstants, patternInstructions);
    this.replacementInstructions    = replacementInstructions;
    this.branchTargetFinder         = branchTargetFinder;
    this.codeAttributeEditor        = codeAttributeEditor;
    this.extraInstructionVisitor    = extraInstructionVisitor;
}
 
Example 6
/**
 * Creates a new OptimizedTypeAdapterAdder.
 *
 * @param programClassPool         the program class pool used for looking
 *                                 up references to program classes.
 * @param libraryClassPool         the library class pool used for looking
 *                                 up references to library classes.
 * @param codeAttributeEditor      the code attribute editor used for
 *                                 implementing the added type adapters.
 * @param serializationInfo        contains information on which classes
 *                                 and fields to serialize and how.
 * @param deserializationInfo      contains information on which classes
 *                                 and fields to deserialize and how.
 * @param extraDataEntryNameMap    map to which the names of new type
 *                                 adapter classes are added.
 * @param typeAdapterRegistry      the registry to which the corresponding
 *                                 type adapter class name is added for a
 *                                 given domain class name.
 * @param gsonRuntimeSettings      keeps track of all GsonBuilder invocations.
 */
public OptimizedTypeAdapterAdder(ClassPool             programClassPool,
                                 ClassPool             libraryClassPool,
                                 CodeAttributeEditor   codeAttributeEditor,
                                 OptimizedJsonInfo     serializationInfo,
                                 OptimizedJsonInfo     deserializationInfo,
                                 ExtraDataEntryNameMap extraDataEntryNameMap,
                                 Map<String, String>   typeAdapterRegistry,
                                 GsonRuntimeSettings   gsonRuntimeSettings)
{
    this.programClassPool      = programClassPool;
    this.libraryClassPool      = libraryClassPool;
    this.codeAttributeEditor   = codeAttributeEditor;
    this.serializationInfo     = serializationInfo;
    this.deserializationInfo   = deserializationInfo;
    this.extraDataEntryNameMap = extraDataEntryNameMap;
    this.typeAdapterRegistry   = typeAdapterRegistry;
    this.gsonRuntimeSettings   = gsonRuntimeSettings;
}
 
Example 7
Source Project: proguard   Source File: NopRemover.java    License: GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates a new NopRemover.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 * @param extraInstructionVisitor an optional extra visitor for all removed
 *                                nop instructions.
 */
public NopRemover(CodeAttributeEditor codeAttributeEditor,
                  InstructionVisitor  extraInstructionVisitor)
{
    this.codeAttributeEditor     = codeAttributeEditor;
    this.extraInstructionVisitor = extraInstructionVisitor;
}
 
Example 8
Source Project: proguard   Source File: GotoReturnReplacer.java    License: GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates a new GotoReturnReplacer.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 * @param extraInstructionVisitor an optional extra visitor for all replaced
 *                                goto instructions.
 */
public GotoReturnReplacer(CodeAttributeEditor codeAttributeEditor,
                          InstructionVisitor  extraInstructionVisitor)
{
    this.codeAttributeEditor     = codeAttributeEditor;
    this.extraInstructionVisitor = extraInstructionVisitor;
}
 
Example 9
Source Project: proguard   Source File: GotoGotoReplacer.java    License: GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates a new GotoGotoReplacer.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 * @param extraInstructionVisitor an optional extra visitor for all replaced
 *                                goto instructions.
 */
public GotoGotoReplacer(CodeAttributeEditor codeAttributeEditor,
                        InstructionVisitor  extraInstructionVisitor)
{
    this.codeAttributeEditor     = codeAttributeEditor;
    this.extraInstructionVisitor = extraInstructionVisitor;
}
 
Example 10
Source Project: java-n-IDE-for-Android   Source File: NopRemover.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Creates a new NopRemover.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 * @param extraInstructionVisitor an optional extra visitor for all removed
 *                                nop instructions.
 */
public NopRemover(CodeAttributeEditor codeAttributeEditor,
                  InstructionVisitor extraInstructionVisitor)
{
    this.codeAttributeEditor     = codeAttributeEditor;
    this.extraInstructionVisitor = extraInstructionVisitor;
}
 
Example 11
/**
 * Creates a new InstructionSequencesReplacer.
 * @param patternConstants        any constants referenced by the pattern
 *                                instruction.
 * @param instructionSequences    the instruction sequences to be replaced,
 *                                with subsequently the sequence pair index,
 *                                the patten/replacement index (0 or 1),
 *                                and the instruction index in the sequence.
 * @param branchTargetFinder      a branch target finder that has been
 *                                initialized to indicate branch targets
 *                                in the visited code.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 */
public InstructionSequencesReplacer(Constant[]          patternConstants,
                                    Instruction[][][]   instructionSequences,
                                    BranchTargetFinder  branchTargetFinder,
                                    CodeAttributeEditor codeAttributeEditor)
{
    this(patternConstants,
         instructionSequences,
         branchTargetFinder,
         codeAttributeEditor,
         null);
}
 
Example 12
/**
 * Creates a new InstructionSequenceReplacer.
 * @param patternConstants        any constants referenced by the pattern
 *                                instruction.
 * @param instructionSequences    the instruction sequences to be replaced,
 *                                with subsequently the sequence pair index,
 *                                the patten/replacement index (0 or 1),
 *                                and the instruction index in the sequence.
 * @param branchTargetFinder      a branch target finder that has been
 *                                initialized to indicate branch targets
 *                                in the visited code.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 * @param extraInstructionVisitor an optional extra visitor for all deleted
 *                                load instructions.
 */
public InstructionSequencesReplacer(Constant[]          patternConstants,
                                    Instruction[][][]   instructionSequences,
                                    BranchTargetFinder  branchTargetFinder,
                                    CodeAttributeEditor codeAttributeEditor,
                                    InstructionVisitor extraInstructionVisitor)
{
    super(createInstructionSequenceReplacers(patternConstants,
                                             instructionSequences,
                                             branchTargetFinder,
                                             codeAttributeEditor,
                                             extraInstructionVisitor));
}
 
Example 13
Source Project: java-n-IDE-for-Android   Source File: GotoReturnReplacer.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Creates a new GotoReturnReplacer.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 * @param extraInstructionVisitor an optional extra visitor for all replaced
 *                                goto instructions.
 */
public GotoReturnReplacer(CodeAttributeEditor codeAttributeEditor,
                          InstructionVisitor extraInstructionVisitor)
{
    this.codeAttributeEditor     = codeAttributeEditor;
    this.extraInstructionVisitor = extraInstructionVisitor;
}
 
Example 14
Source Project: java-n-IDE-for-Android   Source File: PeepholeOptimizer.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Creates a new PeepholeOptimizer.
 * @param branchTargetFinder  branch target finder that will be initialized
 *                            to indicate branch targets in the visited code.
 * @param codeAttributeEditor the code attribute editor that will be reset
 *                            and then executed.
 * @param instructionVisitor  the instruction visitor that performs
 *                            peephole optimizations using the above code
 *                            attribute editor.
 */
public PeepholeOptimizer(BranchTargetFinder  branchTargetFinder,
                         CodeAttributeEditor codeAttributeEditor,
                         InstructionVisitor instructionVisitor)
{
    this.branchTargetFinder  = branchTargetFinder;
    this.codeAttributeEditor = codeAttributeEditor;
    this.instructionVisitor  = instructionVisitor;
}
 
Example 15
Source Project: java-n-IDE-for-Android   Source File: GotoGotoReplacer.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Creates a new GotoGotoReplacer.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 * @param extraInstructionVisitor an optional extra visitor for all replaced
 *                                goto instructions.
 */
public GotoGotoReplacer(CodeAttributeEditor codeAttributeEditor,
                        InstructionVisitor extraInstructionVisitor)
{
    this.codeAttributeEditor     = codeAttributeEditor;
    this.extraInstructionVisitor = extraInstructionVisitor;
}
 
Example 16
Source Project: proguard   Source File: NopRemover.java    License: GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates a new NopRemover.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 * @param extraInstructionVisitor an optional extra visitor for all removed
 *                                nop instructions.
 */
public NopRemover(CodeAttributeEditor codeAttributeEditor,
                  InstructionVisitor  extraInstructionVisitor)
{
    this.codeAttributeEditor     = codeAttributeEditor;
    this.extraInstructionVisitor = extraInstructionVisitor;
}
 
Example 17
/**
 * Creates a new InstructionSequencesReplacer.
 * @param patternConstants        any constants referenced by the pattern
 *                                instruction.
 * @param instructionSequences    the instruction sequences to be replaced,
 *                                with subsequently the sequence pair index,
 *                                the patten/replacement index (0 or 1),
 *                                and the instruction index in the sequence.
 * @param branchTargetFinder      a branch target finder that has been
 *                                initialized to indicate branch targets
 *                                in the visited code.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 */
public InstructionSequencesReplacer(Constant[]          patternConstants,
                                    Instruction[][][]   instructionSequences,
                                    BranchTargetFinder  branchTargetFinder,
                                    CodeAttributeEditor codeAttributeEditor)
{
    this(patternConstants,
         instructionSequences,
         branchTargetFinder,
         codeAttributeEditor,
         null);
}
 
Example 18
/**
 * Creates a new InstructionSequenceReplacer.
 * @param patternConstants        any constants referenced by the pattern
 *                                instruction.
 * @param instructionSequences    the instruction sequences to be replaced,
 *                                with subsequently the sequence pair index,
 *                                the patten/replacement index (0 or 1),
 *                                and the instruction index in the sequence.
 * @param branchTargetFinder      a branch target finder that has been
 *                                initialized to indicate branch targets
 *                                in the visited code.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 * @param extraInstructionVisitor an optional extra visitor for all deleted
 *                                load instructions.
 */
public InstructionSequencesReplacer(Constant[]          patternConstants,
                                    Instruction[][][]   instructionSequences,
                                    BranchTargetFinder  branchTargetFinder,
                                    CodeAttributeEditor codeAttributeEditor,
                                    InstructionVisitor  extraInstructionVisitor)
{
    super(createInstructionSequenceReplacers(patternConstants,
                                             instructionSequences,
                                             branchTargetFinder,
                                             codeAttributeEditor,
                                             extraInstructionVisitor));
}
 
Example 19
Source Project: proguard   Source File: GotoReturnReplacer.java    License: GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates a new GotoReturnReplacer.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 * @param extraInstructionVisitor an optional extra visitor for all replaced
 *                                goto instructions.
 */
public GotoReturnReplacer(CodeAttributeEditor codeAttributeEditor,
                          InstructionVisitor  extraInstructionVisitor)
{
    this.codeAttributeEditor     = codeAttributeEditor;
    this.extraInstructionVisitor = extraInstructionVisitor;
}
 
Example 20
Source Project: proguard   Source File: PeepholeOptimizer.java    License: GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates a new PeepholeOptimizer.
 * @param branchTargetFinder  branch target finder that will be initialized
 *                            to indicate branch targets in the visited code.
 * @param codeAttributeEditor the code attribute editor that will be reset
 *                            and then executed.
 * @param instructionVisitor  the instruction visitor that performs
 *                            peephole optimizations using the above code
 *                            attribute editor.
 */
public PeepholeOptimizer(BranchTargetFinder  branchTargetFinder,
                         CodeAttributeEditor codeAttributeEditor,
                         InstructionVisitor  instructionVisitor)
{
    this.branchTargetFinder  = branchTargetFinder;
    this.codeAttributeEditor = codeAttributeEditor;
    this.instructionVisitor  = instructionVisitor;
}
 
Example 21
Source Project: proguard   Source File: GotoGotoReplacer.java    License: GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates a new GotoGotoReplacer.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 * @param extraInstructionVisitor an optional extra visitor for all replaced
 *                                goto instructions.
 */
public GotoGotoReplacer(CodeAttributeEditor codeAttributeEditor,
                        InstructionVisitor  extraInstructionVisitor)
{
    this.codeAttributeEditor     = codeAttributeEditor;
    this.extraInstructionVisitor = extraInstructionVisitor;
}
 
Example 22
Source Project: bazel   Source File: NopRemover.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Creates a new NopRemover.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 * @param extraInstructionVisitor an optional extra visitor for all removed
 *                                nop instructions.
 */
public NopRemover(CodeAttributeEditor codeAttributeEditor,
                  InstructionVisitor  extraInstructionVisitor)
{
    this.codeAttributeEditor     = codeAttributeEditor;
    this.extraInstructionVisitor = extraInstructionVisitor;
}
 
Example 23
Source Project: bazel   Source File: InstructionSequencesReplacer.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Creates a new InstructionSequencesReplacer.
 * @param patternConstants        any constants referenced by the pattern
 *                                instruction.
 * @param instructionSequences    the instruction sequences to be replaced,
 *                                with subsequently the sequence pair index,
 *                                the patten/replacement index (0 or 1),
 *                                and the instruction index in the sequence.
 * @param branchTargetFinder      a branch target finder that has been
 *                                initialized to indicate branch targets
 *                                in the visited code.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 */
public InstructionSequencesReplacer(Constant[]          patternConstants,
                                    Instruction[][][]   instructionSequences,
                                    BranchTargetFinder  branchTargetFinder,
                                    CodeAttributeEditor codeAttributeEditor)
{
    this(patternConstants,
         instructionSequences,
         branchTargetFinder,
         codeAttributeEditor,
         null);
}
 
Example 24
Source Project: bazel   Source File: InstructionSequencesReplacer.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Creates a new InstructionSequenceReplacer.
 * @param patternConstants        any constants referenced by the pattern
 *                                instruction.
 * @param instructionSequences    the instruction sequences to be replaced,
 *                                with subsequently the sequence pair index,
 *                                the patten/replacement index (0 or 1),
 *                                and the instruction index in the sequence.
 * @param branchTargetFinder      a branch target finder that has been
 *                                initialized to indicate branch targets
 *                                in the visited code.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 * @param extraInstructionVisitor an optional extra visitor for all deleted
 *                                load instructions.
 */
public InstructionSequencesReplacer(Constant[]          patternConstants,
                                    Instruction[][][]   instructionSequences,
                                    BranchTargetFinder  branchTargetFinder,
                                    CodeAttributeEditor codeAttributeEditor,
                                    InstructionVisitor  extraInstructionVisitor)
{
    super(createInstructionSequenceReplacers(patternConstants,
                                             instructionSequences,
                                             branchTargetFinder,
                                             codeAttributeEditor,
                                             extraInstructionVisitor));
}
 
Example 25
Source Project: bazel   Source File: GotoReturnReplacer.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Creates a new GotoReturnReplacer.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 * @param extraInstructionVisitor an optional extra visitor for all replaced
 *                                goto instructions.
 */
public GotoReturnReplacer(CodeAttributeEditor codeAttributeEditor,
                          InstructionVisitor  extraInstructionVisitor)
{
    this.codeAttributeEditor     = codeAttributeEditor;
    this.extraInstructionVisitor = extraInstructionVisitor;
}
 
Example 26
Source Project: bazel   Source File: PeepholeOptimizer.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Creates a new PeepholeOptimizer.
 * @param branchTargetFinder  branch target finder that will be initialized
 *                            to indicate branch targets in the visited code.
 * @param codeAttributeEditor the code attribute editor that will be reset
 *                            and then executed.
 * @param instructionVisitor  the instruction visitor that performs
 *                            peephole optimizations using the above code
 *                            attribute editor.
 */
public PeepholeOptimizer(BranchTargetFinder  branchTargetFinder,
                         CodeAttributeEditor codeAttributeEditor,
                         InstructionVisitor  instructionVisitor)
{
    this.branchTargetFinder  = branchTargetFinder;
    this.codeAttributeEditor = codeAttributeEditor;
    this.instructionVisitor  = instructionVisitor;
}
 
Example 27
Source Project: bazel   Source File: GotoGotoReplacer.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Creates a new GotoGotoReplacer.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 * @param extraInstructionVisitor an optional extra visitor for all replaced
 *                                goto instructions.
 */
public GotoGotoReplacer(CodeAttributeEditor codeAttributeEditor,
                        InstructionVisitor  extraInstructionVisitor)
{
    this.codeAttributeEditor     = codeAttributeEditor;
    this.extraInstructionVisitor = extraInstructionVisitor;
}
 
Example 28
Source Project: proguard   Source File: NopRemover.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new NopRemover.
 * @param codeAttributeEditor a code editor that can be used for
 *                            accumulating changes to the code.
 */
public NopRemover(CodeAttributeEditor codeAttributeEditor)
{
    this(codeAttributeEditor, null);
}
 
Example 29
Source Project: proguard   Source File: GotoReturnReplacer.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new GotoReturnReplacer.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 */
public GotoReturnReplacer(CodeAttributeEditor codeAttributeEditor)
{
    this(codeAttributeEditor, null);
}
 
Example 30
Source Project: proguard   Source File: GotoGotoReplacer.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new GotoGotoReplacer.
 * @param codeAttributeEditor     a code editor that can be used for
 *                                accumulating changes to the code.
 */
public GotoGotoReplacer(CodeAttributeEditor codeAttributeEditor)
{
    this(codeAttributeEditor, null);
}