changeset 5036:8e6db1a5c537

exit the VM when an endless recompilation is detected
author Christian Haeubl <christian.haeubl@oracle.com>
date Mon, 05 Mar 2012 12:01:38 -0800
parents cbedef8b4d15
children e77a7d510c85
files src/share/vm/code/nmethod.cpp src/share/vm/oops/methodDataOop.cpp src/share/vm/oops/methodDataOop.hpp
diffstat 3 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/code/nmethod.cpp	Sun Mar 04 18:56:25 2012 -0800
+++ b/src/share/vm/code/nmethod.cpp	Mon Mar 05 12:01:38 2012 -0800
@@ -1178,7 +1178,9 @@
 }
 
 void nmethod::inc_decompile_count() {
+#ifndef GRAAL
   if (!is_compiled_by_c2()) return;
+#endif
   // Could be gated by ProfileTraps, but do not bother...
   methodOop m = method();
   if (m == NULL)  return;
--- a/src/share/vm/oops/methodDataOop.cpp	Sun Mar 04 18:56:25 2012 -0800
+++ b/src/share/vm/oops/methodDataOop.cpp	Mon Mar 05 12:01:38 2012 -0800
@@ -861,6 +861,19 @@
   return CompilationPolicy::policy()->is_mature(_method);
 }
 
+void methodDataOopDesc::inc_decompile_count() {
+  _nof_decompiles += 1;
+  if (decompile_count() > (uint)PerMethodRecompilationCutoff) {
+#ifdef GRAAL
+    // TODO (ch) enable this in the fastdebug build only once we are more stable
+    ResourceMark m;
+    tty->print_cr("WARN: endless recompilation of %s. Method was set to not compilable.", method()->name_and_sig_as_C_string());
+    vm_exit(1);
+#endif
+    method()->set_not_compilable(CompLevel_full_optimization);
+  }
+}
+
 // Translate a bci to its corresponding data index (di).
 address methodDataOopDesc::bci_to_dp(int bci) {
   ResourceMark rm;
--- a/src/share/vm/oops/methodDataOop.hpp	Sun Mar 04 18:56:25 2012 -0800
+++ b/src/share/vm/oops/methodDataOop.hpp	Mon Mar 05 12:01:38 2012 -0800
@@ -1507,12 +1507,7 @@
   uint decompile_count() const {
     return _nof_decompiles;
   }
-  void inc_decompile_count() {
-    _nof_decompiles += 1;
-    if (decompile_count() > (uint)PerMethodRecompilationCutoff) {
-      method()->set_not_compilable(CompLevel_full_optimization);
-    }
-  }
+  void inc_decompile_count();
 
   // Support for code generation
   static ByteSize data_offset() {