< prev index next >

src/share/vm/opto/macro.cpp

Print this page

        

@@ -39,10 +39,15 @@
 #include "opto/rootnode.hpp"
 #include "opto/runtime.hpp"
 #include "opto/subnode.hpp"
 #include "opto/type.hpp"
 #include "runtime/sharedRuntime.hpp"
+#if INCLUDE_ALL_GCS
+#include "gc_implementation/shenandoah/shenandoahForwarding.hpp"
+#include "gc_implementation/shenandoah/c2/shenandoahBarrierSetC2.hpp"
+#include "gc_implementation/shenandoah/c2/shenandoahSupport.hpp"
+#endif
 
 
 //
 // Replace any references to "oldref" in inputs to "use" with "newref".
 // Returns the number of replacements made.

@@ -442,11 +447,17 @@
         return NULL;  // can't find a value on this path
       }
       if (val == mem) {
         values.at_put(j, mem);
       } else if (val->is_Store()) {
-        values.at_put(j, val->in(MemNode::ValueIn));
+        Node* n = val->in(MemNode::ValueIn);
+#if INCLUDE_ALL_GCS
+        if (UseShenandoahGC) {
+          n = ShenandoahBarrierSetC2::bsc2()->step_over_gc_barrier(n);
+        }
+#endif
+        values.at_put(j, n);
       } else if(val->is_Proj() && val->in(0) == alloc) {
         values.at_put(j, _igvn.zerocon(ft));
       } else if (val->is_Phi()) {
         val = value_from_mem_phi(val, ft, phi_type, adr_t, alloc, value_phis, level-1);
         if (val == NULL) {

@@ -544,11 +555,17 @@
   if (mem != NULL) {
     if (mem == start_mem || mem == alloc_mem) {
       // hit a sentinel, return appropriate 0 value
       return _igvn.zerocon(ft);
     } else if (mem->is_Store()) {
-      return mem->in(MemNode::ValueIn);
+      Node* n = mem->in(MemNode::ValueIn);
+#if INCLUDE_ALL_GCS
+      if (UseShenandoahGC) {
+        n = ShenandoahBarrierSetC2::bsc2()->step_over_gc_barrier(n);
+      }
+#endif
+      return n;
     } else if (mem->is_Phi()) {
       // attempt to produce a Phi reflecting the values on the input paths of the Phi
       Node_Stack value_phis(a, 8);
       Node * phi = value_from_mem_phi(mem, ft, ftype, adr_t, alloc, &value_phis, ValueSearchLimit);
       if (phi != NULL) {

@@ -611,11 +628,12 @@
           break;
         }
         for (DUIterator_Fast kmax, k = use->fast_outs(kmax);
                                    k < kmax && can_eliminate; k++) {
           Node* n = use->fast_out(k);
-          if (!n->is_Store() && n->Opcode() != Op_CastP2X) {
+          if (!n->is_Store() && n->Opcode() != Op_CastP2X &&
+              (!UseShenandoahGC || !n->is_g1_wb_pre_call())) {
             DEBUG_ONLY(disq_node = n;)
             if (n->is_Load() || n->is_LoadStore()) {
               NOT_PRODUCT(fail_eliminate = "Field load";)
             } else {
               NOT_PRODUCT(fail_eliminate = "Not store field referrence";)

@@ -882,15 +900,18 @@
                      mb->in(MemBarNode::Precedent) != n,
                      "MemBarVolatile should be eliminated for non-escaping object");
             }
 #endif
             _igvn.replace_node(n, n->in(MemNode::Memory));
+          } else if (UseShenandoahGC && n->is_g1_wb_pre_call()) {
+            C->shenandoah_eliminate_g1_wb_pre(n, &_igvn);
           } else {
             eliminate_card_mark(n);
           }
           k -= (oc2 - use->outcnt());
         }
+        _igvn.remove_dead_node(use);
       } else {
         eliminate_card_mark(use);
       }
       j -= (oc1 - res->outcnt());
     }

@@ -1383,11 +1404,17 @@
     // MemBarStoreStore was already added. If the object does not
     // escape no need for a MemBarStoreStore. Otherwise we need a
     // MemBarStoreStore so that stores that initialize this object
     // can't be reordered with a subsequent store that makes this
     // object accessible by other threads.
-    if (init == NULL || (!init->is_complete_with_arraycopy() && !init->does_not_escape())) {
+    if ( AARCH64_ONLY ( !alloc->does_not_escape_thread() &&
+                        (init == NULL ||
+                         !init->is_complete_with_arraycopy()) )
+         NOT_AARCH64  ( init == NULL ||
+                        (!init->is_complete_with_arraycopy() &&
+                         !init->does_not_escape()) )
+       ) {
       if (init == NULL || init->req() < InitializeNode::RawStores) {
         // No InitializeNode or no stores captured by zeroing
         // elimination. Simply add the MemBarStoreStore after object
         // initialization.
         MemBarNode* mb = MemBarNode::make(C, Op_MemBarStoreStore, Compile::AliasIdxBot);
< prev index next >