8043180: SIGSEGV in Events::log_deopt_message
authoriveresov
Thu, 15 May 2014 10:37:52 -0700
changeset 24477 d2442b4a080f
parent 24476 912595db2e75
child 24480 e8a8b38149fb
child 24481 4b3abcef30d8
8043180: SIGSEGV in Events::log_deopt_message Summary: Added missing deopt reason name Reason_tenured Reviewed-by: kvn, twisti
hotspot/src/share/vm/runtime/deoptimization.cpp
hotspot/src/share/vm/runtime/deoptimization.hpp
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp	Thu May 15 09:09:28 2014 +0200
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp	Thu May 15 10:37:52 2014 -0700
@@ -1340,7 +1340,7 @@
         if (xtty != NULL)
           xtty->name(class_name);
       }
-      if (xtty != NULL && trap_mdo != NULL) {
+      if (xtty != NULL && trap_mdo != NULL && (int)reason < (int)MethodData::_trap_hist_limit) {
         // Dump the relevant MDO state.
         // This is the deopt count for the current reason, any previous
         // reasons or recompiles seen at this point.
@@ -1818,7 +1818,7 @@
 
 
 //--------------------------------statics--------------------------------------
-const char* Deoptimization::_trap_reason_name[Reason_LIMIT] = {
+const char* Deoptimization::_trap_reason_name[] = {
   // Note:  Keep this in sync. with enum DeoptReason.
   "none",
   "null_check",
@@ -1839,9 +1839,10 @@
   "loop_limit_check",
   "speculate_class_check",
   "speculate_null_check",
-  "rtm_state_change"
+  "rtm_state_change",
+  "tenured"
 };
-const char* Deoptimization::_trap_action_name[Action_LIMIT] = {
+const char* Deoptimization::_trap_action_name[] = {
   // Note:  Keep this in sync. with enum DeoptAction.
   "none",
   "maybe_recompile",
@@ -1851,6 +1852,9 @@
 };
 
 const char* Deoptimization::trap_reason_name(int reason) {
+  // Check that every reason has a name
+  STATIC_ASSERT(sizeof(_trap_reason_name)/sizeof(const char*) == Reason_LIMIT);
+
   if (reason == Reason_many)  return "many";
   if ((uint)reason < Reason_LIMIT)
     return _trap_reason_name[reason];
@@ -1859,6 +1863,9 @@
   return buf;
 }
 const char* Deoptimization::trap_action_name(int action) {
+  // Check that every action has a name
+  STATIC_ASSERT(sizeof(_trap_action_name)/sizeof(const char*) == Action_LIMIT);
+
   if ((uint)action < Action_LIMIT)
     return _trap_action_name[action];
   static char buf[20];
--- a/hotspot/src/share/vm/runtime/deoptimization.hpp	Thu May 15 09:09:28 2014 +0200
+++ b/hotspot/src/share/vm/runtime/deoptimization.hpp	Thu May 15 10:37:52 2014 -0700
@@ -376,8 +376,8 @@
   static UnrollBlock* fetch_unroll_info_helper(JavaThread* thread);
 
   static DeoptAction _unloaded_action; // == Action_reinterpret;
-  static const char* _trap_reason_name[Reason_LIMIT];
-  static const char* _trap_action_name[Action_LIMIT];
+  static const char* _trap_reason_name[];
+  static const char* _trap_action_name[];
 
   static juint _deoptimization_hist[Reason_LIMIT][1+Action_LIMIT][BC_CASE_LIMIT];
   // Note:  Histogram array size is 1-2 Kb.