aboutsummaryrefslogtreecommitdiff
path: root/src/share/vm/runtime
diff options
context:
space:
mode:
authorminqi <none@none>2012-11-12 14:03:53 -0800
committerminqi <none@none>2012-11-12 14:03:53 -0800
commita0a063373b4bea636f530a6f1d8535108015c0f0 (patch)
tree771f25e40ff64de77f93c22b658957881cab87ea /src/share/vm/runtime
parentf2147cb21125cde235827d0a9f9c340738cd807f (diff)
6830717: replay of compilations would help with debugging
Summary: When java process crashed in compiler thread, repeat the compilation process will help finding root cause. This is done with using SA dump application class data and replay data from core dump, then use debug version of jvm to recompile the problematic java method. Reviewed-by: kvn, twisti, sspitsyn Contributed-by: yumin.qi@oracle.com
Diffstat (limited to 'src/share/vm/runtime')
-rw-r--r--src/share/vm/runtime/compilationPolicy.cpp13
-rw-r--r--src/share/vm/runtime/globals.hpp20
-rw-r--r--src/share/vm/runtime/vmStructs.cpp1
3 files changed, 34 insertions, 0 deletions
diff --git a/src/share/vm/runtime/compilationPolicy.cpp b/src/share/vm/runtime/compilationPolicy.cpp
index 73b8f8393..713163a10 100644
--- a/src/share/vm/runtime/compilationPolicy.cpp
+++ b/src/share/vm/runtime/compilationPolicy.cpp
@@ -97,6 +97,9 @@ void CompilationPolicy::completed_vm_startup() {
// This is intended to force compiles for methods (usually for
// debugging) that would otherwise be interpreted for some reason.
bool CompilationPolicy::must_be_compiled(methodHandle m, int comp_level) {
+ // Don't allow Xcomp to cause compiles in replay mode
+ if (ReplayCompiles) return false;
+
if (m->has_compiled_code()) return false; // already compiled
if (!can_be_compiled(m, comp_level)) return false;
@@ -322,6 +325,16 @@ nmethod* NonTieredCompPolicy::event(methodHandle method, methodHandle inlinee, i
return NULL;
}
}
+ if (CompileTheWorld || ReplayCompiles) {
+ // Don't trigger other compiles in testing mode
+ if (bci == InvocationEntryBci) {
+ reset_counter_for_invocation_event(method);
+ } else {
+ reset_counter_for_back_branch_event(method);
+ }
+ return NULL;
+ }
+
if (bci == InvocationEntryBci) {
// when code cache is full, compilation gets switched off, UseCompiler
// is set to false
diff --git a/src/share/vm/runtime/globals.hpp b/src/share/vm/runtime/globals.hpp
index 62ad97f89..785965ca3 100644
--- a/src/share/vm/runtime/globals.hpp
+++ b/src/share/vm/runtime/globals.hpp
@@ -3189,6 +3189,26 @@ class CommandLineFlags {
product(ccstrlist, CompileCommand, "", \
"Prepend to .hotspot_compiler; e.g. log,java/lang/String.<init>") \
\
+ develop(bool, ReplayCompiles, false, \
+ "Enable replay of compilations from ReplayDataFile") \
+ \
+ develop(ccstr, ReplayDataFile, "replay.txt", \
+ "file containing compilation replay information") \
+ \
+ develop(intx, ReplaySuppressInitializers, 2, \
+ "Controls handling of class initialization during replay" \
+ "0 - don't do anything special" \
+ "1 - treat all class initializers as empty" \
+ "2 - treat class initializers for application classes as empty" \
+ "3 - allow all class initializers to run during bootstrap but" \
+ " pretend they are empty after starting replay") \
+ \
+ develop(bool, ReplayIgnoreInitErrors, false, \
+ "Ignore exceptions thrown during initialization for replay") \
+ \
+ develop(bool, DumpReplayDataOnError, true, \
+ "record replay data for crashing compiler threads") \
+ \
product(bool, CICompilerCountPerCPU, false, \
"1 compiler thread for log(N CPUs)") \
\
diff --git a/src/share/vm/runtime/vmStructs.cpp b/src/share/vm/runtime/vmStructs.cpp
index eb6d3cd78..484566125 100644
--- a/src/share/vm/runtime/vmStructs.cpp
+++ b/src/share/vm/runtime/vmStructs.cpp
@@ -993,6 +993,7 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
\
nonstatic_field(ciMethod, _interpreter_invocation_count, int) \
nonstatic_field(ciMethod, _interpreter_throwout_count, int) \
+ nonstatic_field(ciMethod, _instructions_size, int) \
\
nonstatic_field(ciMethodData, _data_size, int) \
nonstatic_field(ciMethodData, _state, u_char) \