Skip to content

Commit 767aac7

Browse files
author
Andrew Haley
committed
Fix Arm32.
1 parent 448475a commit 767aac7

5 files changed

Lines changed: 23 additions & 6 deletions

File tree

src/hotspot/cpu/arm/c1_FrameMap_arm.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ LIR_Opr FrameMap::R3_metadata_opr;
4848
LIR_Opr FrameMap::R4_metadata_opr;
4949
LIR_Opr FrameMap::R5_metadata_opr;
5050

51+
LIR_Opr FrameMap::profile_rng_opr;
5152

5253
LIR_Opr FrameMap::LR_opr;
5354
LIR_Opr FrameMap::LR_oop_opr;
@@ -142,6 +143,10 @@ void FrameMap::initialize() {
142143
SP_opr = as_pointer_opr(SP);
143144
Rthread_opr = as_pointer_opr(Rthread);
144145

146+
if (ProfileCaptureRatio > 1) {
147+
profile_rng_opr = LIR_OprFact::single_cpu(cpu_reg2rnr(r_profile_rng));
148+
}
149+
145150
// LIR operands for result
146151
Int_result_opr = R0_opr;
147152
Object_result_opr = R0_oop_opr;

src/hotspot/cpu/arm/c1_FrameMap_arm.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
static LIR_Opr R4_metadata_opr;
5555
static LIR_Opr R5_metadata_opr;
5656

57+
static LIR_Opr profile_rng_opr;
5758

5859
static LIR_Opr LR_opr;
5960
static LIR_Opr LR_oop_opr;

src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,14 +2473,13 @@ void LIR_Assembler::increment_profile_ctr(LIR_Opr step, LIR_Opr dest_opr,
24732473
}
24742474
#endif
24752475

2476-
int profile_capture_ratio = ProfileCaptureRatio;
2477-
int ratio_shift = exact_log2(profile_capture_ratio);
2476+
int ratio_shift = exact_log2(ProfileCaptureRatio);
24782477
uint64_t threshold = (UCONST64(1) << 32) >> ratio_shift;
24792478

24802479
assert(threshold > 0, "must be");
24812480

24822481
ProfileStub *counter_stub
2483-
= profile_capture_ratio > 1 ? new ProfileStub() : nullptr;
2482+
= ProfileCaptureRatio > 1 ? new ProfileStub() : nullptr;
24842483

24852484
Register dest = dest_opr->as_register();
24862485

@@ -2544,7 +2543,7 @@ void LIR_Assembler::increment_profile_ctr(LIR_Opr step, LIR_Opr dest_opr,
25442543
}
25452544
}
25462545

2547-
if (overflow_stub) {
2546+
if (overflow_stub != nullptr) {
25482547
guarantee(step->is_valid(), "must be");
25492548
if (!freq_opr->is_valid()) {
25502549
if (!step->is_constant()) {
@@ -2562,9 +2561,16 @@ void LIR_Assembler::increment_profile_ctr(LIR_Opr step, LIR_Opr dest_opr,
25622561
}
25632562
juint mask = freq_opr->as_jint();
25642563
__ mov_slow(Rtemp, mask);
2565-
__ tst(dest, Rtemp);
2566-
__ b(*overflow_stub->entry(), eq);
2564+
__ andr(dest, dest, Rtemp);
2565+
2566+
if (step->is_register()) {
2567+
__ cmp(dest, AsmOperand(step->as_register(), lsl, ratio_shift));
2568+
} else {
2569+
__ mov(Rtemp, step->as_constant_ptr()->as_jint_bits() << ratio_shift);
2570+
__ cmp(dest, Rtemp);
2571+
}
25672572
}
2573+
__ b(*overflow_stub->entry(), lo);
25682574
}
25692575

25702576
if (counter_stub != nullptr) {

src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ LIR_Opr LIRGenerator::atomicLockOpr() {
9393
return LIR_OprFact::illegalOpr;
9494
}
9595

96+
LIR_Opr LIRGenerator::profile_rng_opr() {
97+
return FrameMap::profile_rng_opr;
98+
}
99+
96100
LIR_Opr LIRGenerator::result_register_for(ValueType* type, bool callee) {
97101
LIR_Opr opr;
98102
switch (type->tag()) {

src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ void C1_MacroAssembler::step_random(Register state, Register temp, Register data
252252
https://www.researchgate.net/publication/2683298_A_Collection_of_Selected_Pseudorandom_Number_Generators_With_Linear_Structures */
253253
mov_slow(temp, 69069);
254254
mul(state, state, temp);
255+
add(state, state, 1);
255256
}
256257

257258
void C1_MacroAssembler::save_profile_rng() {

0 commit comments

Comments
 (0)