Class TypeInfo


  • final class TypeInfo
    extends java.lang.Object
    Helper class for internal representations of type information. In most cases, type information can be represented by a constant, but in some cases, a payload is included. Despite the payload coming after the type tag in the output, we store it in bits 8-23 for uniformity; the tag is always in bits 0-7.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static int DOUBLE  
      (package private) static int FLOAT  
      (package private) static int INTEGER  
      (package private) static int LONG  
      (package private) static int NULL  
      (package private) static int OBJECT_TAG  
      (package private) static int TOP  
      (package private) static int UNINITIALIZED_THIS  
      (package private) static int UNINITIALIZED_VAR_TAG  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private TypeInfo()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static int fromType​(java.lang.String type, ConstantPool pool)
      Create type information from an internal type.
      private static java.lang.Class<?> getClassFromInternalName​(java.lang.String internalName)
      Take an internal name and return a java.lang.Class instance that represents it.
      (package private) static int getPayload​(int typeInfo)  
      (package private) static java.lang.String getPayloadAsType​(int typeInfo, ConstantPool pool)
      Treat the result of getPayload as a constant pool index and fetch the corresponding String mapped to it.
      (package private) static int getTag​(int typeInfo)  
      (package private) static boolean isTwoWords​(int type)  
      (package private) static int merge​(int current, int incoming, ConstantPool pool)
      Merge two verification types.
      (package private) static int OBJECT​(int constantPoolIndex)  
      (package private) static int OBJECT​(java.lang.String type, ConstantPool pool)  
      (package private) static void print​(int[] locals, int[] stack, ConstantPool pool)  
      (package private) static void print​(int[] locals, int localsTop, int[] stack, int stackTop, ConstantPool pool)  
      private static java.lang.String toString​(int[] types, int typesTop, ConstantPool pool)  
      (package private) static java.lang.String toString​(int type, ConstantPool pool)  
      (package private) static int UNINITIALIZED_VARIABLE​(int bytecodeOffset)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TypeInfo

        private TypeInfo()
    • Method Detail

      • OBJECT

        static final int OBJECT​(int constantPoolIndex)
      • OBJECT

        static final int OBJECT​(java.lang.String type,
                                ConstantPool pool)
      • UNINITIALIZED_VARIABLE

        static final int UNINITIALIZED_VARIABLE​(int bytecodeOffset)
      • getTag

        static final int getTag​(int typeInfo)
      • getPayload

        static final int getPayload​(int typeInfo)
      • getPayloadAsType

        static final java.lang.String getPayloadAsType​(int typeInfo,
                                                       ConstantPool pool)
        Treat the result of getPayload as a constant pool index and fetch the corresponding String mapped to it. Only works on OBJECT types.
      • fromType

        static final int fromType​(java.lang.String type,
                                  ConstantPool pool)
        Create type information from an internal type.
      • isTwoWords

        static boolean isTwoWords​(int type)
      • merge

        static int merge​(int current,
                         int incoming,
                         ConstantPool pool)
        Merge two verification types. In most cases, the verification types must be the same. For example, INTEGER and DOUBLE cannot be merged and an exception will be thrown. The basic rules are: - If the types are equal, simply return one. - If either type is TOP, return TOP. - If either type is NULL, return the other type. - If both types are objects, find the lowest common ancestor in the class hierarchy. This method uses reflection to traverse the class hierarchy. Therefore, it is assumed that the current class being generated is never the target of a full object-object merge, which would need to load the current class reflectively.
      • toString

        static java.lang.String toString​(int type,
                                         ConstantPool pool)
      • getClassFromInternalName

        private static java.lang.Class<?> getClassFromInternalName​(java.lang.String internalName)
        Take an internal name and return a java.lang.Class instance that represents it. For example, given "java/lang/Object", returns the equivalent of Class.forName("java.lang.Object"), but also handles exceptions.
      • toString

        private static java.lang.String toString​(int[] types,
                                                 int typesTop,
                                                 ConstantPool pool)
      • print

        static void print​(int[] locals,
                          int[] stack,
                          ConstantPool pool)
      • print

        static void print​(int[] locals,
                          int localsTop,
                          int[] stack,
                          int stackTop,
                          ConstantPool pool)