Skip to content

Commit 2f0bde1

Browse files
committed
8277102: Dubious PrintCompilation output
Reviewed-by: thartmann, dnsimon
1 parent 839033b commit 2f0bde1

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

src/hotspot/share/code/nmethod.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ void nmethod::print_on(outputStream* st, const char* msg) const {
924924
CompileTask::print(st, this, msg, /*short_form:*/ true);
925925
st->print_cr(" (" INTPTR_FORMAT ")", p2i(this));
926926
} else {
927-
CompileTask::print(st, this, msg, /*short_form:*/ false, /* cr */ true, /* timestamp */ false);
927+
CompileTask::print(st, this, msg, /*short_form:*/ false);
928928
}
929929
}
930930
}

src/hotspot/share/compiler/compileTask.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,11 @@ void CompileTask::print_tty() {
236236
// CompileTask::print_impl
237237
void CompileTask::print_impl(outputStream* st, Method* method, int compile_id, int comp_level,
238238
bool is_osr_method, int osr_bci, bool is_blocking,
239-
const char* msg, bool short_form, bool cr, bool timestamp,
239+
const char* msg, bool short_form, bool cr,
240240
jlong time_queued, jlong time_started) {
241241
if (!short_form) {
242-
if (timestamp) {
243-
// Print current time
244-
st->print("%7d ", (int)tty->time_stamp().milliseconds());
245-
}
242+
// Print current time
243+
st->print("%7d ", (int)tty->time_stamp().milliseconds());
246244
if (Verbose && time_queued != 0) {
247245
// Print time in queue and time being processed by compiler thread
248246
jlong now = os::elapsed_counter();

src/hotspot/share/compiler/compileTask.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,16 @@ class CompileTask : public CHeapObj<mtCompiler> {
187187
private:
188188
static void print_impl(outputStream* st, Method* method, int compile_id, int comp_level,
189189
bool is_osr_method = false, int osr_bci = -1, bool is_blocking = false,
190-
const char* msg = NULL, bool short_form = false, bool cr = true, bool timestamp = true,
190+
const char* msg = NULL, bool short_form = false, bool cr = true,
191191
jlong time_queued = 0, jlong time_started = 0);
192192

193193
public:
194194
void print(outputStream* st = tty, const char* msg = NULL, bool short_form = false, bool cr = true);
195195
void print_ul(const char* msg = NULL);
196-
static void print(outputStream* st, const nmethod* nm, const char* msg = NULL, bool short_form = false, bool cr = true, bool timestamp = true) {
196+
static void print(outputStream* st, const nmethod* nm, const char* msg = NULL, bool short_form = false, bool cr = true) {
197197
print_impl(st, nm->method(), nm->compile_id(), nm->comp_level(),
198198
nm->is_osr_method(), nm->is_osr_method() ? nm->osr_entry_bci() : -1, /*is_blocking*/ false,
199-
msg, short_form, cr, timestamp);
199+
msg, short_form, cr);
200200
}
201201
static void print_ul(const nmethod* nm, const char* msg = NULL);
202202

test/hotspot/jtreg/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,16 @@ private void check(CompileCodeTestCase testCase) {
101101
// Therefore compare strings 2 and 3.
102102
String str2 = CompilerToVMHelper.disassembleCodeBlob(installedCode);
103103
String str3 = CompilerToVMHelper.disassembleCodeBlob(installedCode);
104-
Asserts.assertEQ(str2, str3,
104+
String[] str2Lines = str2.split(System.lineSeparator());
105+
String[] str3Lines = str3.split(System.lineSeparator());
106+
// skip the first two lines since it contains a timestamp that may vary from different invocations
107+
// <empty-line>
108+
// Compiled method (c2) 309 463 4 compiler.jvmci.compilerToVM.CompileCodeTestCase$Dummy::staticMethod (1 bytes)
109+
// <empty-line>
110+
// Compiled method (c2) 310 463 4 compiler.jvmci.compilerToVM.CompileCodeTestCase$Dummy::staticMethod (1 bytes)
111+
for (int i = 2; i < str2Lines.length; i++) {
112+
Asserts.assertEQ(str2Lines[i], str3Lines[i],
105113
testCase + " : 3nd invocation returned different value from 2nd");
114+
}
106115
}
107116
}

0 commit comments

Comments
 (0)