Fix Arm32.

This commit is contained in:
Andrew Haley 2026-07-01 17:11:39 +00:00
parent 448475aed7
commit 767aac76d1
5 changed files with 23 additions and 6 deletions

View File

@ -48,6 +48,7 @@ LIR_Opr FrameMap::R3_metadata_opr;
LIR_Opr FrameMap::R4_metadata_opr;
LIR_Opr FrameMap::R5_metadata_opr;
LIR_Opr FrameMap::profile_rng_opr;
LIR_Opr FrameMap::LR_opr;
LIR_Opr FrameMap::LR_oop_opr;
@ -142,6 +143,10 @@ void FrameMap::initialize() {
SP_opr = as_pointer_opr(SP);
Rthread_opr = as_pointer_opr(Rthread);
if (ProfileCaptureRatio > 1) {
profile_rng_opr = LIR_OprFact::single_cpu(cpu_reg2rnr(r_profile_rng));
}
// LIR operands for result
Int_result_opr = R0_opr;
Object_result_opr = R0_oop_opr;

View File

@ -54,6 +54,7 @@
static LIR_Opr R4_metadata_opr;
static LIR_Opr R5_metadata_opr;
static LIR_Opr profile_rng_opr;
static LIR_Opr LR_opr;
static LIR_Opr LR_oop_opr;

View File

@ -2473,14 +2473,13 @@ void LIR_Assembler::increment_profile_ctr(LIR_Opr step, LIR_Opr dest_opr,
}
#endif
int profile_capture_ratio = ProfileCaptureRatio;
int ratio_shift = exact_log2(profile_capture_ratio);
int ratio_shift = exact_log2(ProfileCaptureRatio);
uint64_t threshold = (UCONST64(1) << 32) >> ratio_shift;
assert(threshold > 0, "must be");
ProfileStub *counter_stub
= profile_capture_ratio > 1 ? new ProfileStub() : nullptr;
= ProfileCaptureRatio > 1 ? new ProfileStub() : nullptr;
Register dest = dest_opr->as_register();
@ -2544,7 +2543,7 @@ void LIR_Assembler::increment_profile_ctr(LIR_Opr step, LIR_Opr dest_opr,
}
}
if (overflow_stub) {
if (overflow_stub != nullptr) {
guarantee(step->is_valid(), "must be");
if (!freq_opr->is_valid()) {
if (!step->is_constant()) {
@ -2562,9 +2561,16 @@ void LIR_Assembler::increment_profile_ctr(LIR_Opr step, LIR_Opr dest_opr,
}
juint mask = freq_opr->as_jint();
__ mov_slow(Rtemp, mask);
__ tst(dest, Rtemp);
__ b(*overflow_stub->entry(), eq);
__ andr(dest, dest, Rtemp);
if (step->is_register()) {
__ cmp(dest, AsmOperand(step->as_register(), lsl, ratio_shift));
} else {
__ mov(Rtemp, step->as_constant_ptr()->as_jint_bits() << ratio_shift);
__ cmp(dest, Rtemp);
}
}
__ b(*overflow_stub->entry(), lo);
}
if (counter_stub != nullptr) {

View File

@ -93,6 +93,10 @@ LIR_Opr LIRGenerator::atomicLockOpr() {
return LIR_OprFact::illegalOpr;
}
LIR_Opr LIRGenerator::profile_rng_opr() {
return FrameMap::profile_rng_opr;
}
LIR_Opr LIRGenerator::result_register_for(ValueType* type, bool callee) {
LIR_Opr opr;
switch (type->tag()) {

View File

@ -252,6 +252,7 @@ void C1_MacroAssembler::step_random(Register state, Register temp, Register data
https://www.researchgate.net/publication/2683298_A_Collection_of_Selected_Pseudorandom_Number_Generators_With_Linear_Structures */
mov_slow(temp, 69069);
mul(state, state, temp);
add(state, state, 1);
}
void C1_MacroAssembler::save_profile_rng() {