OP_PACKED_SWITCH.cpp revision 46f3fd49ebda372887192fa32b16040ed6710f58
1HANDLE_OPCODE(OP_PACKED_SWITCH /*vAA, +BBBB*/)
2    {
3        const u2* switchData;
4        u4 testVal;
5        s4 offset;
6
7        vsrc1 = INST_AA(inst);
8        offset = FETCH(1) | (((s4) FETCH(2)) << 16);
9        ILOGV("|packed-switch v%d +0x%04x", vsrc1, offset);
10        switchData = pc + offset;       // offset in 16-bit units
11#ifndef NDEBUG
12        if (switchData < curMethod->insns ||
13            switchData >= curMethod->insns + dvmGetMethodInsnsSize(curMethod))
14        {
15            /* should have been caught in verifier */
16            EXPORT_PC();
17            dvmThrowInternalError("bad packed switch");
18            GOTO_exceptionThrown();
19        }
20#endif
21        testVal = GET_REGISTER(vsrc1);
22
23        offset = dvmInterpHandlePackedSwitch(switchData, testVal);
24        ILOGV("> branch taken (0x%04x)", offset);
25        if (offset <= 0)  /* uncommon */
26            PERIODIC_CHECKS(offset);
27        FINISH(offset);
28    }
29OP_END
30