8269342: CICrashAt=1 does not always catch first Java method

Reviewed-by: kvn, thartmann
This commit is contained in:
Dean Long 2021-07-26 22:09:17 +00:00
parent 8785737ba5
commit fcc7d59b99
4 changed files with 19 additions and 4 deletions

View file

@ -140,6 +140,7 @@ CompileLog** CompileBroker::_compiler2_logs = NULL;
// These counters are used to assign an unique ID to each compilation. // These counters are used to assign an unique ID to each compilation.
volatile jint CompileBroker::_compilation_id = 0; volatile jint CompileBroker::_compilation_id = 0;
volatile jint CompileBroker::_osr_compilation_id = 0; volatile jint CompileBroker::_osr_compilation_id = 0;
volatile jint CompileBroker::_native_compilation_id = 0;
// Performance counters // Performance counters
PerfCounter* CompileBroker::_perf_total_compilation = NULL; PerfCounter* CompileBroker::_perf_total_compilation = NULL;
@ -1588,7 +1589,7 @@ int CompileBroker::assign_compile_id(const methodHandle& method, int osr_bci) {
assert(!is_osr, "can't be osr"); assert(!is_osr, "can't be osr");
// Adapters, native wrappers and method handle intrinsics // Adapters, native wrappers and method handle intrinsics
// should be generated always. // should be generated always.
return Atomic::add(&_compilation_id, 1); return Atomic::add(CICountNative ? &_native_compilation_id : &_compilation_id, 1);
} else if (CICountOSR && is_osr) { } else if (CICountOSR && is_osr) {
id = Atomic::add(&_osr_compilation_id, 1); id = Atomic::add(&_osr_compilation_id, 1);
if (CIStartOSR <= id && id < CIStopOSR) { if (CIStartOSR <= id && id < CIStopOSR) {
@ -2474,6 +2475,8 @@ void CompileBroker::update_compile_perf_data(CompilerThread* thread, const metho
int last_compile_type = normal_compile; int last_compile_type = normal_compile;
if (CICountOSR && is_osr) { if (CICountOSR && is_osr) {
last_compile_type = osr_compile; last_compile_type = osr_compile;
} else if (CICountNative && method->is_native()) {
last_compile_type = native_compile;
} }
CompilerCounters* counters = thread->counters(); CompilerCounters* counters = thread->counters();

View file

@ -174,6 +174,7 @@ class CompileBroker: AllStatic {
// These counters are used for assigning id's to each compilation // These counters are used for assigning id's to each compilation
static volatile jint _compilation_id; static volatile jint _compilation_id;
static volatile jint _osr_compilation_id; static volatile jint _osr_compilation_id;
static volatile jint _native_compilation_id;
static CompileQueue* _c2_compile_queue; static CompileQueue* _c2_compile_queue;
static CompileQueue* _c1_compile_queue; static CompileQueue* _c1_compile_queue;

View file

@ -72,6 +72,10 @@
develop(bool, CICountOSR, false, \ develop(bool, CICountOSR, false, \
"use a separate counter when assigning ids to osr compilations") \ "use a separate counter when assigning ids to osr compilations") \
\ \
develop(bool, CICountNative, false, \
"use a separate counter when assigning ids to native " \
"compilations") \
\
develop(bool, CICompileNatives, true, \ develop(bool, CICompileNatives, true, \
"compile native methods if supported by the compiler") \ "compile native methods if supported by the compiler") \
\ \

View file

@ -68,17 +68,24 @@ public abstract class CiReplayBase {
"-XX:CompilerThreadStackSize=512", "-XX:ParallelGCThreads=1", "-XX:CICompilerCount=2", "-XX:CompilerThreadStackSize=512", "-XX:ParallelGCThreads=1", "-XX:CICompilerCount=2",
"-XX:-BackgroundCompilation", "-XX:CompileCommand=inline,java.io.PrintStream::*", "-XX:-BackgroundCompilation", "-XX:CompileCommand=inline,java.io.PrintStream::*",
"-XX:+IgnoreUnrecognizedVMOptions", "-XX:TypeProfileLevel=222", // extra profile data as a stress test "-XX:+IgnoreUnrecognizedVMOptions", "-XX:TypeProfileLevel=222", // extra profile data as a stress test
"-XX:CICrashAt=1", "-XX:+DumpReplayDataOnError", "-XX:+CICountNative", "-XX:CICrashAt=1", "-XX:+DumpReplayDataOnError",
"-XX:+PreferInterpreterNativeStubs", REPLAY_FILE_OPTION}; REPLAY_FILE_OPTION};
private static final String[] REPLAY_OPTIONS = new String[]{DISABLE_COREDUMP_ON_CRASH, private static final String[] REPLAY_OPTIONS = new String[]{DISABLE_COREDUMP_ON_CRASH,
"-XX:+IgnoreUnrecognizedVMOptions", "-XX:TypeProfileLevel=222", "-XX:+IgnoreUnrecognizedVMOptions", "-XX:TypeProfileLevel=222",
"-XX:+ReplayCompiles", REPLAY_FILE_OPTION}; "-XX:+ReplayCompiles", REPLAY_FILE_OPTION};
protected final Optional<Boolean> runServer; protected final Optional<Boolean> runServer;
private static int dummy; private static int dummy;
static interface Lambda {
int value();
}
public static class TestMain { public static class TestMain {
public static void main(String[] args) { public static void main(String[] args) {
for (int i = 0; i < 20_000; i++) { // explicitly trigger native compilation
Lambda start = () -> 0;
for (int i = start.value(); i < 20_000; i++) {
test(i); test(i);
} }
} }