src/hotspot/share/opto/node.cpp
changeset 50180 ffa644980dff
parent 49908 22eb3e22f245
child 50525 767cdb97f103
--- a/src/hotspot/share/opto/node.cpp	Fri May 18 15:21:23 2018 +0200
+++ b/src/hotspot/share/opto/node.cpp	Fri May 18 14:51:06 2018 +0200
@@ -23,6 +23,8 @@
  */
 
 #include "precompiled.hpp"
+#include "gc/shared/barrierSet.hpp"
+#include "gc/shared/c2/barrierSetC2.hpp"
 #include "libadt/vectset.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
@@ -37,6 +39,7 @@
 #include "opto/regmask.hpp"
 #include "opto/type.hpp"
 #include "utilities/copy.hpp"
+#include "utilities/macros.hpp"
 
 class RegMask;
 // #include "phase.hpp"
@@ -499,6 +502,8 @@
     C->add_macro_node(n);
   if (is_expensive())
     C->add_expensive_node(n);
+  BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
+  bs->register_potential_barrier_node(n);
   // If the cloned node is a range check dependent CastII, add it to the list.
   CastIINode* cast = n->isa_CastII();
   if (cast != NULL && cast->has_range_check()) {
@@ -622,6 +627,8 @@
   if (is_SafePoint()) {
     as_SafePoint()->delete_replaced_nodes();
   }
+  BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
+  bs->unregister_potential_barrier_node(this);
 #ifdef ASSERT
   // We will not actually delete the storage, but we'll make the node unusable.
   *(address*)this = badAddress;  // smash the C++ vtbl, probably
@@ -1361,6 +1368,8 @@
       if (dead->Opcode() == Op_Opaque4) {
         igvn->C->remove_range_check_cast(dead);
       }
+      BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
+      bs->unregister_potential_barrier_node(dead);
       igvn->C->record_dead_node(dead->_idx);
       // Kill all inputs to the dead guy
       for (uint i=0; i < dead->req(); i++) {
@@ -1379,6 +1388,8 @@
             // The restriction (outcnt() <= 2) is the same as in set_req_X()
             // and remove_globally_dead_node().
             igvn->add_users_to_worklist( n );
+          } else {
+            BarrierSet::barrier_set()->barrier_set_c2()->enqueue_useful_gc_barrier(igvn->_worklist, n);
           }
         }
       }