final class PrimitiveInfo extends ClassInfo
boolean has
java/lang/Boolean). Information about the wrapper type is
recorded in this class to allow auto-boxing code to be assembled, which
enables, for instance:
InvocationHandler.invoke;
Object return value from
InvocationHandler.invoke to be cast into the appropriate
object wrapper type, and then unwrapped to the corresponding primitive
value.
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
castName
Internal class name (of wrapper) used with CHECKCAST instruction
|
private java.lang.String |
descriptor
Internal data type descriptor
|
private int |
loadInsn
Load instruction
|
private int |
returnInsn
Return instruction
|
private MethodInfo |
unwrapInfo
Information for unwrapper method
|
private int |
width
Width of data type in stack or local variable slots
|
private MethodInfo |
wrapInfo
Information for wrapper method
|
AALOAD, AASTORE, ACC_ABSTRACT, ACC_ANNOTATION, ACC_BRIDGE, ACC_DEPRECATED, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_MANDATED, ACC_MODULE, ACC_NATIVE, ACC_OPEN, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_RECORD, ACC_STATIC, ACC_STATIC_PHASE, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_TRANSITIVE, ACC_VARARGS, ACC_VOLATILE, ACONST_NULL, ALOAD, ANEWARRAY, ARETURN, ARRAYLENGTH, ASM10_EXPERIMENTAL, ASM4, ASM5, ASM6, ASM7, ASM8, ASM9, ASTORE, ATHROW, BALOAD, BASTORE, BIPUSH, CALOAD, CASTORE, CHECKCAST, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST_0, DCONST_1, DDIV, DLOAD, DMUL, DNEG, DOUBLE, DREM, DRETURN, DSTORE, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, F_APPEND, F_CHOP, F_FULL, F_NEW, F_SAME, F_SAME1, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST_0, FCONST_1, FCONST_2, FDIV, FLOAD, FLOAT, FMUL, FNEG, FREM, FRETURN, FSTORE, FSUB, GETFIELD, GETSTATIC, GOTO, H_GETFIELD, H_GETSTATIC, H_INVOKEINTERFACE, H_INVOKESPECIAL, H_INVOKESTATIC, H_INVOKEVIRTUAL, H_NEWINVOKESPECIAL, H_PUTFIELD, H_PUTSTATIC, I2B, I2C, I2D, I2F, I2L, I2S, IADD, IALOAD, IAND, IASTORE, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, ICONST_M1, IDIV, IF_ACMPEQ, IF_ACMPNE, IF_ICMPEQ, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ICMPLT, IF_ICMPNE, IFEQ, IFGE, IFGT, IFLE, IFLT, IFNE, IFNONNULL, IFNULL, IINC, ILOAD, IMUL, INEG, INSTANCEOF, INTEGER, INVOKEDYNAMIC, INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC, INVOKEVIRTUAL, IOR, IREM, IRETURN, ISHL, ISHR, ISTORE, ISUB, IUSHR, IXOR, JSR, L2D, L2F, L2I, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST_0, LCONST_1, LDC, LDIV, LLOAD, LMUL, LNEG, LONG, LOOKUPSWITCH, LOR, LREM, LRETURN, LSHL, LSHR, LSTORE, LSUB, LUSHR, LXOR, MONITORENTER, MONITOREXIT, MULTIANEWARRAY, NEW, NEWARRAY, NOP, NULL, POP, POP2, PUTFIELD, PUTSTATIC, RET, RETURN, SALOAD, SASTORE, SIPUSH, SOURCE_DEPRECATED, SOURCE_MASK, SWAP, T_BOOLEAN, T_BYTE, T_CHAR, T_DOUBLE, T_FLOAT, T_INT, T_LONG, T_SHORT, TABLESWITCH, TOP, UNINITIALIZED_THIS, V_PREVIEW, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V10, V11, V12, V13, V14, V15, V16, V17, V18, V19, V20, V21, V22, V9| Constructor and Description |
|---|
PrimitiveInfo(java.lang.Class<?> type,
java.lang.Class<?> wrapper,
java.lang.String descriptor,
int width,
int loadInsn,
int returnInsn)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getCastName()
Get the internal name of the class which should be used with a CHECKCAST
instruction when casting an
Object returned from a call to
InvocationHandler.invoke to an instance of this data type. |
java.lang.String |
getDescriptor()
Get the descriptor which is used internally within the JVM to represent
this data type.
|
int |
getLoadInsn()
Get the ASM constant representing the instruction used to load an
instance of this data type from a local variable and push it onto the
operand stack (e.g., DLOAD, ILOAD, etc.).
|
int |
getReturnInsn()
Get the ASM constant representing the instruction used to pop an
instance of this data type from the operand stack and return it from a
method (e.g., DRETURN, IRETURN, etc.).
|
MethodInfo |
getUnwrapInfo()
Get information for the method, if any, used to unwrap instances of this
data type from a J2SE data wrapper object.
|
int |
getWidth()
Get the width, in stack or local variable slots for instances of this
data type, when compiling bytecode instructions which manipulate such
data.
|
MethodInfo |
getWrapInfo()
Get information for the method, if any, used to wrap instances of this
data type in a J2SE data wrapper object.
|
private static MethodInfo |
makeUnwrapInfo(java.lang.String typeName,
TypeInfo wrapperInfo,
java.lang.String typeDescriptor)
Generate the information for the data unwrapper method, given the
primitive type name, wrapper type information, and primitive type
descriptor.
|
private static MethodInfo |
makeWrapInfo(TypeInfo wrapperInfo,
java.lang.String typeDescriptor)
Generate the information for the data wrapper method, given the wrapper
type information and the primitive type descriptor.
|
private final java.lang.String castName
private final java.lang.String descriptor
private final MethodInfo wrapInfo
private final MethodInfo unwrapInfo
private final int width
private final int loadInsn
private final int returnInsn
PrimitiveInfo(java.lang.Class<?> type,
java.lang.Class<?> wrapper,
java.lang.String descriptor,
int width,
int loadInsn,
int returnInsn)
type - Class representing primitive data type.wrapper - Class representing J2SE object wrapper data type.descriptor - Internal data type descriptor.width - Width of data type in stack or local variable slots.loadInsn - Load instruction.returnInsn - Return instruction.private static MethodInfo makeWrapInfo(TypeInfo wrapperInfo, java.lang.String typeDescriptor)
wrapperInfo - Type information for object wrapper.typeDescriptor - Internal type descriptor of primitive data type.private static MethodInfo makeUnwrapInfo(java.lang.String typeName, TypeInfo wrapperInfo, java.lang.String typeDescriptor)
typeName - External name of primitive data type (e.g., "boolean").wrapperInfo - Type information for object wrapper.typeDescriptor - Internal type descriptor of primitive data type.public java.lang.String getDescriptor()
getDescriptor in interface TypeInfogetDescriptor in class ClassInfopublic java.lang.String getCastName()
Object returned from a call to
InvocationHandler.invoke to an instance of this data type.
For primitive data types, this is the internal name of the wrapper data type (e.g., "java/lang/Boolean").
getCastName in interface TypeInfogetCastName in class ClassInfonull for the void return type.public MethodInfo getWrapInfo()
getWrapInfo in interface TypeInfogetWrapInfo in class ClassInfonull
for the void data type.public MethodInfo getUnwrapInfo()
getUnwrapInfo in interface TypeInfogetUnwrapInfo in class ClassInfonull for the void data type.public int getWidth()
long and double
types, and 1 for all others.public int getLoadInsn()
getLoadInsn in interface TypeInfogetLoadInsn in class ClassInfopublic int getReturnInsn()
Note: the RETURN instruction (used for return type void)
does not pop an operand off the stack; it simply returns.
getReturnInsn in interface TypeInfogetReturnInsn in class ClassInfo