Class SuperBlock


  • final class SuperBlock
    extends java.lang.Object
    A super block is defined as a contiguous chunk of code with a single entry point and multiple exit points (therefore ending in an unconditional jump or the end of the method). This is used to emulate OpenJDK's compiler, which outputs stack map frames at the start of every super block except the method start.
    • Constructor Summary

      Constructors 
      Constructor Description
      SuperBlock​(int index, int start, int end, int[] initialLocals)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) int getEnd()  
      (package private) int getIndex()  
      (package private) int[] getLocals()  
      (package private) int[] getStack()  
      (package private) int getStart()  
      (package private) int[] getTrimmedLocals()
      Get a copy of the super block's locals without any trailing TOP types.
      (package private) boolean isInitialized()  
      (package private) boolean isInQueue()  
      (package private) boolean merge​(int[] locals, int localsTop, int[] stack, int stackTop, ConstantPool pool)  
      private static boolean mergeState​(int[] current, int[] incoming, int size, ConstantPool pool)
      Merge an operand stack or local variable array with incoming state.
      (package private) void setInitialized​(boolean b)  
      (package private) void setInQueue​(boolean b)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • index

        private int index
      • start

        private int start
      • end

        private int end
      • locals

        private int[] locals
      • stack

        private int[] stack
      • isInitialized

        private boolean isInitialized
      • isInQueue

        private boolean isInQueue
    • Constructor Detail

      • SuperBlock

        SuperBlock​(int index,
                   int start,
                   int end,
                   int[] initialLocals)
    • Method Detail

      • getIndex

        int getIndex()
      • getLocals

        int[] getLocals()
      • getTrimmedLocals

        int[] getTrimmedLocals()
        Get a copy of the super block's locals without any trailing TOP types.

        This is useful for actual writing stack maps; during the computation of stack map types, all local arrays have the same size; the max locals for the method. In addition, DOUBLE and LONG types have trailing TOP types because they occupy two words. For writing purposes, these are not useful.

      • getStack

        int[] getStack()
      • merge

        boolean merge​(int[] locals,
                      int localsTop,
                      int[] stack,
                      int stackTop,
                      ConstantPool pool)
      • mergeState

        private static boolean mergeState​(int[] current,
                                          int[] incoming,
                                          int size,
                                          ConstantPool pool)
        Merge an operand stack or local variable array with incoming state.

        They are treated the same way; by this point, it should already be ensured that the array sizes are the same, which is the only additional constraint that is imposed on merging operand stacks (the local variable array is always the same size).

      • getStart

        int getStart()
      • getEnd

        int getEnd()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • isInitialized

        boolean isInitialized()
      • setInitialized

        void setInitialized​(boolean b)
      • isInQueue

        boolean isInQueue()
      • setInQueue

        void setInQueue​(boolean b)