Home | History | Annotate | Download | only in c
      1 HANDLE_OPCODE(OP_SPARSE_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("|sparse-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 sparse switch");
     18             GOTO_exceptionThrown();
     19         }
     20 #endif
     21         testVal = GET_REGISTER(vsrc1);
     22 
     23         offset = dvmInterpHandleSparseSwitch(switchData, testVal);
     24         ILOGV("> branch taken (0x%04x)", offset);
     25         if (offset <= 0)  /* uncommon */
     26             PERIODIC_CHECKS(offset);
     27         FINISH(offset);
     28     }
     29 OP_END
     30