1%default { "func":"MterpDoPackedSwitch" }
2/*
3 * Handle a packed-switch or sparse-switch instruction.  In both cases
4 * we decode it and hand it off to a helper function.
5 *
6 * We don't really expect backward branches in a switch statement, but
7 * they're perfectly legal, so we check for them here.
8 *
9 * for: packed-switch, sparse-switch
10 */
11    /* op vAA, +BBBB */
12    movl    2(rPC), %ecx                    # ecx <- BBBBbbbb
13    GET_VREG %eax, rINST                    # eax <- vAA
14    leal    (rPC,%ecx,2), %ecx              # ecx <- PC + BBBBbbbb*2
15    movl    %eax, OUT_ARG1(%esp)            # ARG1 <- vAA
16    movl    %ecx, OUT_ARG0(%esp)            # ARG0 <- switchData
17    call    SYMBOL($func)
18    REFRESH_IBASE
19    testl   %eax, %eax
20    movl    %eax, rINST
21    jmp     MterpCommonTakenBranch
22