📄 verifier.c
字号:
} else { /* LDC or LDC_W */ if (tag == CONSTANT_String) { Vfy_push(Vfy_getStringVerifierType()); break; } if (tag == CONSTANT_Integer) { Vfy_push(ITEM_Integer); break; }#if IMPLEMENTS_FLOAT if (tag == CONSTANT_Float) { Vfy_push(ITEM_Float); break; }#endif } Vfy_throw(VE_BAD_LDC); } case ILOAD_0: case ILOAD_1: case ILOAD_2: case ILOAD_3: case ILOAD: { SLOTINDEX index; if (opcode == ILOAD) { index = Vfy_getUByte(ip + 1); ip += 2; } else { index = opcode - ILOAD_0; ip++; } Vfy_getLocal(index, ITEM_Integer); Vfy_push(ITEM_Integer); break; } case LLOAD_0: case LLOAD_1: case LLOAD_2: case LLOAD_3: case LLOAD: { SLOTINDEX index; if (opcode == LLOAD) { index = Vfy_getUByte(ip + 1); ip += 2; } else { index = opcode - LLOAD_0; ip++; } Vfy_getLocal(index, ITEM_Long); Vfy_getLocal(index + 1, ITEM_Long_2); Vfy_push(ITEM_Long); Vfy_push(ITEM_Long_2); break; }#if IMPLEMENTS_FLOAT case FLOAD_0: case FLOAD_1: case FLOAD_2: case FLOAD_3: case FLOAD: { SLOTINDEX index; if (opcode == FLOAD) { index = Vfy_getUByte(ip + 1); ip += 2; } else { index = opcode - FLOAD_0; ip++; } Vfy_getLocal(index, ITEM_Float); Vfy_push(ITEM_Float); break; } case DLOAD_0: case DLOAD_1: case DLOAD_2: case DLOAD_3: case DLOAD: { SLOTINDEX index; if (opcode == DLOAD) { index = Vfy_getUByte(ip + 1); ip += 2; } else { index = opcode - DLOAD_0; ip++; } Vfy_getLocal(index, ITEM_Double); Vfy_getLocal(index + 1, ITEM_Double_2); Vfy_push(ITEM_Double); Vfy_push(ITEM_Double_2); break; }#endif /* IMPLEMENTS_FLOAT */ case ALOAD_0: case ALOAD_1: case ALOAD_2: case ALOAD_3: case ALOAD: { SLOTINDEX index; VERIFIERTYPE refType; if (opcode == ALOAD) { index = Vfy_getUByte(ip + 1); ip += 2; } else { index = opcode - ALOAD_0; ip++; } refType = Vfy_getLocal(index, ITEM_Reference); Vfy_push(refType); break; } case IALOAD: { Vfy_pop(ITEM_Integer); Vfy_pop(Vfy_getIntArrayVerifierType()); Vfy_push(ITEM_Integer); ip++; break; } case BALOAD: { VERIFIERTYPE dummy = Vfy_pop(ITEM_Integer); VERIFIERTYPE arrayType = Vfy_pop(Vfy_getObjectVerifierType()); if (arrayType != Vfy_getByteArrayVerifierType() && arrayType != Vfy_getBooleanArrayVerifierType() && arrayType != ITEM_Null) { Vfy_throw(VE_BALOAD_BAD_TYPE); } Vfy_push(ITEM_Integer); ip++; (void)dummy; break; } case CALOAD: { Vfy_pop(ITEM_Integer); Vfy_pop(Vfy_getCharArrayVerifierType()); Vfy_push(ITEM_Integer); ip++; break; } case SALOAD: { Vfy_pop(ITEM_Integer); Vfy_pop(Vfy_getShortArrayVerifierType()); Vfy_push(ITEM_Integer); ip++; break; } case LALOAD: { Vfy_pop(ITEM_Integer); Vfy_pop(Vfy_getLongArrayVerifierType()); Vfy_push(ITEM_Long); Vfy_push(ITEM_Long_2); ip++; break; }#if IMPLEMENTS_FLOAT case FALOAD: { Vfy_pop(ITEM_Integer); Vfy_pop(Vfy_getFloatArrayVerifierType()); Vfy_push(ITEM_Float); ip++; break; } case DALOAD: { Vfy_pop(ITEM_Integer); Vfy_pop(Vfy_getDoubleArrayVerifierType()); Vfy_push(ITEM_Double); Vfy_push(ITEM_Double_2); ip++; break; }#endif /* IMPLEMENTS_FLOAT */ case AALOAD: { VERIFIERTYPE dummy = Vfy_pop(ITEM_Integer); VERIFIERTYPE arrayType = Vfy_pop(Vfy_getObjectVerifierType()); VERIFIERTYPE arrayElementType; if (!Vfy_isAssignable(arrayType, Vfy_getObjectArrayVerifierType())) { Vfy_throw(VE_AALOAD_BAD_TYPE); }/* Alternative implementation: VERIFIERTYPE dummy = Vfy_pop(ITEM_Integer); VERIFIERTYPE arrayType = Vfy_pop(Vfy_getObjectArrayVerifierType()); VERIFIERTYPE arrayElementType;*/ arrayElementType = Vfy_getReferenceArrayElementType(arrayType); Vfy_push(arrayElementType); ip++; (void)dummy; break; } case ISTORE_0: case ISTORE_1: case ISTORE_2: case ISTORE_3: case ISTORE: { SLOTINDEX index; if (opcode == ISTORE) { index = Vfy_getUByte(ip + 1); ip += 2; } else { index = opcode - ISTORE_0; ip++; } Vfy_pop(ITEM_Integer); Vfy_setLocal(index, ITEM_Integer); break; } case LSTORE_0: case LSTORE_1: case LSTORE_2: case LSTORE_3: case LSTORE: { SLOTINDEX index; if (opcode == LSTORE) { index = Vfy_getUByte(ip + 1); ip += 2; } else { index = opcode - LSTORE_0; ip++; } Vfy_pop(ITEM_Long_2); Vfy_pop(ITEM_Long); Vfy_setLocal(index + 1, ITEM_Long_2); Vfy_setLocal(index, ITEM_Long); break; }#if IMPLEMENTS_FLOAT case FSTORE_0: case FSTORE_1: case FSTORE_2: case FSTORE_3: case FSTORE: { SLOTINDEX index; if (opcode == FSTORE) { index = Vfy_getUByte(ip + 1); ip += 2; } else { index = opcode - FSTORE_0; ip++; } Vfy_pop(ITEM_Float); Vfy_setLocal(index, ITEM_Float); break; } case DSTORE_0: case DSTORE_1: case DSTORE_2: case DSTORE_3: case DSTORE: { SLOTINDEX index; if (opcode == DSTORE) { index = Vfy_getUByte(ip + 1); ip += 2; } else { index = opcode - DSTORE_0; ip++; } Vfy_pop(ITEM_Double_2); Vfy_pop(ITEM_Double); Vfy_setLocal(index + 1, ITEM_Double_2); Vfy_setLocal(index, ITEM_Double); break; }#endif /* IMPLEMENTS_FLOAT */ case ASTORE_0: case ASTORE_1: case ASTORE_2: case ASTORE_3: case ASTORE: { SLOTINDEX index; VERIFIERTYPE arrayElementType; if (opcode == ASTORE) { index = Vfy_getUByte(ip + 1); ip += 2; } else { index = opcode - ASTORE_0; ip++; } arrayElementType = Vfy_pop(ITEM_Reference); Vfy_setLocal(index, arrayElementType); break; } case IASTORE: { Vfy_pop(ITEM_Integer); Vfy_pop(ITEM_Integer); Vfy_pop(Vfy_getIntArrayVerifierType()); ip++; break; } case BASTORE: { VERIFIERTYPE dummy1 = Vfy_pop(ITEM_Integer); VERIFIERTYPE dummy2 = Vfy_pop(ITEM_Integer); VERIFIERTYPE arrayType = Vfy_pop(Vfy_getObjectVerifierType()); if (arrayType != Vfy_getByteArrayVerifierType() && arrayType != Vfy_getBooleanArrayVerifierType() && arrayType != ITEM_Null) { Vfy_throw(VE_BASTORE_BAD_TYPE); } ip++; (void)dummy1; (void)dummy2; break; } case CASTORE: { Vfy_pop(ITEM_Integer); Vfy_pop(ITEM_Integer); Vfy_pop(Vfy_getCharArrayVerifierType()); ip++; break; } case SASTORE: { Vfy_pop(ITEM_Integer); Vfy_pop(ITEM_Integer); Vfy_pop(Vfy_getShortArrayVerifierType()); ip++; break; } case LASTORE: { Vfy_pop(ITEM_Long_2); Vfy_pop(ITEM_Long); Vfy_pop(ITEM_Integer); Vfy_pop(Vfy_getLongArrayVerifierType()); ip++; break; }#if IMPLEMENTS_FLOAT case FASTORE: { Vfy_pop(ITEM_Float); Vfy_pop(ITEM_Integer); Vfy_pop(Vfy_getFloatArrayVerifierType()); ip++; break; } case DASTORE: { Vfy_pop(ITEM_Double_2); Vfy_pop(ITEM_Double); Vfy_pop(ITEM_Integer); Vfy_pop(Vfy_getDoubleArrayVerifierType()); ip++; break; }#endif /* IMPLEMENTS_FLOAT */ case AASTORE: { VERIFIERTYPE value = Vfy_pop(Vfy_getObjectVerifierType()); VERIFIERTYPE dummy = Vfy_pop(ITEM_Integer); VERIFIERTYPE arrayType = Vfy_pop(Vfy_getObjectArrayVerifierType()); VERIFIERTYPE arrayElementType; /* * The value to be stored must be some kind of object and the * array must be some kind of reference array. */ if ( !Vfy_isAssignable(value, Vfy_getObjectVerifierType()) || !Vfy_isAssignable(arrayType, Vfy_getObjectArrayVerifierType()) ) { Vfy_throw(VE_AASTORE_BAD_TYPE); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -