8308672: Add version number in the replay file generated by DumpInline

Reviewed-by: kvn
This commit is contained in:
Ashutosh Mehra 2023-05-25 18:31:56 +00:00 committed by Vladimir Kozlov
parent 27ba8bd4ed
commit 7d2a7ce240
3 changed files with 26 additions and 21 deletions
src/hotspot/share/ci

@ -1663,7 +1663,7 @@ void ciEnv::dump_replay_data_helper(outputStream* out) {
NoSafepointVerifier no_safepoint;
ResourceMark rm;
out->print_cr("version %d", REPLAY_VERSION);
dump_replay_data_version(out);
#if INCLUDE_JVMTI
out->print_cr("JvmtiExport can_access_local_variables %d", _jvmti_can_access_local_variables);
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) {
fileStream replay_data_stream(inline_data_file, /*need_close=*/true);
GUARDED_VM_ENTRY(
MutexLocker ml(Compile_lock);
dump_replay_data_version(&replay_data_stream);
dump_compile_data(&replay_data_stream);
)
replay_data_stream.flush();
@ -1742,3 +1743,7 @@ void ciEnv::dump_inline_data(int compile_id) {
}
}
}
void ciEnv::dump_replay_data_version(outputStream* out) {
out->print_cr("version %d", REPLAY_VERSION);
}

@ -496,6 +496,7 @@ public:
void dump_replay_data_unsafe(outputStream* out);
void dump_replay_data_helper(outputStream* out);
void dump_compile_data(outputStream* out);
void dump_replay_data_version(outputStream* out);
const char *dyno_name(const InstanceKlass* ik) const;
const char *replay_name(const InstanceKlass* ik) const;

@ -636,7 +636,7 @@ class CompileReplay : public StackObj {
int c = getc(_stream);
while(c != EOF) {
c = get_line(c);
process_command(THREAD);
process_command(false, THREAD);
if (had_error()) {
int pos = _bufptr - _buffer + 1;
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 {
reset();
}
void process_command(TRAPS) {
void process_command(bool is_replay_inline, TRAPS) {
char* cmd = parse_string();
if (cmd == nullptr) {
return;
@ -670,20 +670,24 @@ class CompileReplay : public StackObj {
}
} else if (strcmp("compile", cmd) == 0) {
process_compile(CHECK);
} else if (strcmp("ciMethod", cmd) == 0) {
process_ciMethod(CHECK);
} else if (strcmp("ciMethodData", cmd) == 0) {
process_ciMethodData(CHECK);
} else if (strcmp("staticfield", cmd) == 0) {
process_staticfield(CHECK);
} else if (strcmp("ciInstanceKlass", cmd) == 0) {
process_ciInstanceKlass(CHECK);
} else if (strcmp("instanceKlass", cmd) == 0) {
process_instanceKlass(CHECK);
} else if (!is_replay_inline) {
if (strcmp("ciMethod", cmd) == 0) {
process_ciMethod(CHECK);
} else if (strcmp("ciMethodData", cmd) == 0) {
process_ciMethodData(CHECK);
} else if (strcmp("staticfield", cmd) == 0) {
process_staticfield(CHECK);
} else if (strcmp("ciInstanceKlass", cmd) == 0) {
process_ciInstanceKlass(CHECK);
} else if (strcmp("instanceKlass", cmd) == 0) {
process_instanceKlass(CHECK);
#if INCLUDE_JVMTI
} else if (strcmp("JvmtiExport", cmd) == 0) {
process_JvmtiExport(CHECK);
} else if (strcmp("JvmtiExport", cmd) == 0) {
process_JvmtiExport(CHECK);
#endif // INCLUDE_JVMTI
} else {
report_error("unknown command");
}
} else {
report_error("unknown command");
}
@ -723,12 +727,7 @@ class CompileReplay : public StackObj {
int c = getc(_stream);
while(c != EOF) {
c = get_line(c);
// Expecting only lines with "compile" command in inline replay file.
char* cmd = parse_string();
if (cmd == nullptr || strcmp("compile", cmd) != 0) {
return nullptr;
}
process_compile(CHECK_NULL);
process_command(true, CHECK_NULL);
if (had_error()) {
tty->print_cr("Error while parsing line %d: %s\n", line_no, _error_message);
tty->print_cr("%s", _buffer);