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 * for: packed-switch, sparse-switch 11 */ 12 /* op vAA, +BBBB */ 13 movzbl rINST_HI,rINST_FULL # rINST_FULL<- AA 14 movl 2(rPC),%ecx # ecx<- BBBBbbbb 15 GET_VREG(%eax,rINST_FULL) # eax<- vAA 16 leal (rPC,%ecx,2),%ecx # ecx<- PC + BBBBbbbb*2 17 movl %eax,OUT_ARG1(%esp) # ARG1<- vAA 18 movl %ecx,OUT_ARG0(%esp) # ARG0<- switchData 19 SPILL(rPC) 20 call $func 21 UNSPILL(rPC) 22 testl %eax,%eax 23 movl %eax,rINST_FULL # set up word offset 24 jle common_backwardBranch # check on special actions 25 ADVANCE_PC_INDEXED(rINST_FULL) 26 FETCH_INST() 27 GOTO_NEXT 28