diff options
-rw-r--r-- | runtime/arch/riscv64/asm_support_riscv64.S | 14 | ||||
-rw-r--r-- | runtime/interpreter/mterp/riscv64/invoke.S | 6 | ||||
-rw-r--r-- | runtime/interpreter/mterp/riscv64/main.S | 10 |
3 files changed, 19 insertions, 11 deletions
diff --git a/runtime/arch/riscv64/asm_support_riscv64.S b/runtime/arch/riscv64/asm_support_riscv64.S index 9f5714e981..7b3e36a8ca 100644 --- a/runtime/arch/riscv64/asm_support_riscv64.S +++ b/runtime/arch/riscv64/asm_support_riscv64.S @@ -819,4 +819,18 @@ ret .endm + +// Macros to branch based on the value of a specific bit. +.macro BRANCH_IF_BIT_CLEAR tmp, reg, bit, dest + slli \tmp, \reg, (63 - \bit) // tested bit => sign bit + bgez \tmp, \dest +.endm + + +.macro BRANCH_IF_BIT_SET tmp, reg, bit, dest + slli \tmp, \reg, (63 - \bit) // tested bit => sign bit + bltz \tmp, \dest +.endm + + #endif // ART_RUNTIME_ARCH_RISCV64_ASM_SUPPORT_RISCV64_S_ diff --git a/runtime/interpreter/mterp/riscv64/invoke.S b/runtime/interpreter/mterp/riscv64/invoke.S index 2581197133..656476cbf0 100644 --- a/runtime/interpreter/mterp/riscv64/invoke.S +++ b/runtime/interpreter/mterp/riscv64/invoke.S @@ -617,8 +617,7 @@ // Temporaries: z0 %def try_simple_args(ins="", v_fedc="", z0="", skip="", uniq=""): lwu $z0, ART_METHOD_ACCESS_FLAGS_OFFSET(a0) - bexti $z0, $z0, ART_METHOD_NTERP_INVOKE_FAST_PATH_FLAG_BIT - beqz $z0, $skip + BRANCH_IF_BIT_CLEAR $z0, $z0, ART_METHOD_NTERP_INVOKE_FAST_PATH_FLAG_BIT, $skip li $z0, 2 blt $ins, $z0, .L${uniq}_simple_done // A = 1: no further args. beq $ins, $z0, .L${uniq}_simple_2 // A = 2 @@ -647,8 +646,7 @@ // Static variant. %def try_simple_args_static(ins="", v_fedc="", z0="", skip="", uniq=""): lwu $z0, ART_METHOD_ACCESS_FLAGS_OFFSET(a0) - bexti $z0, $z0, ART_METHOD_NTERP_INVOKE_FAST_PATH_FLAG_BIT - beqz $z0, $skip + BRANCH_IF_BIT_CLEAR $z0, $z0, ART_METHOD_NTERP_INVOKE_FAST_PATH_FLAG_BIT, $skip beqz $ins, .L${uniq}_simple_done // A = 0: no further args. li $z0, 2 blt $ins, $z0, .L${uniq}_simple_1 // A = 1 diff --git a/runtime/interpreter/mterp/riscv64/main.S b/runtime/interpreter/mterp/riscv64/main.S index 82803e7f4a..e72051824d 100644 --- a/runtime/interpreter/mterp/riscv64/main.S +++ b/runtime/interpreter/mterp/riscv64/main.S @@ -128,8 +128,7 @@ END \name // - \code_item: holds instruction array on exit .macro FETCH_CODE_ITEM_INFO code_item, regs, outs, ins // Check LSB of \code_item. If 1, it's a compact dex file. - bexti \regs, \code_item, 0x0 - beqz \regs, 1f // Regular dex. + BRANCH_IF_BIT_CLEAR \regs, \code_item, 0, 1f // Regular dex. unimp // Compact dex: unimplemented. 1: // Unpack values from regular dex format. @@ -267,9 +266,7 @@ END \name // Clobbers: t0 .macro CHECK_AND_UPDATE_SHARED_MEMORY_METHOD if_hot, if_not_hot lw t0, ART_METHOD_ACCESS_FLAGS_OFFSET(a0) - // Extract flag bit, branch if bit is unset. - bexti t0, t0, ART_METHOD_IS_MEMORY_SHARED_FLAG_BIT - beqz t0, \if_hot + BRANCH_IF_BIT_CLEAR t0, t0, ART_METHOD_IS_MEMORY_SHARED_FLAG_BIT, \if_hot lw t0, THREAD_SHARED_METHOD_HOTNESS_OFFSET(xSELF) beqz t0, \if_hot @@ -470,8 +467,7 @@ OAT_ENTRY ExecuteNterpImpl // Fast path: all reference args. sh2add t0, s7, xFP // t0 := &xFP[a1] sh2add t1, s7, xREFS // t1 := &xREFS[a1] - bexti t2, s10, ART_METHOD_NTERP_ENTRY_POINT_FAST_PATH_FLAG_BIT - beqz t2, .Lentry_a1 + BRANCH_IF_BIT_CLEAR t2, s10, ART_METHOD_NTERP_ENTRY_POINT_FAST_PATH_FLAG_BIT, .Lentry_a1 % setup_ref_args_and_go(fp="t0", refs="t1", refs_end="xFP", spills_sp="s9", z0="t2", z1="t3", done=".Lentry_go") // Fast path: instance with zero args. |