Class Peephole

  • All Implemented Interfaces:
    Opcode

    public class Peephole
    extends java.lang.Object
    implements Opcode
    Performs some peephole optimizations such as loads and stores and removes unreachable instructions.
    • Field Detail

      • DEBUG

        public static boolean DEBUG
    • Constructor Detail

      • Peephole

        public Peephole()
    • Method Detail

      • transform

        public static void transform​(MethodEditor method)
        Perform peephole optimizations on the bytecodes in a method. Peephole optimizations look at two consecutive instructions and try to perform some simple optimization. For instance, a push followed by a pop is uninteresting, so both of those instructions can be removed.

        After the peephole optimizations are performed a final phase removes instructions that are not reachable. These instructions reside in basic blocks whose starting label is never jumped to.