⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 verifier.c

📁 This is a java virtual machine implement in c
💻 C
📖 第 1 页 / 共 5 页
字号:
/*1328*/        case IALOAD :
/*1329*/            POP_STACK(ITEM_Integer);
/*1330*/            POP_STACK(intArrayClassKey);
/*1331*/            PUSH_STACK(ITEM_Integer);
/*1332*/            ip++;
/*1333*/            break;
/*1334*/        case BALOAD :
/*1335*/            POP_STACK(ITEM_Integer);
/*1336*/            POP_STACK(objectClassKey);
/*1337*/            if (lastStackPop != byteArrayClassKey &&
/*1338*/                lastStackPop != booleanArrayClassKey) {
/*1339*/                VERIFIER_ERROR(VE_BALOAD_BAD_TYPE);
/*1340*/            }
/*1341*/            PUSH_STACK(ITEM_Integer);
/*1342*/            ip++;
/*1343*/            break;
/*1344*/        case CALOAD :
/*1345*/            POP_STACK(ITEM_Integer);
/*1346*/            POP_STACK(charArrayClassKey);
/*1347*/            PUSH_STACK(ITEM_Integer);
/*1348*/            ip++;
/*1349*/            break;
/*1350*/        case SALOAD :
/*1351*/            POP_STACK(ITEM_Integer);
/*1352*/            POP_STACK(shortArrayClassKey);
/*1353*/            PUSH_STACK(ITEM_Integer);
/*1354*/            ip++;
/*1355*/            break;
/*1356*/        case LALOAD :
/*1357*/            POP_STACK(ITEM_Integer);
/*1358*/            POP_STACK(longArrayClassKey);
/*1359*/            PUSH_STACK(ITEM_Long);
/*1360*/            PUSH_STACK(ITEM_Long_2);
/*1361*/            ip++;
/*1362*/            break;
/*1363*/#if IMPLEMENTS_FLOAT
/*1364*/        case FALOAD :
/*1365*/            POP_STACK(ITEM_Integer);
/*1366*/            POP_STACK(floatArrayClassKey);
/*1367*/            PUSH_STACK(ITEM_Float);
/*1368*/            ip++;
/*1369*/            break;
/*1370*/        case DALOAD :
/*1371*/            POP_STACK(ITEM_Integer);
/*1372*/            POP_STACK(doubleArrayClassKey);
/*1373*/            PUSH_STACK(ITEM_Double);
/*1374*/            PUSH_STACK(ITEM_Double_2);
/*1375*/            ip++;
/*1376*/            break;
/*1377*/#endif /* IMPLEMENTS_FLOAT */
/*1378*/        case AALOAD :
/*1379*/            POP_STACK(ITEM_Integer);
/*1380*/            POP_STACK(objectClassKey);
/*1381*/            if (!vIsAssignable(lastStackPop, objectArrayClassKey, NULL)) {
/*1382*/                VERIFIER_ERROR(VE_AALOAD_BAD_TYPE);
/*1383*/            }
/*1384*/            typeKey = getObjectArrayElementKey(lastStackPop);
/*1385*/            PUSH_STACK(typeKey);
/*1386*/            ip++;
/*1387*/            break;
/*1388*/        case ISTORE :
/*1389*/            index = code[ip + 1];
/*1390*/            ip += 2;
/*1391*/            goto label_istore;
/*1392*/        case ISTORE_0 :
/*1393*/        case ISTORE_1 :
/*1394*/        case ISTORE_2 :
/*1395*/        case ISTORE_3 :
/*1396*/            index = opcode - ISTORE_0;
/*1397*/            ip++;
/*1398*/        label_istore:
/*1399*/            POP_STACK(ITEM_Integer);
/*1400*/            SET_LOCAL(index, ITEM_Integer);
/*1401*/            break;
/*1402*/        case LSTORE :
/*1403*/            index = code[ip + 1];
/*1404*/            ip += 2;
/*1405*/            goto label_lstore;
/*1406*/        case LSTORE_0 :
/*1407*/        case LSTORE_1 :
/*1408*/        case LSTORE_2 :
/*1409*/        case LSTORE_3 :
/*1410*/            index = opcode - LSTORE_0;
/*1411*/            ip++;
/*1412*/        label_lstore:
/*1413*/            POP_STACK(ITEM_Long_2);
/*1414*/            POP_STACK(ITEM_Long);
/*1415*/            SET_LOCAL(index + 1, ITEM_Long_2);
/*1416*/            SET_LOCAL(index, ITEM_Long);
/*1417*/            break;
/*1418*/#if IMPLEMENTS_FLOAT
/*1419*/        case FSTORE :
/*1420*/            index = code[ip + 1];
/*1421*/            ip += 2;
/*1422*/            goto label_fstore;
/*1423*/        case FSTORE_0 :
/*1424*/        case FSTORE_1 :
/*1425*/        case FSTORE_2 :
/*1426*/        case FSTORE_3 :
/*1427*/            index = opcode - FSTORE_0;
/*1428*/            ip++;
/*1429*/        label_fstore:
/*1430*/            POP_STACK(ITEM_Float);
/*1431*/            SET_LOCAL(index, ITEM_Float);
/*1432*/            break;
/*1433*/        case DSTORE :
/*1434*/            index = code[ip + 1];
/*1435*/            ip += 2;
/*1436*/            goto label_dstore;
/*1437*/        case DSTORE_0 :
/*1438*/        case DSTORE_1 :
/*1439*/        case DSTORE_2 :
/*1440*/        case DSTORE_3 :
/*1441*/            index = opcode - DSTORE_0;
/*1442*/            ip++;
/*1443*/        label_dstore:
/*1444*/            POP_STACK(ITEM_Double_2);
/*1445*/            POP_STACK(ITEM_Double);
/*1446*/            SET_LOCAL(index + 1, ITEM_Double_2);
/*1447*/            SET_LOCAL(index, ITEM_Double);
/*1448*/            break;
/*1449*/#endif /* IMPLEMENTS_FLOAT */
/*1450*/        case ASTORE :
/*1451*/            index = code[ip + 1];
/*1452*/            ip += 2;
/*1453*/            goto label_astore;
/*1454*/        case ASTORE_0 :
/*1455*/        case ASTORE_1 :
/*1456*/        case ASTORE_2 :
/*1457*/        case ASTORE_3 :
/*1458*/            index = opcode - ASTORE_0;
/*1459*/            ip++;
/*1460*/        label_astore:
/*1461*/            POP_STACK(ITEM_Reference);
/*1462*/            SET_LOCAL(index, lastStackPop);
/*1463*/            break;
/*1464*/        case IASTORE :
/*1465*/            POP_STACK(ITEM_Integer);
/*1466*/            POP_STACK(ITEM_Integer);
/*1467*/            POP_STACK(intArrayClassKey);
/*1468*/            ip++;
/*1469*/            break;
/*1470*/        case BASTORE :
/*1471*/            POP_STACK(ITEM_Integer);
/*1472*/            POP_STACK(ITEM_Integer);
/*1473*/            POP_STACK(objectClassKey);
/*1474*/            if (lastStackPop != byteArrayClassKey &&
/*1475*/                lastStackPop != booleanArrayClassKey) {
/*1476*/                VERIFIER_ERROR(VE_BASTORE_BAD_TYPE);
/*1477*/            }
/*1478*/            ip++;
/*1479*/            break;
/*1480*/        case CASTORE :
/*1481*/            POP_STACK(ITEM_Integer);
/*1482*/            POP_STACK(ITEM_Integer);
/*1483*/            POP_STACK(charArrayClassKey);
/*1484*/            ip++;
/*1485*/            break;
/*1486*/        case SASTORE :
/*1487*/            POP_STACK(ITEM_Integer);
/*1488*/            POP_STACK(ITEM_Integer);
/*1489*/            POP_STACK(shortArrayClassKey);
/*1490*/            ip++;
/*1491*/            break;
/*1492*/        case LASTORE :
/*1493*/            POP_STACK(ITEM_Long_2);
/*1494*/            POP_STACK(ITEM_Long);
/*1495*/            POP_STACK(ITEM_Integer);
/*1496*/            POP_STACK(longArrayClassKey);
/*1497*/            ip++;
/*1498*/            break;
/*1499*/#if IMPLEMENTS_FLOAT
/*1500*/        case FASTORE :
/*1501*/            POP_STACK(ITEM_Float);
/*1502*/            POP_STACK(ITEM_Integer);
/*1503*/            POP_STACK(floatArrayClassKey);
/*1504*/            ip++;
/*1505*/            break;
/*1506*/        case DASTORE :
/*1507*/            POP_STACK(ITEM_Double_2);
/*1508*/            POP_STACK(ITEM_Double);
/*1509*/            POP_STACK(ITEM_Integer);
/*1510*/            POP_STACK(doubleArrayClassKey);
/*1511*/            ip++;
/*1512*/            break;
/*1513*/#endif /* IMPLEMENTS_FLOAT */
/*1514*/        case AASTORE : { 
/*1515*/            short arrayKey, arrayElementKey;
/*1516*/            POP_STACK(objectClassKey);
/*1517*/            typeKey = lastStackPop;
/*1518*/            POP_STACK(ITEM_Integer);
/*1519*/            POP_STACK(objectArrayClassKey);
/*1520*/            arrayKey = lastStackPop;
/*1521*/            if (  (!vIsAssignable(arrayKey, objectArrayClassKey, NULL))
/*1522*/                ||(!vIsAssignable(typeKey, objectClassKey, NULL))) {
/*1523*/                VERIFIER_ERROR(VE_AASTORE_BAD_TYPE);
/*1524*/            }
/*1525*/            arrayElementKey = getObjectArrayElementKey(lastStackPop);
/*1526*/            if (   (arrayElementKey >> FIELD_KEY_ARRAY_SHIFT == 0) 
/*1527*/                && (typeKey >> FIELD_KEY_ARRAY_SHIFT == 0) ) { 
/*1528*/                /* As a special case, if both the array element type and
/*1529./                 * the type are both non-array types (or NULL), then we
/*1530./                 * allow the aastore. */
/*1531*/                /* Success */
/*1532*/            } else if (vIsAssignable(typeKey, arrayElementKey, NULL)) { 
/*1533*/                /* Success */
/*1534*/            } else { 
/*1535*/                VERIFIER_ERROR(VE_AASTORE_BAD_TYPE);
/*1536*/            }
/*1537*/            ip++;
/*1538*/            break;
/*1539*/        }
/*1540*/
/*1541*/        case POP :
/*1542*/            POP_STACK(ITEM_Category1);
/*1543*/            ip++;
/*1544*/            break;
/*1545*/        case POP2 :
/*1546*/            POP_STACK(ITEM_Category2);
/*1547*/            ip++;
/*1548*/            break;
/*1549*/        case DUP : 
/*1550*/            POP_STACK(ITEM_Category1);
/*1551*/            PUSH_STACK(lastStackPop);
/*1552*/            PUSH_STACK(lastStackPop);
/*1553*/            ip++;
/*1554*/            break;
/*1555*/        case DUP_X1 :
/*1556*/            {
/*1557*/                unsigned short type1, type2;
/*1558*/                POP_STACK(ITEM_Category1);
/*1559*/                type1 = lastStackPop;
/*1560*/                POP_STACK(ITEM_Category1);
/*1561*/                type2 = lastStackPop;
/*1562*/                PUSH_STACK(type1);
/*1563*/                PUSH_STACK(type2);
/*1564*/                PUSH_STACK(type1);
/*1565*/                ip++;
/*1566*/                break;
/*1567*/            }
/*1568*/        case DUP_X2 :
/*1569*/            POP_STACK(ITEM_Category1);
/*1570*/            POP_STACK(ITEM_DoubleWord);
/*1571*/            PUSH_STACK(lastStackPop);
/*1572*/            PUSH_STACK(lastStackPop2.fst);
/*1573*/            PUSH_STACK(lastStackPop2.snd);
/*1574*/            PUSH_STACK(lastStackPop);
/*1575*/            ip++;
/*1576*/            break;
/*1577*/        case DUP2 :
/*1578*/            POP_STACK(ITEM_DoubleWord);
/*1579*/            PUSH_STACK(lastStackPop2.fst);
/*1580*/            PUSH_STACK(lastStackPop2.snd);
/*1581*/            PUSH_STACK(lastStackPop2.fst);
/*1582*/            PUSH_STACK(lastStackPop2.snd);
/*1583*/            ip++;
/*1584*/            break;
/*1585*/        case DUP2_X1 :
/*1586*/            POP_STACK(ITEM_DoubleWord);
/*1587*/            POP_STACK(ITEM_Category1);
/*1588*/            PUSH_STACK(lastStackPop2.fst);
/*1589*/            PUSH_STACK(lastStackPop2.snd);
/*1590*/            PUSH_STACK(lastStackPop);
/*1591*/            PUSH_STACK(lastStackPop2.fst);
/*1592*/            PUSH_STACK(lastStackPop2.snd);
/*1593*/            ip++;
/*1594*/            break;
/*1595*/        case DUP2_X2 :
/*1596*/            {
/*1597*/                struct DoubleWordItem item1;
/*1598*/                struct DoubleWordItem item2;
/*1599*/                POP_STACK(ITEM_DoubleWord);
/*1600*/                item1 = lastStackPop2;
/*1601*/                POP_STACK(ITEM_DoubleWord);
/*1602*/                item2 = lastStackPop2;
/*1603*/                PUSH_STACK(item1.fst);
/*1604*/                PUSH_STACK(item1.snd);
/*1605*/                PUSH_STACK(item2.fst);
/*1606*/                PUSH_STACK(item2.snd);
/*1607*/                PUSH_STACK(item1.fst);
/*1608*/                PUSH_STACK(item1.snd);
/*1609*/                ip++;
/*1610*/                break;
/*1611*/            }
/*1612*/        case SWAP :
/*1613*/            {
/*1614*/                unsigned short item1, item2;
/*1615*/                POP_STACK(ITEM_Category1);
/*1616*/                item1 = lastStackPop;
/*1617*/                POP_STACK(ITEM_Category1);
/*1618*/                item2 = lastStackPop;
/*1619*/                PUSH_STACK(item1);
/*1620*/                PUSH_STACK(item2);
/*1621*/                ip++;
/*1622*/                break;
/*1623*/            }
/*1624*/        case IADD :
/*1625*/        case ISUB :
/*1626*/        case IMUL :
/*1627*/        case IDIV :
/*1628*/        case IREM :
/*1629*/        case ISHL :
/*1630*/        case ISHR :
/*1631*/        case IUSHR :
/*1632*/        case IOR :
/*1633*/        case IXOR :
/*1

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -