changeset 22709:6832e10a0b97

Fix missing comma and add STATIC_ASSERT to check size of trap name talbe
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Wed, 28 Oct 2015 14:02:20 -0700
parents 8017f84cce74
children 7e7573382a23
files src/share/vm/runtime/deoptimization.cpp src/share/vm/runtime/deoptimization.hpp
diffstat 2 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/runtime/deoptimization.cpp	Tue Oct 27 13:33:28 2015 +0100
+++ b/src/share/vm/runtime/deoptimization.cpp	Wed Oct 28 14:02:20 2015 -0700
@@ -2119,7 +2119,7 @@
 //--------------------------------statics--------------------------------------
 Deoptimization::DeoptAction Deoptimization::_unloaded_action
   = Deoptimization::Action_reinterpret;
-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",
@@ -2140,7 +2140,7 @@
   "loop_limit_check",
   "speculate_class_check",
   "rtm_state_change",
-  "unstable_if"
+  "unstable_if",
 #if INCLUDE_JVMCI
   "aliasing",
   "transfer_to_interpreter",
@@ -2149,7 +2149,7 @@
   "jsr_mismatch"
 #endif
 };
-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",
@@ -2159,6 +2159,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];
@@ -2167,6 +2170,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/src/share/vm/runtime/deoptimization.hpp	Tue Oct 27 13:33:28 2015 +0100
+++ b/src/share/vm/runtime/deoptimization.hpp	Wed Oct 28 14:02:20 2015 -0700
@@ -410,8 +410,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.