Skip to content

Commit ae31d0f

Browse files
committed
8358655: AArch64: Simplify Interpreter::profile_taken_branch
1 parent afa52e4 commit ae31d0f

File tree

3 files changed

+6
-22
lines changed

3 files changed

+6
-22
lines changed

src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,31 +1016,16 @@ void InterpreterMacroAssembler::update_mdp_for_ret(Register return_bci) {
10161016
}
10171017

10181018

1019-
void InterpreterMacroAssembler::profile_taken_branch(Register mdp,
1020-
Register bumped_count) {
1019+
void InterpreterMacroAssembler::profile_taken_branch(Register mdp) {
10211020
if (ProfileInterpreter) {
10221021
Label profile_continue;
10231022

10241023
// If no method data exists, go to profile_continue.
1025-
// Otherwise, assign to mdp
10261024
test_method_data_pointer(mdp, profile_continue);
10271025

10281026
// We are taking a branch. Increment the taken count.
1029-
// We inline increment_mdp_data_at to return bumped_count in a register
1030-
//increment_mdp_data_at(mdp, in_bytes(JumpData::taken_offset()));
1031-
Address data(mdp, in_bytes(JumpData::taken_offset()));
1032-
ldr(bumped_count, data);
1033-
assert(DataLayout::counter_increment == 1,
1034-
"flow-free idiom only works with 1");
1035-
// Intel does this to catch overflow
1036-
// addptr(bumped_count, DataLayout::counter_increment);
1037-
// sbbptr(bumped_count, 0);
1038-
// so we do this
1039-
adds(bumped_count, bumped_count, DataLayout::counter_increment);
1040-
Label L;
1041-
br(Assembler::CS, L); // skip store if counter overflow
1042-
str(bumped_count, data);
1043-
bind(L);
1027+
increment_mdp_data_at(mdp, in_bytes(JumpData::taken_offset()));
1028+
10441029
// The method data pointer needs to be updated to reflect the new target.
10451030
update_mdp_by_offset(mdp, in_bytes(JumpData::displacement_offset()));
10461031
bind(profile_continue);
@@ -1055,7 +1040,7 @@ void InterpreterMacroAssembler::profile_not_taken_branch(Register mdp) {
10551040
// If no method data exists, go to profile_continue.
10561041
test_method_data_pointer(mdp, profile_continue);
10571042

1058-
// We are taking a branch. Increment the not taken count.
1043+
// We are not taking a branch. Increment the not taken count.
10591044
increment_mdp_data_at(mdp, in_bytes(BranchData::not_taken_offset()));
10601045

10611046
// The method data pointer needs to be updated to correspond to

src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ class InterpreterMacroAssembler: public MacroAssembler {
276276
// narrow int return value
277277
void narrow(Register result);
278278

279-
void profile_taken_branch(Register mdp, Register bumped_count);
279+
void profile_taken_branch(Register mdp);
280280
void profile_not_taken_branch(Register mdp);
281281
void profile_call(Register mdp);
282282
void profile_final_call(Register mdp);

src/hotspot/cpu/aarch64/templateTable_aarch64.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,7 +1759,7 @@ void TemplateTable::float_cmp(bool is_float, int unordered_result)
17591759

17601760
void TemplateTable::branch(bool is_jsr, bool is_wide)
17611761
{
1762-
__ profile_taken_branch(r0, r1);
1762+
__ profile_taken_branch(r0);
17631763
const ByteSize be_offset = MethodCounters::backedge_counter_offset() +
17641764
InvocationCounter::counter_offset();
17651765
const ByteSize inv_offset = MethodCounters::invocation_counter_offset() +
@@ -1809,7 +1809,6 @@ void TemplateTable::branch(bool is_jsr, bool is_wide)
18091809
if (UseLoopCounter) {
18101810
// increment backedge counter for backward branches
18111811
// r0: MDO
1812-
// w1: MDO bumped taken-count
18131812
// r2: target offset
18141813
__ cmp(r2, zr);
18151814
__ br(Assembler::GT, dispatch); // count only if backward branch

0 commit comments

Comments
 (0)