< prev index next >

src/hotspot/share/opto/callnode.cpp

Print this page

        

@@ -24,10 +24,11 @@
 
 #include "precompiled.hpp"
 #include "compiler/compileLog.hpp"
 #include "ci/bcEscapeAnalyzer.hpp"
 #include "compiler/oopMap.hpp"
+#include "gc/shared/barrierSet.hpp"
 #include "interpreter/interpreter.hpp"
 #include "opto/callGenerator.hpp"
 #include "opto/callnode.hpp"
 #include "opto/castnode.hpp"
 #include "opto/convertnode.hpp"

@@ -1095,10 +1096,18 @@
   st->print("%s", _name);
   CallNode::dump_spec(st);
 }
 #endif
 
+Node *CallLeafNode::Ideal(PhaseGVN *phase, bool can_reshape) {
+  Node* ideal = BarrierSet::barrier_set()->barrier_set_c2()->ideal_node(phase, this, can_reshape);
+  if (ideal != NULL) {
+    return ideal;
+  }
+  return CallNode::Ideal(phase, can_reshape);
+}
+
 //=============================================================================
 
 void SafePointNode::set_local(JVMState* jvms, uint idx, Node *c) {
   assert(verify_jvms(jvms), "jvms must match");
   int loc = jvms->locoff() + idx;

@@ -1636,11 +1645,18 @@
   ProjNode *ctrl_proj = (ctrl->is_Proj()) ? ctrl->as_Proj() : NULL;
   if (ctrl_proj != NULL && ctrl_proj->_con == TypeFunc::Control) {
     Node *n = ctrl_proj->in(0);
     if (n != NULL && n->is_Unlock()) {
       UnlockNode *unlock = n->as_Unlock();
-      if (lock->obj_node()->eqv_uncast(unlock->obj_node()) &&
+      Node* lock_obj = lock->obj_node();
+      Node* unlock_obj = unlock->obj_node();
+      if (UseShenandoahGC) {
+        BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
+        lock_obj = bs->step_over_gc_barrier(lock_obj);
+        unlock_obj = bs->step_over_gc_barrier(unlock_obj);
+      }
+      if (lock_obj->eqv_uncast(unlock_obj) &&
           BoxLockNode::same_slot(lock->box_node(), unlock->box_node()) &&
           !unlock->is_eliminated()) {
         lock_ops.append(unlock);
         return true;
       }

@@ -1681,11 +1697,18 @@
       ctrl = next_control(ctrl->in(0));  // keep searching
     }
   }
   if (ctrl->is_Lock()) {
     LockNode *lock = ctrl->as_Lock();
-    if (lock->obj_node()->eqv_uncast(unlock->obj_node()) &&
+    Node* lock_obj = lock->obj_node();
+    Node* unlock_obj = unlock->obj_node();
+    if (UseShenandoahGC) {
+      BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
+      lock_obj = bs->step_over_gc_barrier(lock_obj);
+      unlock_obj = bs->step_over_gc_barrier(unlock_obj);
+    }
+    if (lock_obj->eqv_uncast(unlock_obj) &&
         BoxLockNode::same_slot(lock->box_node(), unlock->box_node())) {
       lock_result = lock;
     }
   }
   return lock_result;

@@ -1712,11 +1735,18 @@
           lock1_node = proj->unique_out();
         }
       }
       if (lock1_node != NULL && lock1_node->is_Lock()) {
         LockNode *lock1 = lock1_node->as_Lock();
-        if (lock->obj_node()->eqv_uncast(lock1->obj_node()) &&
+        Node* lock_obj = lock->obj_node();
+        Node* lock1_obj = lock1->obj_node();
+        if (UseShenandoahGC) {
+          BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
+          lock_obj = bs->step_over_gc_barrier(lock_obj);
+          lock1_obj = bs->step_over_gc_barrier(lock1_obj);
+        }
+        if (lock_obj->eqv_uncast(lock1_obj) &&
             BoxLockNode::same_slot(lock->box_node(), lock1->box_node()) &&
             !lock1->is_eliminated()) {
           lock_ops.append(lock1);
           return true;
         }

@@ -1929,20 +1959,27 @@
     this->log_lock_optimization(c, "eliminate_lock_INLR_2b");
 #endif
     return false;
   }
 
+  BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
+  if (UseShenandoahGC) {
+    obj = bs->step_over_gc_barrier(obj);
+  }
   // Look for external lock for the same object.
   SafePointNode* sfn = this->as_SafePoint();
   JVMState* youngest_jvms = sfn->jvms();
   int max_depth = youngest_jvms->depth();
   for (int depth = 1; depth <= max_depth; depth++) {
     JVMState* jvms = youngest_jvms->of_depth(depth);
     int num_mon  = jvms->nof_monitors();
     // Loop over monitors
     for (int idx = 0; idx < num_mon; idx++) {
       Node* obj_node = sfn->monitor_obj(jvms, idx);
+      if (UseShenandoahGC) {
+        obj_node = bs->step_over_gc_barrier(obj_node);
+      }
       BoxLockNode* box_node = sfn->monitor_box(jvms, idx)->as_BoxLock();
       if ((box_node->stack_slot() < stk_slot) && obj_node->eqv_uncast(obj)) {
         return true;
       }
     }
< prev index next >