Mon, 07 Oct 2013 14:11:49 +0400
8024943: ciReplay: fails to dump replay data during safepointing
Reviewed-by: kvn, twisti
1.1 --- a/src/share/vm/ci/ciEnv.cpp Mon Oct 07 14:10:29 2013 +0400 1.2 +++ b/src/share/vm/ci/ciEnv.cpp Mon Oct 07 14:11:49 2013 +0400 1.3 @@ -1154,9 +1154,12 @@ 1.4 GUARDED_VM_ENTRY(return _factory->get_unloaded_object_constant();) 1.5 } 1.6 1.7 -void ciEnv::dump_replay_data(outputStream* out) { 1.8 - VM_ENTRY_MARK; 1.9 - MutexLocker ml(Compile_lock); 1.10 +// ------------------------------------------------------------------ 1.11 +// ciEnv::dump_replay_data* 1.12 + 1.13 +// Don't change thread state and acquire any locks. 1.14 +// Safe to call from VM error reporter. 1.15 +void ciEnv::dump_replay_data_unsafe(outputStream* out) { 1.16 ResourceMark rm; 1.17 #if INCLUDE_JVMTI 1.18 out->print_cr("JvmtiExport can_access_local_variables %d", _jvmti_can_access_local_variables); 1.19 @@ -1181,3 +1184,10 @@ 1.20 entry_bci, comp_level); 1.21 out->flush(); 1.22 } 1.23 + 1.24 +void ciEnv::dump_replay_data(outputStream* out) { 1.25 + GUARDED_VM_ENTRY( 1.26 + MutexLocker ml(Compile_lock); 1.27 + dump_replay_data_unsafe(out); 1.28 + ) 1.29 +}
2.1 --- a/src/share/vm/ci/ciEnv.hpp Mon Oct 07 14:10:29 2013 +0400 2.2 +++ b/src/share/vm/ci/ciEnv.hpp Mon Oct 07 14:11:49 2013 +0400 2.3 @@ -452,6 +452,7 @@ 2.4 2.5 // Dump the compilation replay data for the ciEnv to the stream. 2.6 void dump_replay_data(outputStream* out); 2.7 + void dump_replay_data_unsafe(outputStream* out); 2.8 }; 2.9 2.10 #endif // SHARE_VM_CI_CIENV_HPP
3.1 --- a/src/share/vm/ci/ciInstanceKlass.cpp Mon Oct 07 14:10:29 2013 +0400 3.2 +++ b/src/share/vm/ci/ciInstanceKlass.cpp Mon Oct 07 14:11:49 2013 +0400 3.3 @@ -671,7 +671,6 @@ 3.4 3.5 3.6 void ciInstanceKlass::dump_replay_data(outputStream* out) { 3.7 - ASSERT_IN_VM; 3.8 ResourceMark rm; 3.9 3.10 InstanceKlass* ik = get_instanceKlass();
4.1 --- a/src/share/vm/ci/ciMethod.cpp Mon Oct 07 14:10:29 2013 +0400 4.2 +++ b/src/share/vm/ci/ciMethod.cpp Mon Oct 07 14:11:49 2013 +0400 4.3 @@ -1247,7 +1247,6 @@ 4.4 #undef FETCH_FLAG_FROM_VM 4.5 4.6 void ciMethod::dump_replay_data(outputStream* st) { 4.7 - ASSERT_IN_VM; 4.8 ResourceMark rm; 4.9 Method* method = get_Method(); 4.10 MethodCounters* mcs = method->method_counters();
5.1 --- a/src/share/vm/ci/ciMethodData.cpp Mon Oct 07 14:10:29 2013 +0400 5.2 +++ b/src/share/vm/ci/ciMethodData.cpp Mon Oct 07 14:11:49 2013 +0400 5.3 @@ -373,7 +373,6 @@ 5.4 } 5.5 5.6 void ciMethodData::dump_replay_data(outputStream* out) { 5.7 - ASSERT_IN_VM; 5.8 ResourceMark rm; 5.9 MethodData* mdo = get_MethodData(); 5.10 Method* method = mdo->method();
6.1 --- a/src/share/vm/utilities/vmError.cpp Mon Oct 07 14:10:29 2013 +0400 6.2 +++ b/src/share/vm/utilities/vmError.cpp Mon Oct 07 14:11:49 2013 +0400 6.3 @@ -1050,7 +1050,7 @@ 6.4 FILE* replay_data_file = os::open(fd, "w"); 6.5 if (replay_data_file != NULL) { 6.6 fileStream replay_data_stream(replay_data_file, /*need_close=*/true); 6.7 - env->dump_replay_data(&replay_data_stream); 6.8 + env->dump_replay_data_unsafe(&replay_data_stream); 6.9 out.print_raw("#\n# Compiler replay data is saved as:\n# "); 6.10 out.print_raw_cr(buffer); 6.11 } else {