hotspot/src/share/vm/opto/graphKit.cpp
changeset 29193 3ede621e9262
parent 29181 89beae49867c
parent 29089 c3404869ce6e
child 29362 4188dc7f05a8
--- a/hotspot/src/share/vm/opto/graphKit.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/hotspot/src/share/vm/opto/graphKit.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1528,7 +1528,6 @@
     case BarrierSet::ModRef:
       break;
 
-    case BarrierSet::Other:
     default      :
       ShouldNotReachHere();
 
@@ -1547,7 +1546,6 @@
     case BarrierSet::ModRef:
       return true; // There is no pre-barrier
 
-    case BarrierSet::Other:
     default      :
       ShouldNotReachHere();
   }
@@ -1578,7 +1576,6 @@
     case BarrierSet::ModRef:
       break;
 
-    case BarrierSet::Other:
     default      :
       ShouldNotReachHere();
 
@@ -1989,6 +1986,11 @@
         Deoptimization::trap_request_index(trap_request) < 0 &&
         too_many_recompiles(reason)) {
       // This BCI is causing too many recompilations.
+      if (C->log() != NULL) {
+        C->log()->elem("observe that='trap_action_change' reason='%s' from='%s' to='none'",
+                Deoptimization::trap_reason_name(reason),
+                Deoptimization::trap_action_name(action));
+      }
       action = Deoptimization::Action_none;
       trap_request = Deoptimization::make_trap_request(reason, action);
     } else {
@@ -2763,7 +2765,7 @@
   Deoptimization::DeoptReason reason = Deoptimization::reason_class_check(spec_klass != NULL);
 
   // Make sure we haven't already deoptimized from this tactic.
-  if (too_many_traps(reason))
+  if (too_many_traps(reason) || too_many_recompiles(reason))
     return NULL;
 
   // (No, this isn't a call, but it's enough like a virtual call
@@ -2785,8 +2787,7 @@
                                             &exact_obj);
       { PreserveJVMState pjvms(this);
         set_control(slow_ctl);
-        uncommon_trap(reason,
-                      Deoptimization::Action_maybe_recompile);
+        uncommon_trap_exact(reason, Deoptimization::Action_maybe_recompile);
       }
       if (safe_for_replace) {
         replace_in_map(not_null_obj, exact_obj);
@@ -2815,8 +2816,12 @@
   if (type != NULL) {
     Deoptimization::DeoptReason class_reason = Deoptimization::Reason_speculate_class_check;
     Deoptimization::DeoptReason null_reason = Deoptimization::Reason_speculate_null_check;
-    if (!too_many_traps(null_reason) &&
-        !too_many_traps(class_reason)) {
+    ciMethod* trap_method = (sfpt == NULL) ? method() : sfpt->jvms()->method();
+    int trap_bci = (sfpt == NULL) ? bci() : sfpt->jvms()->bci();
+
+    if (!too_many_traps(null_reason) && !too_many_recompiles(null_reason) &&
+        !C->too_many_traps(trap_method, trap_bci, class_reason) &&
+        !C->too_many_recompiles(trap_method, trap_bci, class_reason)) {
       Node* not_null_obj = NULL;
       // not_null is true if we know the object is not null and
       // there's no need for a null check
@@ -2836,19 +2841,18 @@
         GraphKit kit(sfpt->jvms());
         PreserveJVMState pjvms(&kit);
         kit.set_control(slow_ctl);
-        kit.uncommon_trap(class_reason,
-                          Deoptimization::Action_maybe_recompile);
+        kit.uncommon_trap_exact(class_reason, Deoptimization::Action_maybe_recompile);
       } else {
         PreserveJVMState pjvms(this);
         set_control(slow_ctl);
-        uncommon_trap(class_reason,
-                      Deoptimization::Action_maybe_recompile);
+        uncommon_trap_exact(class_reason, Deoptimization::Action_maybe_recompile);
       }
       replace_in_map(not_null_obj, exact_obj);
       obj = exact_obj;
     }
   } else {
-    if (!too_many_traps(Deoptimization::Reason_null_assert)) {
+    if (!too_many_traps(Deoptimization::Reason_null_assert) &&
+        !too_many_recompiles(Deoptimization::Reason_null_assert)) {
       Node* exact_obj = null_assert(obj);
       replace_in_map(obj, exact_obj);
       obj = exact_obj;
@@ -3240,6 +3244,9 @@
 
   const TypeFunc *tf = OptoRuntime::complete_monitor_exit_Type();
   UnlockNode *unlock = new UnlockNode(C, tf);
+#ifdef ASSERT
+  unlock->set_dbg_jvms(sync_jvms());
+#endif
   uint raw_idx = Compile::AliasIdxRaw;
   unlock->init_req( TypeFunc::Control, control() );
   unlock->init_req( TypeFunc::Memory , memory(raw_idx) );
@@ -3750,6 +3757,17 @@
   sync_kit(ideal);
 }
 
+Node* GraphKit::byte_map_base_node() {
+  // Get base of card map
+  CardTableModRefBS* ct = (CardTableModRefBS*)(Universe::heap()->barrier_set());
+  assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust users of this code");
+  if (ct->byte_map_base != NULL) {
+    return makecon(TypeRawPtr::make((address)ct->byte_map_base));
+  } else {
+    return null();
+  }
+}
+
 // vanilla/CMS post barrier
 // Insert a write-barrier store.  This is to let generational GC work; we have
 // to flag all oop-stores before the next GC point.