< prev index next >

src/share/vm/opto/shenandoahSupport.cpp

Print this page
rev 10526 : [backport] Perform gc-state checks with LoadB to fit C2 matchers
rev 10541 : [backport] Make in-cset checks use signed bytes to match C2 better
rev 10585 : [backport] Handle missing ShenandoahWriteBarrierRB case
rev 10589 : [backport] Purge support for ShenandoahConcurrentEvacCodeRoots and ShenandoahBarriersForConst

@@ -102,11 +102,11 @@
     // tty->print_cr("killed barrier for NULL object");
     return false;
   }
   if (type->make_oopptr() && type->make_oopptr()->const_oop() != NULL) {
     // tty->print_cr("killed barrier for constant object");
-    return ShenandoahBarriersForConst;
+    return false;
   }
 
   if (ShenandoahOptimizeStableFinals) {
     const TypeAryPtr* ary = type->isa_aryptr();
     if (ary && ary->is_stable() && allow_fromspace) {

@@ -778,11 +778,11 @@
         continue;
       } else if (in->is_AddP()) {
         assert(!in->in(AddPNode::Address)->is_top(), "no raw memory access");
         in = in->in(AddPNode::Address);
         continue;
-      } else if (in->is_Con() && !ShenandoahBarriersForConst) {
+      } else if (in->is_Con()) {
         if (trace) {tty->print("Found constant"); in->dump();}
       } else if (in->is_ShenandoahBarrier()) {
         if (t == ShenandoahStore && in->Opcode() != Op_ShenandoahWriteBarrier) {
           return false;
         }

@@ -2286,87 +2286,10 @@
   }
 
   return NULL;
 }
 
-const TypePtr* ShenandoahBarrierNode::fix_addp_type(const TypePtr* res, Node* base) {
-  if (UseShenandoahGC && ShenandoahBarriersForConst) {
-    // With barriers on constant oops, if a field being accessed is a
-    // static field, correct alias analysis requires that we look
-    // beyond the barriers (that hide the constant) to find the actual
-    // java class mirror constant.
-    const TypeInstPtr* ti = res->isa_instptr();
-    if (ti != NULL &&
-        ti->const_oop() == NULL &&
-        ti->klass() == ciEnv::current()->Class_klass() &&
-        ti->offset() >= (ti->klass()->as_instance_klass()->size_helper() * wordSize)) {
-      ResourceMark rm;
-      Unique_Node_List wq;
-      ciObject* const_oop = NULL;
-      wq.push(base);
-      for (uint i = 0; i < wq.size(); i++) {
-        Node *n = wq.at(i);
-        if (n->is_ShenandoahBarrier() ||
-            (n->is_Mach() && n->as_Mach()->ideal_Opcode() == Op_ShenandoahReadBarrier)) {
-          Node* m = n->in(ShenandoahBarrierNode::ValueIn);
-          if (m != NULL) {
-            wq.push(m);
-          }
-        } else if (n->is_Phi()) {
-          for (uint j = 1; j < n->req(); j++) {
-            Node* m = n->in(j);
-            if (m != NULL) {
-              wq.push(m);
-            }
-          }
-        } else if (n->is_ConstraintCast() || (n->is_Mach() && n->as_Mach()->ideal_Opcode() == Op_CheckCastPP)) {
-          Node* m = n->in(1);
-          if (m != NULL) {
-            wq.push(m);
-          }
-        } else {
-          const TypeInstPtr* tn = n->bottom_type()->isa_instptr();
-          if (tn != NULL) {
-            if (tn->const_oop() != NULL) {
-              if (const_oop == NULL) {
-                const_oop = tn->const_oop();
-              } else if (const_oop != tn->const_oop()) {
-                const_oop = NULL;
-                break;
-              }
-            } else {
-              if (n->is_Proj()) {
-                if (n->in(0)->Opcode() == Op_CallLeafNoFP) {
-                  if (n->in(0)->as_Call()->entry_point() != StubRoutines::shenandoah_wb_C()) {
-                    const_oop = NULL;
-                    break;
-                  }
-                } else if (n->in(0)->is_MachCallLeaf()) {
-                  if (n->in(0)->as_MachCall()->entry_point() != StubRoutines::shenandoah_wb_C()) {
-                    const_oop = NULL;
-                    break;
-                  }
-                }
-              } else {
-                fatal("2 different static fields being accessed with a single AddP");
-                const_oop = NULL;
-                break;
-              }
-            }
-          } else {
-            assert(n->bottom_type() == Type::TOP, "not an instance ptr?");
-          }
-        }
-      }
-      if (const_oop != NULL) {
-        res = ti->cast_to_const(const_oop);
-      }
-    }
-  }
-  return res;
-}
-
 static void shenandoah_disconnect_barrier_mem(Node* wb, PhaseIterGVN& igvn) {
   Node* mem_in = wb->in(ShenandoahBarrierNode::Memory);
   Node* proj = wb->find_out_with(Op_ShenandoahWBMemProj);
 
   for (DUIterator_Last imin, i = proj->last_outs(imin); i >= imin; ) {

@@ -3444,11 +3367,11 @@
 bool ShenandoahBarrierNode::is_gc_state_load(Node *n) {
   if (!UseShenandoahGC) {
     return false;
   }
 
-  if (n->Opcode() != Op_LoadUB && n->Opcode() != Op_LoadB) {
+  if (n->Opcode() != Op_LoadB) {
     return false;
   }
   Node* addp = n->in(MemNode::Address);
   if (!addp->is_AddP()) {
     return false;

@@ -3477,11 +3400,11 @@
   register_new_node(gc_state_addr, ctrl);
   uint gc_state_idx = Compile::AliasIdxRaw;
   const TypePtr* gc_state_adr_type = NULL; // debug-mode-only argument
   debug_only(gc_state_adr_type = C->get_adr_type(gc_state_idx));
 
-  Node* gc_state = new (C) LoadUBNode(ctrl, raw_mem, gc_state_addr, gc_state_adr_type, TypeInt::BYTE, MemNode::unordered);
+  Node* gc_state = new (C) LoadBNode(ctrl, raw_mem, gc_state_addr, gc_state_adr_type, TypeInt::BYTE, MemNode::unordered);
   register_new_node(gc_state, ctrl);
 
   Node* evacuation_in_progress = new (C) AndINode(gc_state, _igvn.intcon(ShenandoahHeap::EVACUATION));
   register_new_node(evacuation_in_progress, ctrl);
   Node* evacuation_in_progress_cmp = new (C) CmpINode(evacuation_in_progress, _igvn.zerocon(T_INT));

@@ -3626,11 +3549,11 @@
     Node* in_cset_fast_test_adr = new (C) AddPNode(C->top(), in_cset_fast_test_base_addr, cset_offset);
     register_new_node(in_cset_fast_test_adr, c);
     uint in_cset_fast_test_idx = Compile::AliasIdxRaw;
     const TypePtr* in_cset_fast_test_adr_type = NULL; // debug-mode-only argument
     debug_only(in_cset_fast_test_adr_type = C->get_adr_type(in_cset_fast_test_idx));
-    Node* in_cset_fast_test_load = new (C) LoadUBNode(c, raw_mem, in_cset_fast_test_adr, in_cset_fast_test_adr_type, TypeInt::BOOL, MemNode::unordered);
+    Node* in_cset_fast_test_load = new (C) LoadBNode(c, raw_mem, in_cset_fast_test_adr, in_cset_fast_test_adr_type, TypeInt::BOOL, MemNode::unordered);
     register_new_node(in_cset_fast_test_load, c);
     Node* in_cset_fast_test_cmp = new (C) CmpINode(in_cset_fast_test_load, _igvn.zerocon(T_INT));
     register_new_node(in_cset_fast_test_cmp, c);
     Node* in_cset_fast_test_test = new (C) BoolNode(in_cset_fast_test_cmp, BoolTest::ne);
     register_new_node(in_cset_fast_test_test, c);

@@ -3656,12 +3579,18 @@
                                                        Node* raw_mem, Node* wb_mem, Node* region, Node* val_phi, Node* mem_phi,
                                                        Node* raw_mem_phi, Node* unc_region, int alias, Unique_Node_List& uses) {
   shenandoah_evacuation_in_progress_null_check(c, val, evacuation_iff, unc, unc_ctrl, unc_region, uses);
 
   IdealLoopTree *loop = get_loop(c);
-  Node* rbtrue = new (C) ShenandoahReadBarrierNode(c, wb_mem, val);
+
+  Node* rbtrue;
+  if (ShenandoahWriteBarrierRB) {
+    rbtrue = new (C) ShenandoahReadBarrierNode(c, wb_mem, val);
   register_new_node(rbtrue, c);
+  } else {
+    rbtrue = val;
+  }
 
   Node* in_cset_fast_test_failure = NULL;
   shenandoah_in_cset_fast_test(c, rbtrue, raw_mem, wb_mem, region, val_phi, mem_phi, raw_mem_phi);
 
   // The slow path stub consumes and produces raw memory in addition
< prev index next >