proguard.optimize.peephole
Class InstructionSequencesReplacer

java.lang.Object
  extended by proguard.classfile.instruction.visitor.MultiInstructionVisitor
      extended by proguard.optimize.peephole.InstructionSequencesReplacer
All Implemented Interfaces:
InstructionVisitor

public class InstructionSequencesReplacer
extends MultiInstructionVisitor
implements InstructionVisitor

This InstructionVisitor replaces multiple instruction sequences at once.

See Also:
InstructionSequenceReplacer

Constructor Summary
InstructionSequencesReplacer(Constant[] patternConstants, Instruction[][][] instructionSequences, BranchTargetFinder branchTargetFinder, CodeAttributeEditor codeAttributeEditor)
          Creates a new InstructionSequencesReplacer.
InstructionSequencesReplacer(Constant[] patternConstants, Instruction[][][] instructionSequences, BranchTargetFinder branchTargetFinder, CodeAttributeEditor codeAttributeEditor, InstructionVisitor extraInstructionVisitor)
          Creates a new InstructionSequenceReplacer.
 
Method Summary
 
Methods inherited from class proguard.classfile.instruction.visitor.MultiInstructionVisitor
addInstructionVisitor, visitBranchInstruction, visitConstantInstruction, visitLookUpSwitchInstruction, visitSimpleInstruction, visitTableSwitchInstruction, visitVariableInstruction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface proguard.classfile.instruction.visitor.InstructionVisitor
visitBranchInstruction, visitConstantInstruction, visitLookUpSwitchInstruction, visitSimpleInstruction, visitTableSwitchInstruction, visitVariableInstruction
 

Constructor Detail

InstructionSequencesReplacer

public InstructionSequencesReplacer(Constant[] patternConstants,
                                    Instruction[][][] instructionSequences,
                                    BranchTargetFinder branchTargetFinder,
                                    CodeAttributeEditor codeAttributeEditor)
Creates a new InstructionSequencesReplacer.

Parameters:
patternConstants - any constants referenced by the pattern instruction.
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.
branchTargetFinder - a branch target finder that has been initialized to indicate branch targets in the visited code.
codeAttributeEditor - a code editor that can be used for accumulating changes to the code.

InstructionSequencesReplacer

public InstructionSequencesReplacer(Constant[] patternConstants,
                                    Instruction[][][] instructionSequences,
                                    BranchTargetFinder branchTargetFinder,
                                    CodeAttributeEditor codeAttributeEditor,
                                    InstructionVisitor extraInstructionVisitor)
Creates a new InstructionSequenceReplacer.

Parameters:
patternConstants - any constants referenced by the pattern instruction.
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.
branchTargetFinder - a branch target finder that has been initialized to indicate branch targets in the visited code.
codeAttributeEditor - a code editor that can be used for accumulating changes to the code.
extraInstructionVisitor - an optional extra visitor for all deleted load instructions.