Package org.vesalainen.bcc
Class ByteCodeVerifier
- java.lang.Object
-
- org.vesalainen.bcc.OpCodeUtil
-
- org.vesalainen.bcc.ByteCodeVerifier
-
- All Implemented Interfaces:
OpCode
public class ByteCodeVerifier extends OpCodeUtil
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classByteCodeVerifier.Contextprivate classByteCodeVerifier.OperandStack
-
Field Summary
Fields Modifier and Type Field Description private java.util.Deque<ByteCodeVerifier.Context>branchprivate ClassFilecfprivate byte[]codeprivate boolean[]coverageprivate ExceptionTable[]exceptionTableprivate java.util.Set<java.lang.Integer>goneThroughprivate CodeDataInputinprivate java.util.Map<java.lang.Integer,javax.lang.model.type.TypeMirror[]>lvAtprivate javax.lang.model.type.TypeMirror[]lvTypeprivate intmaxLocalprivate intmaxStackprivate MethodCompilermcprivate intopCodePositionprivate static javax.lang.model.type.TypeMirrorreturnAddressprivate java.util.Map<java.lang.Integer,java.util.Deque<javax.lang.model.type.TypeMirror>>stackAt-
Fields inherited from interface org.vesalainen.bcc.OpCode
AALOAD, AASTORE, ACONST_NULL, ALOAD, ALOAD_0, ALOAD_1, ALOAD_2, ALOAD_3, ANEWARRAY, ARETURN, ARRAYLENGTH, ASTORE, ASTORE_0, ASTORE_1, ASTORE_2, ASTORE_3, ATHROW, BALOAD, BASTORE, BIPUSH, BREAKPOINT, CALOAD, CASTORE, CHECKCAST, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST_0, DCONST_1, DDIV, DLOAD, DLOAD_0, DLOAD_1, DLOAD_2, DLOAD_3, DMUL, DNEG, DRETURN, DSTORE, DSTORE_0, DSTORE_1, DSTORE_2, DSTORE_3, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST_0, FCONST_1, FCONST_2, FDIV, FLOAD, FLOAD_0, FLOAD_1, FLOAD_2, FLOAD_3, FMUL, FNEG, FREM, FRETURN, FSTORE, FSTORE_0, FSTORE_1, FSTORE_2, FSTORE_3, FSUB, GETFIELD, GETSTATIC, GOTO, GOTO_W, 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, ILOAD_0, ILOAD_1, ILOAD_2, ILOAD_3, IMPDEP1, IMPDEP2, IMUL, INEG, INSTANCEOF, INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC, INVOKEVIRTUAL, IOR, IREM, IRETURN, ISHL, ISHR, ISTORE, ISTORE_0, ISTORE_1, ISTORE_2, ISTORE_3, ISUB, IUSHR, IXOR, JSR, JSR_W, L2D, L2F, L2I, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST_0, LCONST_1, LDC, LDC_W, LDC2_W, LDIV, LLOAD, LLOAD_0, LLOAD_1, LLOAD_2, LLOAD_3, LMUL, LNEG, LOOKUPSWITCH, LOR, LREM, LRETURN, LSHL, LSHR, LSTORE, LSTORE_0, LSTORE_1, LSTORE_2, LSTORE_3, LSUB, LUSHR, LXOR, MONITORENTER, MONITOREXIT, MULTIANEWARRAY, NEW, NEWARRAY, NOP, NOT_IF_ACMPEQ, NOT_IF_ACMPNE, NOT_IF_ICMPEQ, NOT_IF_ICMPGE, NOT_IF_ICMPGT, NOT_IF_ICMPLE, NOT_IF_ICMPLT, NOT_IF_ICMPNE, NOT_IFEQ, NOT_IFGE, NOT_IFGT, NOT_IFLE, NOT_IFLT, NOT_IFNE, NOT_IFNONNULL, NOT_IFNULL, POP, POP2, PUTFIELD, PUTSTATIC, RET, RETURN, SALOAD, SASTORE, SIPUSH, SWAP, TABLESWITCH, WIDE
-
-
Constructor Summary
Constructors Constructor Description ByteCodeVerifier(byte[] code, ExceptionTable[] exceptionTable, ClassFile classFile, MethodCompiler mc)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidbranch(int pc, int offset, ByteCodeVerifier.OperandStack s, javax.lang.model.type.TypeMirror[] lv)private booleanc1(javax.lang.model.type.TypeMirror cls)private booleanc2(javax.lang.model.type.TypeMirror cls)private booleancompare(javax.lang.model.type.TypeMirror[] lvBefore, javax.lang.model.type.TypeMirror[] lvNow)private javax.lang.model.element.ExecutableElementgetIndexedExecutable(int i)private javax.lang.model.type.TypeMirrorgetIndexedType(int i)private javax.lang.model.element.VariableElementgetIndexedVariable(int i)private javax.lang.model.type.TypeMirrorgetLocalType(int index)intgetMaxStack()private intrun(ByteCodeVerifier.Context ctx)voidverify()private voidverify(javax.lang.model.type.TypeMirror assignee, javax.lang.model.type.TypeMirror assignable)private voidverify1(javax.lang.model.type.TypeMirror cls)private voidverify2(javax.lang.model.type.TypeMirror cls)private voidverifyByteOrBoolean(javax.lang.model.type.TypeMirror cw)private voidverifyByteOrBooleanArray(javax.lang.model.type.TypeMirror cw)private voidverifyClass(javax.lang.model.type.TypeMirror objectRef, javax.lang.model.element.ExecutableElement method)private voidverifyInterfaceClass(javax.lang.model.type.TypeMirror objectRef, javax.lang.model.element.ExecutableElement method)private voidverifyLocalType(int index, javax.lang.model.type.TypeMirror cls)static voidverifyMethod(java.util.Deque<javax.lang.model.type.TypeMirror> stack, javax.lang.model.element.ExecutableElement method)private voidverifyReferenceOrArray(javax.lang.model.type.TypeMirror cw)private voidverifyVirtualClass(javax.lang.model.type.TypeMirror objectRef, javax.lang.model.element.ExecutableElement method)-
Methods inherited from class org.vesalainen.bcc.OpCodeUtil
string
-
-
-
-
Field Detail
-
returnAddress
private static final javax.lang.model.type.TypeMirror returnAddress
-
cf
private ClassFile cf
-
branch
private java.util.Deque<ByteCodeVerifier.Context> branch
-
in
private CodeDataInput in
-
opCodePosition
private int opCodePosition
-
goneThrough
private java.util.Set<java.lang.Integer> goneThrough
-
stackAt
private java.util.Map<java.lang.Integer,java.util.Deque<javax.lang.model.type.TypeMirror>> stackAt
-
lvAt
private java.util.Map<java.lang.Integer,javax.lang.model.type.TypeMirror[]> lvAt
-
maxLocal
private int maxLocal
-
maxStack
private int maxStack
-
code
private byte[] code
-
exceptionTable
private ExceptionTable[] exceptionTable
-
mc
private MethodCompiler mc
-
coverage
private boolean[] coverage
-
lvType
private javax.lang.model.type.TypeMirror[] lvType
-
-
Constructor Detail
-
ByteCodeVerifier
public ByteCodeVerifier(byte[] code, ExceptionTable[] exceptionTable, ClassFile classFile, MethodCompiler mc)
-
-
Method Detail
-
verify
public void verify() throws java.io.IOException- Throws:
java.io.IOException
-
branch
private void branch(int pc, int offset, ByteCodeVerifier.OperandStack s, javax.lang.model.type.TypeMirror[] lv)
-
compare
private boolean compare(javax.lang.model.type.TypeMirror[] lvBefore, javax.lang.model.type.TypeMirror[] lvNow)
-
run
private int run(ByteCodeVerifier.Context ctx) throws java.io.IOException, java.lang.ClassNotFoundException
- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
verify
private void verify(javax.lang.model.type.TypeMirror assignee, javax.lang.model.type.TypeMirror assignable)
-
verify1
private void verify1(javax.lang.model.type.TypeMirror cls)
-
verify2
private void verify2(javax.lang.model.type.TypeMirror cls)
-
c1
private boolean c1(javax.lang.model.type.TypeMirror cls)
-
c2
private boolean c2(javax.lang.model.type.TypeMirror cls)
-
getMaxStack
public int getMaxStack()
-
getLocalType
private javax.lang.model.type.TypeMirror getLocalType(int index)
-
verifyLocalType
private void verifyLocalType(int index, javax.lang.model.type.TypeMirror cls)
-
verifyClass
private void verifyClass(javax.lang.model.type.TypeMirror objectRef, javax.lang.model.element.ExecutableElement method)
-
verifyVirtualClass
private void verifyVirtualClass(javax.lang.model.type.TypeMirror objectRef, javax.lang.model.element.ExecutableElement method)
-
verifyInterfaceClass
private void verifyInterfaceClass(javax.lang.model.type.TypeMirror objectRef, javax.lang.model.element.ExecutableElement method)
-
verifyReferenceOrArray
private void verifyReferenceOrArray(javax.lang.model.type.TypeMirror cw)
-
verifyByteOrBoolean
private void verifyByteOrBoolean(javax.lang.model.type.TypeMirror cw)
-
verifyByteOrBooleanArray
private void verifyByteOrBooleanArray(javax.lang.model.type.TypeMirror cw)
-
getIndexedVariable
private javax.lang.model.element.VariableElement getIndexedVariable(int i)
-
getIndexedExecutable
private javax.lang.model.element.ExecutableElement getIndexedExecutable(int i)
-
getIndexedType
private javax.lang.model.type.TypeMirror getIndexedType(int i)
-
verifyMethod
public static void verifyMethod(java.util.Deque<javax.lang.model.type.TypeMirror> stack, javax.lang.model.element.ExecutableElement method) throws java.lang.ClassNotFoundException- Throws:
java.lang.ClassNotFoundException
-
-