1 /* 2 * Generic one-operand compare-and-branch operation. Provide a "condition" 3 * fragment that specifies the comparison to perform, e.g. for 4 * "if-lez" you would use "le". 5 * 6 * For: if-eqz, if-nez, if-ltz, if-gez, if-gtz, if-lez 7 */ 8 /* if-cmp vAA, +BBBB */ 9 .extern MterpProfileBranch 10 srl a2, rINST, 8 # a2 <- AA 11 lh rINST, 2(rPC) # rINST <- offset (sign-extended BBBB) 12 GET_VREG a0, a2 # a0 <- vAA 13 b${condition}zc a0, 1f 14 li rINST, 2 # offset if branch not taken 151: 16#if MTERP_PROFILE_BRANCHES 17 EXPORT_PC 18 move a0, rSELF 19 daddu a1, rFP, OFF_FP_SHADOWFRAME 20 move a2, rINST 21 jal MterpProfileBranch # (self, shadow_frame, offset) 22 bnezc v0, MterpOnStackReplacement # Note: offset must be in rINST 23#endif 24 dlsa rPC, rINST, rPC, 1 # rPC <- rPC + offset * 2 25 lw ra, THREAD_FLAGS_OFFSET(rSELF) # Preload flags for MterpCheckSuspendAndContinue 26 move a0, rINST # a0 <- offset 27 FETCH_INST # load rINST 28 bltz a0, MterpCheckSuspendAndContinue # suspend check if backwards branch 29 GET_INST_OPCODE v0 # extract opcode from rINST 30 GOTO_OPCODE v0 # jump to next instruction 31