8277102: Dubious PrintCompilation output

Reviewed-by: thartmann, dnsimon
This commit is contained in:
Yi Yang 2021-11-19 02:04:48 +00:00
parent 839033baf6
commit 2f0bde1a65
4 changed files with 17 additions and 10 deletions

View File

@ -924,7 +924,7 @@ void nmethod::print_on(outputStream* st, const char* msg) const {
CompileTask::print(st, this, msg, /*short_form:*/ true);
st->print_cr(" (" INTPTR_FORMAT ")", p2i(this));
} else {
CompileTask::print(st, this, msg, /*short_form:*/ false, /* cr */ true, /* timestamp */ false);
CompileTask::print(st, this, msg, /*short_form:*/ false);
}
}
}

View File

@ -236,13 +236,11 @@ void CompileTask::print_tty() {
// CompileTask::print_impl
void CompileTask::print_impl(outputStream* st, Method* method, int compile_id, int comp_level,
bool is_osr_method, int osr_bci, bool is_blocking,
const char* msg, bool short_form, bool cr, bool timestamp,
const char* msg, bool short_form, bool cr,
jlong time_queued, jlong time_started) {
if (!short_form) {
if (timestamp) {
// Print current time
st->print("%7d ", (int)tty->time_stamp().milliseconds());
}
// Print current time
st->print("%7d ", (int)tty->time_stamp().milliseconds());
if (Verbose && time_queued != 0) {
// Print time in queue and time being processed by compiler thread
jlong now = os::elapsed_counter();

View File

@ -187,16 +187,16 @@ class CompileTask : public CHeapObj<mtCompiler> {
private:
static void print_impl(outputStream* st, Method* method, int compile_id, int comp_level,
bool is_osr_method = false, int osr_bci = -1, bool is_blocking = false,
const char* msg = NULL, bool short_form = false, bool cr = true, bool timestamp = true,
const char* msg = NULL, bool short_form = false, bool cr = true,
jlong time_queued = 0, jlong time_started = 0);
public:
void print(outputStream* st = tty, const char* msg = NULL, bool short_form = false, bool cr = true);
void print_ul(const char* msg = NULL);
static void print(outputStream* st, const nmethod* nm, const char* msg = NULL, bool short_form = false, bool cr = true, bool timestamp = true) {
static void print(outputStream* st, const nmethod* nm, const char* msg = NULL, bool short_form = false, bool cr = true) {
print_impl(st, nm->method(), nm->compile_id(), nm->comp_level(),
nm->is_osr_method(), nm->is_osr_method() ? nm->osr_entry_bci() : -1, /*is_blocking*/ false,
msg, short_form, cr, timestamp);
msg, short_form, cr);
}
static void print_ul(const nmethod* nm, const char* msg = NULL);

View File

@ -101,7 +101,16 @@ public class DisassembleCodeBlobTest {
// Therefore compare strings 2 and 3.
String str2 = CompilerToVMHelper.disassembleCodeBlob(installedCode);
String str3 = CompilerToVMHelper.disassembleCodeBlob(installedCode);
Asserts.assertEQ(str2, str3,
String[] str2Lines = str2.split(System.lineSeparator());
String[] str3Lines = str3.split(System.lineSeparator());
// skip the first two lines since it contains a timestamp that may vary from different invocations
// <empty-line>
// Compiled method (c2) 309 463 4 compiler.jvmci.compilerToVM.CompileCodeTestCase$Dummy::staticMethod (1 bytes)
// <empty-line>
// Compiled method (c2) 310 463 4 compiler.jvmci.compilerToVM.CompileCodeTestCase$Dummy::staticMethod (1 bytes)
for (int i = 2; i < str2Lines.length; i++) {
Asserts.assertEQ(str2Lines[i], str3Lines[i],
testCase + " : 3nd invocation returned different value from 2nd");
}
}
}