< prev index next >
src/share/vm/c1/c1_LIRGenerator.cpp
Print this page
rev 9031 : 8138892: C1: Improve counter overflow checking
Reviewed-by:
*** 3416,3433 ****
LIR_Opr result = new_register(T_INT);
__ load(counter, result);
__ add(result, LIR_OprFact::intConst(InvocationCounter::count_increment), result);
__ store(result, counter);
if (notify) {
! LIR_Opr mask = load_immediate(frequency << InvocationCounter::count_shift, T_INT);
! LIR_Opr meth = new_register(T_METADATA);
! __ metadata2reg(method->constant_encoding(), meth);
! __ logical_and(result, mask, result);
! __ cmp(lir_cond_equal, result, LIR_OprFact::intConst(0));
// The bci for info can point to cmp for if's we want the if bci
CodeStub* overflow = new CounterOverflowStub(info, bci, meth);
__ branch(lir_cond_equal, T_INT, overflow);
__ branch_destination(overflow->continuation());
}
}
void LIRGenerator::do_RuntimeCall(RuntimeCall* x) {
--- 3416,3437 ----
LIR_Opr result = new_register(T_INT);
__ load(counter, result);
__ add(result, LIR_OprFact::intConst(InvocationCounter::count_increment), result);
__ store(result, counter);
if (notify) {
! LIR_Opr meth = LIR_OprFact::metadataConst(method->constant_encoding());
// The bci for info can point to cmp for if's we want the if bci
CodeStub* overflow = new CounterOverflowStub(info, bci, meth);
+ int freq = frequency << InvocationCounter::count_shift;
+ if (freq == 0) {
+ __ branch(lir_cond_always, T_ILLEGAL, overflow);
+ } else {
+ LIR_Opr mask = load_immediate(freq, T_INT);
+ __ logical_and(result, mask, result);
+ __ cmp(lir_cond_equal, result, LIR_OprFact::intConst(0));
__ branch(lir_cond_equal, T_INT, overflow);
+ }
__ branch_destination(overflow->continuation());
}
}
void LIRGenerator::do_RuntimeCall(RuntimeCall* x) {
< prev index next >