Skip to content

Commit 7d2a7ce

Browse files
ashu-mehraVladimir Kozlov
authored andcommitted
8308672: Add version number in the replay file generated by DumpInline
Reviewed-by: kvn
1 parent 27ba8bd commit 7d2a7ce

File tree

3 files changed

+26
-21
lines changed

3 files changed

+26
-21
lines changed

src/hotspot/share/ci/ciEnv.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,7 @@ void ciEnv::dump_replay_data_helper(outputStream* out) {
16631663
NoSafepointVerifier no_safepoint;
16641664
ResourceMark rm;
16651665

1666-
out->print_cr("version %d", REPLAY_VERSION);
1666+
dump_replay_data_version(out);
16671667
#if INCLUDE_JVMTI
16681668
out->print_cr("JvmtiExport can_access_local_variables %d", _jvmti_can_access_local_variables);
16691669
out->print_cr("JvmtiExport can_hotswap_or_post_breakpoint %d", _jvmti_can_hotswap_or_post_breakpoint);
@@ -1731,6 +1731,7 @@ void ciEnv::dump_inline_data(int compile_id) {
17311731
fileStream replay_data_stream(inline_data_file, /*need_close=*/true);
17321732
GUARDED_VM_ENTRY(
17331733
MutexLocker ml(Compile_lock);
1734+
dump_replay_data_version(&replay_data_stream);
17341735
dump_compile_data(&replay_data_stream);
17351736
)
17361737
replay_data_stream.flush();
@@ -1742,3 +1743,7 @@ void ciEnv::dump_inline_data(int compile_id) {
17421743
}
17431744
}
17441745
}
1746+
1747+
void ciEnv::dump_replay_data_version(outputStream* out) {
1748+
out->print_cr("version %d", REPLAY_VERSION);
1749+
}

src/hotspot/share/ci/ciEnv.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ class ciEnv : StackObj {
496496
void dump_replay_data_unsafe(outputStream* out);
497497
void dump_replay_data_helper(outputStream* out);
498498
void dump_compile_data(outputStream* out);
499+
void dump_replay_data_version(outputStream* out);
499500

500501
const char *dyno_name(const InstanceKlass* ik) const;
501502
const char *replay_name(const InstanceKlass* ik) const;

src/hotspot/share/ci/ciReplay.cpp

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ class CompileReplay : public StackObj {
636636
int c = getc(_stream);
637637
while(c != EOF) {
638638
c = get_line(c);
639-
process_command(THREAD);
639+
process_command(false, THREAD);
640640
if (had_error()) {
641641
int pos = _bufptr - _buffer + 1;
642642
tty->print_cr("Error while parsing line %d at position %d: %s\n", line_no, pos, _error_message);
@@ -652,7 +652,7 @@ class CompileReplay : public StackObj {
652652
reset();
653653
}
654654

655-
void process_command(TRAPS) {
655+
void process_command(bool is_replay_inline, TRAPS) {
656656
char* cmd = parse_string();
657657
if (cmd == nullptr) {
658658
return;
@@ -670,20 +670,24 @@ class CompileReplay : public StackObj {
670670
}
671671
} else if (strcmp("compile", cmd) == 0) {
672672
process_compile(CHECK);
673-
} else if (strcmp("ciMethod", cmd) == 0) {
674-
process_ciMethod(CHECK);
675-
} else if (strcmp("ciMethodData", cmd) == 0) {
676-
process_ciMethodData(CHECK);
677-
} else if (strcmp("staticfield", cmd) == 0) {
678-
process_staticfield(CHECK);
679-
} else if (strcmp("ciInstanceKlass", cmd) == 0) {
680-
process_ciInstanceKlass(CHECK);
681-
} else if (strcmp("instanceKlass", cmd) == 0) {
682-
process_instanceKlass(CHECK);
673+
} else if (!is_replay_inline) {
674+
if (strcmp("ciMethod", cmd) == 0) {
675+
process_ciMethod(CHECK);
676+
} else if (strcmp("ciMethodData", cmd) == 0) {
677+
process_ciMethodData(CHECK);
678+
} else if (strcmp("staticfield", cmd) == 0) {
679+
process_staticfield(CHECK);
680+
} else if (strcmp("ciInstanceKlass", cmd) == 0) {
681+
process_ciInstanceKlass(CHECK);
682+
} else if (strcmp("instanceKlass", cmd) == 0) {
683+
process_instanceKlass(CHECK);
683684
#if INCLUDE_JVMTI
684-
} else if (strcmp("JvmtiExport", cmd) == 0) {
685-
process_JvmtiExport(CHECK);
685+
} else if (strcmp("JvmtiExport", cmd) == 0) {
686+
process_JvmtiExport(CHECK);
686687
#endif // INCLUDE_JVMTI
688+
} else {
689+
report_error("unknown command");
690+
}
687691
} else {
688692
report_error("unknown command");
689693
}
@@ -723,12 +727,7 @@ class CompileReplay : public StackObj {
723727
int c = getc(_stream);
724728
while(c != EOF) {
725729
c = get_line(c);
726-
// Expecting only lines with "compile" command in inline replay file.
727-
char* cmd = parse_string();
728-
if (cmd == nullptr || strcmp("compile", cmd) != 0) {
729-
return nullptr;
730-
}
731-
process_compile(CHECK_NULL);
730+
process_command(true, CHECK_NULL);
732731
if (had_error()) {
733732
tty->print_cr("Error while parsing line %d: %s\n", line_no, _error_message);
734733
tty->print_cr("%s", _buffer);

0 commit comments

Comments
 (0)