diff src/share/vm/runtime/deoptimization.cpp @ 17780:606acabe7b5c

8031320: Use Intel RTM instructions for locks Summary: Use RTM for inflated locks and stack locks. Reviewed-by: iveresov, twisti, roland, dcubed
author kvn
date Thu, 20 Mar 2014 17:49:27 -0700
parents b8413a9cbb84
children 62c54fcc0a35
line wrap: on
line diff
--- a/src/share/vm/runtime/deoptimization.cpp	Sat Mar 22 00:26:48 2014 +0400
+++ b/src/share/vm/runtime/deoptimization.cpp	Thu Mar 20 17:49:27 2014 -0700
@@ -1285,7 +1285,8 @@
     gather_statistics(reason, action, trap_bc);
 
     // Ensure that we can record deopt. history:
-    bool create_if_missing = ProfileTraps;
+    // Need MDO to record RTM code generation state.
+    bool create_if_missing = ProfileTraps RTM_OPT_ONLY( || UseRTMLocking );
 
     MethodData* trap_mdo =
       get_method_data(thread, trap_method, create_if_missing);
@@ -1566,6 +1567,17 @@
         if (tstate1 != tstate0)
           pdata->set_trap_state(tstate1);
       }
+
+#if INCLUDE_RTM_OPT
+      // Restart collecting RTM locking abort statistic if the method
+      // is recompiled for a reason other than RTM state change.
+      // Assume that in new recompiled code the statistic could be different,
+      // for example, due to different inlining.
+      if ((reason != Reason_rtm_state_change) && (trap_mdo != NULL) &&
+          UseRTMDeopt && (nm->rtm_state() != ProfileRTM)) {
+        trap_mdo->atomic_set_rtm_state(ProfileRTM);
+      }
+#endif
     }
 
     if (inc_recompile_count) {
@@ -1823,7 +1835,8 @@
   "age",
   "predicate",
   "loop_limit_check",
-  "speculate_class_check"
+  "speculate_class_check",
+  "rtm_state_change"
 };
 const char* Deoptimization::_trap_action_name[Action_LIMIT] = {
   // Note:  Keep this in sync. with enum DeoptAction.