Skip to content

Commit 939521b

Browse files
Anjian Wenfeilongjiang
authored andcommitted
8358105: RISC-V: Optimize interpreter profile updates
Reviewed-by: fjiang, fyang
1 parent 2345065 commit 939521b

File tree

2 files changed

+12
-33
lines changed

2 files changed

+12
-33
lines changed

src/hotspot/cpu/riscv/interp_masm_riscv.cpp

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -955,47 +955,29 @@ void InterpreterMacroAssembler::set_mdp_data_at(Register mdp_in,
955955

956956

957957
void InterpreterMacroAssembler::increment_mdp_data_at(Register mdp_in,
958-
int constant,
959-
bool decrement) {
960-
increment_mdp_data_at(mdp_in, noreg, constant, decrement);
958+
int constant) {
959+
increment_mdp_data_at(mdp_in, noreg, constant);
961960
}
962961

963962
void InterpreterMacroAssembler::increment_mdp_data_at(Register mdp_in,
964-
Register reg,
965-
int constant,
966-
bool decrement) {
963+
Register index,
964+
int constant) {
967965
assert(ProfileInterpreter, "must be profiling interpreter");
968-
// %%% this does 64bit counters at best it is wasting space
969-
// at worst it is a rare bug when counters overflow
970966

971-
assert_different_registers(t1, t0, mdp_in, reg);
967+
assert_different_registers(t1, t0, mdp_in, index);
972968

973969
Address addr1(mdp_in, constant);
974970
Address addr2(t1, 0);
975971
Address &addr = addr1;
976-
if (reg != noreg) {
972+
if (index != noreg) {
977973
la(t1, addr1);
978-
add(t1, t1, reg);
974+
add(t1, t1, index);
979975
addr = addr2;
980976
}
981977

982-
if (decrement) {
983-
ld(t0, addr);
984-
subi(t0, t0, DataLayout::counter_increment);
985-
Label L;
986-
bltz(t0, L); // skip store if counter underflow
987-
sd(t0, addr);
988-
bind(L);
989-
} else {
990-
assert(DataLayout::counter_increment == 1,
991-
"flow-free idiom only works with 1");
992-
ld(t0, addr);
993-
addi(t0, t0, DataLayout::counter_increment);
994-
Label L;
995-
blez(t0, L); // skip store if counter overflow
996-
sd(t0, addr);
997-
bind(L);
998-
}
978+
ld(t0, addr);
979+
addi(t0, t0, DataLayout::counter_increment);
980+
sd(t0, addr);
999981
}
1000982

1001983
void InterpreterMacroAssembler::set_mdp_flag_at(Register mdp_in,

src/hotspot/cpu/riscv/interp_masm_riscv.hpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,8 @@ class InterpreterMacroAssembler: public MacroAssembler {
233233
void verify_method_data_pointer();
234234

235235
void set_mdp_data_at(Register mdp_in, int constant, Register value);
236-
void increment_mdp_data_at(Address data, bool decrement = false);
237-
void increment_mdp_data_at(Register mdp_in, int constant,
238-
bool decrement = false);
239-
void increment_mdp_data_at(Register mdp_in, Register reg, int constant,
240-
bool decrement = false);
236+
void increment_mdp_data_at(Register mdp_in, int constant);
237+
void increment_mdp_data_at(Register mdp_in, Register index, int constant);
241238
void increment_mask_and_jump(Address counter_addr,
242239
int increment, Address mask,
243240
Register tmp1, Register tmp2,

0 commit comments

Comments
 (0)