Skip to content
Permalink
Browse files
8277102: Dubious PrintCompilation output
Reviewed-by: thartmann, dnsimon
  • Loading branch information
Yi Yang committed Nov 19, 2021
1 parent 839033b commit 2f0bde1a658b0910304c110920a2e8ccbe4557f8
@@ -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);
}
}
}
@@ -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();
@@ -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);

@@ -101,7 +101,16 @@ private void check(CompileCodeTestCase testCase) {
// 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");
}
}
}

1 comment on commit 2f0bde1

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 2f0bde1 Nov 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.