Class PeepholeEditor

  • All Implemented Interfaces:
    AttributeVisitor

    public class PeepholeEditor
    extends java.lang.Object
    implements AttributeVisitor
    This AttributeVisitor lets a given instruction visitor edit the code attributes that it visits. The instruction visitor can use a given (optional) branch target finder and code attribute editor, which this class sets up and applies, for convenience.
    • Constructor Detail

      • PeepholeEditor

        public PeepholeEditor​(CodeAttributeEditor codeAttributeEditor,
                              InstructionVisitor instructionVisitor)
        Creates a new PeepholeEditor.
        Parameters:
        codeAttributeEditor - the code attribute editor that will be reset and then executed.
        instructionVisitor - the instruction visitor that performs peephole optimizations using the above code attribute editor.
      • PeepholeEditor

        public PeepholeEditor​(BranchTargetFinder branchTargetFinder,
                              CodeAttributeEditor codeAttributeEditor,
                              InstructionVisitor instructionVisitor)
        Creates a new PeepholeEditor.
        Parameters:
        branchTargetFinder - branch target finder that will be initialized to indicate branch targets in the visited code.
        codeAttributeEditor - the code attribute editor that will be reset and then executed.
        instructionVisitor - the instruction visitor that performs peephole optimizations using the above code attribute editor.