Douglas Leung | 200f040 | 2016-02-25 20:05:47 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Unconditional branch, 8-bit offset. |
| 3 | * |
| 4 | * The branch distance is a signed code-unit offset, which we need to |
| 5 | * double to get a byte offset. |
| 6 | */ |
| 7 | /* goto +AA */ |
| 8 | #if MTERP_PROFILE_BRANCHES |
| 9 | sll a0, rINST, 16 # a0 <- AAxx0000 |
| 10 | sra rINST, a0, 24 # rINST <- ssssssAA (sign-extended) |
| 11 | EXPORT_PC() |
| 12 | move a0, rSELF |
| 13 | addu a1, rFP, OFF_FP_SHADOWFRAME |
| 14 | move a2, rINST |
| 15 | JAL(MterpProfileBranch) # (self, shadow_frame, offset) |
| 16 | bnez v0, MterpOnStackReplacement # Note: offset must be in rINST |
| 17 | addu a2, rINST, rINST # a2 <- byte offset |
| 18 | FETCH_ADVANCE_INST_RB(a2) # update rPC, load rINST |
| 19 | /* If backwards branch refresh rIBASE */ |
| 20 | bgez a2, 1f |
| 21 | lw ra, THREAD_FLAGS_OFFSET(rSELF) |
| 22 | b MterpCheckSuspendAndContinue |
| 23 | 1: |
| 24 | GET_INST_OPCODE(t0) # extract opcode from rINST |
| 25 | GOTO_OPCODE(t0) # jump to next instruction |
| 26 | #else |
| 27 | sll a0, rINST, 16 # a0 <- AAxx0000 |
| 28 | sra rINST, a0, 24 # rINST <- ssssssAA (sign-extended) |
| 29 | addu a2, rINST, rINST # a2 <- byte offset |
| 30 | FETCH_ADVANCE_INST_RB(a2) # update rPC, load rINST |
| 31 | /* If backwards branch refresh rIBASE */ |
| 32 | bgez a1, 1f |
| 33 | lw ra, THREAD_FLAGS_OFFSET(rSELF) |
| 34 | b MterpCheckSuspendAndContinue |
| 35 | 1: |
| 36 | GET_INST_OPCODE(t0) # extract opcode from rINST |
| 37 | GOTO_OPCODE(t0) # jump to next instruction |
| 38 | #endif |