1 %default { "func":"dvmInterpHandlePackedSwitch" } 2 %verify executed 3 /* 4 * Handle a packed-switch or sparse-switch instruction. In both cases 5 * we decode it and hand it off to a helper function. 6 * 7 * We don't really expect backward branches in a switch statement, but 8 * they're perfectly legal, so we check for them here. 9 * 10 * When the JIT is present, all targets are considered treated as 11 * a potential trace heads regardless of branch direction. 12 * 13 * for: packed-switch, sparse-switch 14 */ 15 /* op vAA, +BBBB */ 16 FETCH(a0, 1) # a0 <- bbbb (lo) 17 FETCH(a1, 2) # a1 <- BBBB (hi) 18 GET_OPA(a3) # a3 <- AA 19 sll t0, a1, 16 20 or a0, a0, t0 # a0 <- BBBBbbbb 21 GET_VREG(a1, a3) # a1 <- vAA 22 EAS1(a0, rPC, a0) # a0 <- PC + BBBBbbbb*2 23 JAL($func) # a0 <- code-unit branch offset 24 addu a1, v0, v0 # a1 <- byte offset 25 bgtz a1, 1f 26 lw rIBASE, offThread_curHandlerTable(rSELF) # refresh handler base 27 1: 28 FETCH_ADVANCE_INST_RB(a1) # update rPC, load rINST 29 #if defined(WITH_JIT) 30 lw a0, offThread_pJitProfTable(rSELF) 31 bnez a0, common_updateProfile 32 #endif 33 GET_INST_OPCODE(t0) # extract opcode from rINST 34 GOTO_OPCODE(t0) # jump to next instruction 35