Skip to content

Commit 1712be3

Browse files
author
Andrew Haley
committed
Review feedback
1 parent a6e32ad commit 1712be3

9 files changed

Lines changed: 26 additions & 35 deletions

File tree

src/hotspot/cpu/aarch64/c1_FrameMap_aarch64.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@
127127
static LIR_Opr fpu0_float_opr;
128128
static LIR_Opr fpu0_double_opr;
129129

130-
// static LIR_Opr r_profile_rng_opr;
131130
static LIR_Opr profile_rng_opr;
132131

133132
static LIR_Opr as_long_opr(Register r) {

src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2548,10 +2548,6 @@ void LIR_Assembler::emit_load_klass(LIR_OpLoadKlass* op) {
25482548
__ load_klass(result, obj);
25492549
}
25502550

2551-
#ifndef PRODUCT
2552-
long tier3_overflows;
2553-
#endif
2554-
25552551
void LIR_Assembler::increment_profile_ctr(LIR_Opr step, LIR_Opr dest_opr, LIR_Opr freq_opr,
25562552
LIR_Opr md_reg, LIR_Opr md_opr, LIR_Opr md_offset_opr,
25572553
CodeStub* overflow_stub) {
@@ -2616,7 +2612,6 @@ void LIR_Assembler::increment_profile_ctr(LIR_Opr step, LIR_Opr dest_opr, LIR_Op
26162612
break;
26172613
}
26182614
case T_LONG: {
2619-
inc *= ProfileCaptureRatio;
26202615
__ increment(counter_address, inc, dest);
26212616

26222617
break;
@@ -2662,14 +2657,6 @@ void LIR_Assembler::increment_profile_ctr(LIR_Opr step, LIR_Opr dest_opr, LIR_Op
26622657
__ mov(rscratch1, step->as_constant_ptr()->as_jint_bits() << ratio_shift);
26632658
__ subsw(zr, dest, rscratch1);
26642659
}
2665-
#ifndef PRODUCT
2666-
Label nope;
2667-
__ br(~ __ LO, nope);
2668-
__ lea(rscratch2, Address((address)&tier3_overflows));
2669-
__ mov(rscratch1, 1);
2670-
__ ldadd(Assembler::xword, rscratch1, rscratch1, rscratch2);
2671-
__ bind(nope);
2672-
#endif
26732660
__ br(__ LO, *overflow_stub->entry());
26742661
break;
26752662
}

src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "runtime/sharedRuntime.hpp"
3737
#include "runtime/stubRoutines.hpp"
3838

39+
// State for randomized profile counters.
3940
Register r_profile_rng;
4041

4142
void C1_MacroAssembler::float_cmp(bool is_float, int unordered_result,

src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ static void increment_mdo(MacroAssembler *C1_masm, Address dst, int32_t src, Reg
12931293
if (ProfileCaptureRatio > 1) {
12941294
assert(!dst.uses(temp), "fix register allocation");
12951295
auto threshold = (UCONST64(1) << 32) >> ratio_shift;
1296-
__ cmpl(r_profile_rng, threshold);
1296+
__ cmpl(r_profile_rng, (uint32_t)threshold);
12971297
__ jccb(Assembler::aboveEqual, nope);
12981298
}
12991299
__ addptr(dst, src << ratio_shift);
@@ -2903,9 +2903,9 @@ void LIR_Assembler::increment_profile_ctr(LIR_Opr step_opr, LIR_Opr dest_opr,
29032903
guarantee(dest != step_opr->as_register(), "must be");
29042904
// If step_opr is 0, make sure the stub check below always fails
29052905
__ cmpl(step_opr->as_register(), 0);
2906-
__ movl(step_opr->as_register(),
2906+
__ movl(rscratch1,
29072907
InvocationCounter::count_increment * ProfileCaptureRatio);
2908-
__ cmovl(Assembler::equal, dest, step_opr->as_register());
2908+
__ cmovl(Assembler::equal, dest, rscratch1);
29092909
}
29102910

29112911
// If (dest & mask) < step, we just overflowed.

src/hotspot/share/c1/c1_LIRGenerator.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3218,8 +3218,9 @@ void LIRGenerator::increment_event_counter_impl(CodeEmitInfo* info,
32183218
counter_holder = new_register(T_METADATA);
32193219
offset = in_bytes(backedge ? MethodData::backedge_counter_offset() :
32203220
MethodData::invocation_counter_offset());
3221-
counters_base = LIR_OprFact::metadataConst
3222-
(method->method_data()->constant_encoding());
3221+
ciMethodData* md = method->method_data_or_null();
3222+
assert(md != nullptr, "Sanity");
3223+
counters_base = LIR_OprFact::metadataConst(md->constant_encoding());
32233224
} else {
32243225
ShouldNotReachHere();
32253226
}
@@ -3230,8 +3231,6 @@ void LIRGenerator::increment_event_counter_impl(CodeEmitInfo* info,
32303231
LIR_Opr meth = LIR_OprFact::metadataConst(method->constant_encoding());
32313232
// The bci for info can point to cmp for if's we want the if bci
32323233
CodeStub* overflow = new CounterOverflowStub (info, bci, meth);
3233-
// Zero the low-order bits of the frequency, otherwise we'll miss
3234-
// overflows when using randomized profile counters.
32353234
unsigned int freq = (unsigned int)frequency
32363235
<< InvocationCounter::count_shift;
32373236
__ increment_counter(step, result,

src/hotspot/share/compiler/compilationPolicy.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,6 @@ void CompilationPolicy::print_training_data_on(outputStream* st, const char* pr
411411

412412
// Print an event.
413413
void CompilationPolicy::print_event_on(outputStream *st, EventType type, Method* m, Method* im, int bci, CompLevel level) {
414-
415-
if (level < CompLevel_full_optimization) return;
416-
417414
bool inlinee_event = m != im;
418415

419416
st->print("%lf: [", os::elapsedTime());
@@ -454,7 +451,7 @@ void CompilationPolicy::print_event_on(outputStream *st, EventType type, Method*
454451
st->print("[%s", method_name);
455452
if (inlinee_event) {
456453
char *inlinee_name = im->name_and_sig_as_C_string();
457-
st->print(" [inlinee %s]] ", inlinee_name);
454+
st->print(" [%s]] ", inlinee_name);
458455
}
459456
else st->print("] ");
460457
st->print("@%d queues=%d,%d", bci, CompileBroker::queue_size(CompLevel_full_profile),
@@ -502,11 +499,8 @@ void CompilationPolicy::print_event_on(outputStream *st, EventType type, Method*
502499
print_training_data_on(st, "inlinee ", im, level);
503500
}
504501
}
505-
506-
if (im) {
507-
im->method_data()->print_on(st);
508-
}
509502
st->print_cr("]");
503+
510504
}
511505

512506
void CompilationPolicy::print_event(EventType type, Method* m, Method* im, int bci, CompLevel level) {
@@ -1383,7 +1377,7 @@ CompLevel CompilationPolicy::transition_from_limited_profile(const methodHandle&
13831377
// Determine if a method should be compiled with a normal entry point at a different level.
13841378
CompLevel CompilationPolicy::call_event(const methodHandle& method, CompLevel cur_level, JavaThread* THREAD) {
13851379
CompLevel osr_level = MIN2((CompLevel) method->highest_osr_comp_level(), common<LoopPredicate>(method, cur_level, THREAD, true));
1386-
CompLevel next_level = common<CallPredicate>(method, cur_level, THREAD, is_old(method));
1380+
CompLevel next_level = common<CallPredicate>(method, cur_level, THREAD, !TrainingData::have_data() && is_old(method));
13871381

13881382
// If OSR method level is greater than the regular method level, the levels should be
13891383
// equalized by raising the regular method level in order to avoid OSRs during each

src/hotspot/share/utilities/debug.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,11 @@ extern "C" NOINLINE void disnm(intptr_t p) {
373373
if (cb != nullptr) {
374374
nmethod* nm = cb->as_nmethod_or_null();
375375
if (nm != nullptr) {
376-
nm->print_nmethod(true);
376+
nm->print();
377377
} else {
378378
cb->print();
379379
}
380-
// Disassembler::decode(cb);
380+
Disassembler::decode(cb);
381381
}
382382
}
383383

src/hotspot/share/utilities/vmError.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,8 +1637,6 @@ void VMError::report_and_die(Thread* thread, const void* context, const char* fi
16371637
const char* detail_fmt, ...) {
16381638
va_list detail_args;
16391639
va_start(detail_args, detail_fmt);
1640-
fprintf(stderr, "Spinning\n"); fflush(stderr);
1641-
for(;;);
16421640
report_and_die(thread, context, filename, lineno, message, detail_fmt, detail_args);
16431641
va_end(detail_args);
16441642
}

test/hotspot/jtreg/compiler/tiered/LevelTransitionTest.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,20 @@
3838
* -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::*
3939
* -XX:CompileCommand=compileonly,compiler.tiered.LevelTransitionTest$ExtendedTestCase$CompileMethodHolder::*
4040
* compiler.tiered.LevelTransitionTest
41-
*
41+
*/
42+
43+
/**
44+
* @test LevelTransitionTest
45+
* @requires vm.compMode != "Xcomp"
4246
* @requires os.arch=="amd64" | os.arch=="x86_64" | os.arch=="arm" | os.arch=="aarch64"
47+
* @summary Test the correctness of compilation level transitions for different methods
48+
* @library /test/lib /
49+
* @modules java.base/jdk.internal.misc
50+
* java.management
51+
*
52+
* @build jdk.test.whitebox.WhiteBox
53+
* compiler.tiered.LevelTransitionTest
54+
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
4355
* @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
4456
* -XX:+UnlockExperimentalVMOptions -XX:ProfileCaptureRatio=64
4557
* -XX:+WhiteBoxAPI -XX:+TieredCompilation
@@ -49,6 +61,7 @@
4961
* compiler.tiered.LevelTransitionTest
5062
*/
5163

64+
5265
package compiler.tiered;
5366

5467
import compiler.whitebox.CompilerWhiteBoxTest;

0 commit comments

Comments
 (0)