Skip to content

Commit b918dc8

Browse files
committed
8357434: x86: Simplify Interpreter::profile_taken_branch
Reviewed-by: kvn, vlivanov
1 parent f17b2bc commit b918dc8

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

src/hotspot/cpu/x86/interp_masm_x86.cpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,25 +1355,15 @@ void InterpreterMacroAssembler::update_mdp_for_ret(Register return_bci) {
13551355
}
13561356

13571357

1358-
void InterpreterMacroAssembler::profile_taken_branch(Register mdp,
1359-
Register bumped_count) {
1358+
void InterpreterMacroAssembler::profile_taken_branch(Register mdp) {
13601359
if (ProfileInterpreter) {
13611360
Label profile_continue;
13621361

13631362
// If no method data exists, go to profile_continue.
1364-
// Otherwise, assign to mdp
13651363
test_method_data_pointer(mdp, profile_continue);
13661364

13671365
// We are taking a branch. Increment the taken count.
1368-
// We inline increment_mdp_data_at to return bumped_count in a register
1369-
//increment_mdp_data_at(mdp, in_bytes(JumpData::taken_offset()));
1370-
Address data(mdp, in_bytes(JumpData::taken_offset()));
1371-
movptr(bumped_count, data);
1372-
assert(DataLayout::counter_increment == 1,
1373-
"flow-free idiom only works with 1");
1374-
addptr(bumped_count, DataLayout::counter_increment);
1375-
sbbptr(bumped_count, 0);
1376-
movptr(data, bumped_count); // Store back out
1366+
increment_mdp_data_at(mdp, in_bytes(JumpData::taken_offset()));
13771367

13781368
// The method data pointer needs to be updated to reflect the new target.
13791369
update_mdp_by_offset(mdp, in_bytes(JumpData::displacement_offset()));
@@ -1389,7 +1379,7 @@ void InterpreterMacroAssembler::profile_not_taken_branch(Register mdp) {
13891379
// If no method data exists, go to profile_continue.
13901380
test_method_data_pointer(mdp, profile_continue);
13911381

1392-
// We are taking a branch. Increment the not taken count.
1382+
// We are not taking a branch. Increment the not taken count.
13931383
increment_mdp_data_at(mdp, in_bytes(BranchData::not_taken_offset()));
13941384

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

src/hotspot/cpu/x86/interp_masm_x86.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ class InterpreterMacroAssembler: public MacroAssembler {
236236
void update_mdp_by_constant(Register mdp_in, int constant);
237237
void update_mdp_for_ret(Register return_bci);
238238

239-
void profile_taken_branch(Register mdp, Register bumped_count);
239+
void profile_taken_branch(Register mdp);
240240
void profile_not_taken_branch(Register mdp);
241241
void profile_call(Register mdp);
242242
void profile_final_call(Register mdp);

src/hotspot/cpu/x86/templateTable_x86.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,8 +1687,7 @@ void TemplateTable::float_cmp(bool is_float, int unordered_result) {
16871687

16881688
void TemplateTable::branch(bool is_jsr, bool is_wide) {
16891689
__ get_method(rcx); // rcx holds method
1690-
__ profile_taken_branch(rax, rbx); // rax holds updated MDP, rbx
1691-
// holds bumped taken count
1690+
__ profile_taken_branch(rax); // rax holds updated MDP
16921691

16931692
const ByteSize be_offset = MethodCounters::backedge_counter_offset() +
16941693
InvocationCounter::counter_offset();
@@ -1739,7 +1738,6 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
17391738
if (UseLoopCounter) {
17401739
// increment backedge counter for backward branches
17411740
// rax: MDO
1742-
// rbx: MDO bumped taken-count
17431741
// rcx: method
17441742
// rdx: target offset
17451743
// r13: target bcp

0 commit comments

Comments
 (0)