blob: 083acd1ef9e81342973e7f9813f0a7dbcd1ec941 [file] [log] [blame]
/*
* Unconditional branch, 32-bit offset.
*
* The branch distance is a signed code-unit offset, which we need to
* double to get a byte offset.
*
* Unlike most opcodes, this one is allowed to branch to itself, so
* our "backward branch" test must be "<=0" instead of "<0".
*/
/* goto/32 +AAAAAAAA */
#if MTERP_PROFILE_BRANCHES
FETCH(a0, 1) # a0 <- aaaa (lo)
FETCH(a1, 2) # a1 <- AAAA (hi)
sll a1, a1, 16
or rINST, a0, a1 # rINST <- AAAAaaaa
EXPORT_PC()
move a0, rSELF
addu a1, rFP, OFF_FP_SHADOWFRAME
move a2, rINST
JAL(MterpProfileBranch) # (self, shadow_frame, offset)
bnez v0, MterpOnStackReplacement # Note: offset must be in rINST
addu a1, rINST, rINST # a1 <- byte offset
FETCH_ADVANCE_INST_RB(a1) # update rPC, load rINST
bgtz a1, 1f
lw ra, THREAD_FLAGS_OFFSET(rSELF)
b MterpCheckSuspendAndContinue
1:
GET_INST_OPCODE(t0) # extract opcode from rINST
GOTO_OPCODE(t0) # jump to next instruction
#else
FETCH(a0, 1) # a0 <- aaaa (lo)
FETCH(a1, 2) # a1 <- AAAA (hi)
sll a1, a1, 16
or rINST, a0, a1 # rINST <- AAAAaaaa
addu a1, rINST, rINST # a1 <- byte offset
FETCH_ADVANCE_INST_RB(a1) # update rPC, load rINST
bgtz a1, 1f
lw ra, THREAD_FLAGS_OFFSET(rSELF)
b MterpCheckSuspendAndContinue
1:
GET_INST_OPCODE(t0) # extract opcode from rINST
GOTO_OPCODE(t0) # jump to next instruction
#endif