Home | History | Annotate | Download | only in mips64
      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, +BBBBBBBB */
     12     .extern $func
     13     .extern MterpProfileBranch
     14     lh      a0, 2(rPC)                  # a0 <- bbbb (lo)
     15     lh      a1, 4(rPC)                  # a1 <- BBBB (hi)
     16     srl     a3, rINST, 8                # a3 <- AA
     17     ins     a0, a1, 16, 16              # a0 <- BBBBbbbb
     18     GET_VREG a1, a3                     # a1 <- vAA
     19     dlsa    a0, a0, rPC, 1              # a0 <- PC + BBBBbbbb*2
     20     jal     $func                       # v0 <- code-unit branch offset
     21     move    rINST, v0
     22 #if MTERP_PROFILE_BRANCHES
     23     EXPORT_PC
     24     move    a0, rSELF
     25     daddu   a1, rFP, OFF_FP_SHADOWFRAME
     26     move    a2, rINST
     27     jal     MterpProfileBranch          # (self, shadow_frame, offset)
     28     bnezc   v0, MterpOnStackReplacement # Note: offset must be in rINST
     29 #endif
     30     dlsa    rPC, rINST, rPC, 1          # rPC <- rPC + offset * 2
     31     lw      ra, THREAD_FLAGS_OFFSET(rSELF)  # Preload flags for MterpCheckSuspendAndContinue
     32     move    a0, rINST                   # a0 <- offset
     33     FETCH_INST                          # load rINST
     34     blez    a0, MterpCheckSuspendAndContinue  # suspend check if backwards branch
     35     GET_INST_OPCODE v0                  # extract opcode from rINST
     36     GOTO_OPCODE v0                      # jump to next instruction
     37