8356946: x86: Optimize interpreter profile updates

Reviewed-by: kvn, jsjolen
This commit is contained in:
Aleksey Shipilev 2025-05-19 08:04:44 +00:00
parent 50a7c61d28
commit 67fb1ee7f1
2 changed files with 10 additions and 40 deletions

View File

@ -1254,46 +1254,19 @@ void InterpreterMacroAssembler::set_mdp_data_at(Register mdp_in,
void InterpreterMacroAssembler::increment_mdp_data_at(Register mdp_in,
int constant,
bool decrement) {
// Counter address
Address data(mdp_in, constant);
increment_mdp_data_at(data, decrement);
}
void InterpreterMacroAssembler::increment_mdp_data_at(Address data,
bool decrement) {
int constant) {
assert(ProfileInterpreter, "must be profiling interpreter");
// %%% this does 64bit counters at best it is wasting space
// at worst it is a rare bug when counters overflow
if (decrement) {
// Decrement the register. Set condition codes.
addptr(data, -DataLayout::counter_increment);
// If the decrement causes the counter to overflow, stay negative
Label L;
jcc(Assembler::negative, L);
addptr(data, DataLayout::counter_increment);
bind(L);
} else {
assert(DataLayout::counter_increment == 1,
"flow-free idiom only works with 1");
// Increment the register. Set carry flag.
addptr(data, DataLayout::counter_increment);
// If the increment causes the counter to overflow, pull back by 1.
sbbptr(data, 0);
}
Address data(mdp_in, constant);
addptr(data, DataLayout::counter_increment);
}
void InterpreterMacroAssembler::increment_mdp_data_at(Register mdp_in,
Register reg,
int constant,
bool decrement) {
Address data(mdp_in, reg, Address::times_1, constant);
increment_mdp_data_at(data, decrement);
Register index,
int constant) {
assert(ProfileInterpreter, "must be profiling interpreter");
Address data(mdp_in, index, Address::times_1, constant);
addptr(data, DataLayout::counter_increment);
}
void InterpreterMacroAssembler::set_mdp_flag_at(Register mdp_in,

View File

@ -212,11 +212,8 @@ class InterpreterMacroAssembler: public MacroAssembler {
void verify_method_data_pointer();
void set_mdp_data_at(Register mdp_in, int constant, Register value);
void increment_mdp_data_at(Address data, bool decrement = false);
void increment_mdp_data_at(Register mdp_in, int constant,
bool decrement = false);
void increment_mdp_data_at(Register mdp_in, Register reg, int constant,
bool decrement = false);
void increment_mdp_data_at(Register mdp_in, int constant);
void increment_mdp_data_at(Register mdp_in, Register index, int constant);
void increment_mask_and_jump(Address counter_addr, Address mask,
Register scratch, Label* where);
void set_mdp_flag_at(Register mdp_in, int flag_constant);