< prev index next >

src/share/vm/opto/escape.cpp

Print this page
rev 8961 : [mq]: diff-shenandoah.patch

@@ -34,10 +34,11 @@
 #include "opto/compile.hpp"
 #include "opto/escape.hpp"
 #include "opto/phaseX.hpp"
 #include "opto/movenode.hpp"
 #include "opto/rootnode.hpp"
+#include "opto/shenandoahSupport.hpp"
 
 ConnectionGraph::ConnectionGraph(Compile * C, PhaseIterGVN *igvn) :
   _nodes(C->comp_arena(), C->unique(), C->unique(), NULL),
   _in_worklist(C->comp_arena()),
   _next_pidx(0),

@@ -528,11 +529,11 @@
         // Stored value escapes in unsafe access.
         if ((opcode == Op_StoreP) && adr_type->isa_rawptr()) {
           // Pointer stores in G1 barriers looks like unsafe access.
           // Ignore such stores to be able scalar replace non-escaping
           // allocations.
-          if (UseG1GC && adr->is_AddP()) {
+          if ((UseG1GC || UseShenandoahGC) && adr->is_AddP()) {
             Node* base = get_addp_base(adr);
             if (base->Opcode() == Op_LoadP &&
                 base->in(MemNode::Address)->is_AddP()) {
               adr = base->in(MemNode::Address);
               Node* tls = get_addp_base(adr);

@@ -570,10 +571,16 @@
     }
     case Op_ThreadLocal: {
       add_java_object(n, PointsToNode::ArgEscape);
       break;
     }
+    case Op_ShenandoahReadBarrier:
+    case Op_ShenandoahWriteBarrier:
+      // Barriers 'pass through' its arguments. I.e. what goes in, comes out.
+      // It doesn't escape.
+      add_local_var_and_edge(n, PointsToNode::NoEscape, n->in(ShenandoahBarrierNode::ValueIn), delayed_worklist);
+      break;
     default:
       ; // Do nothing for nodes not related to EA.
   }
   return;
 }

@@ -764,10 +771,16 @@
           add_edge(n_ptn, ptn);
         }
       }
       break;
     }
+    case Op_ShenandoahReadBarrier:
+    case Op_ShenandoahWriteBarrier:
+      // Barriers 'pass through' its arguments. I.e. what goes in, comes out.
+      // It doesn't escape.
+      add_local_var_and_edge(n, PointsToNode::NoEscape, n->in(ShenandoahBarrierNode::ValueIn), NULL);
+      break;
     default: {
       // This method should be called only for EA specific nodes which may
       // miss some edges when they were created.
 #ifdef ASSERT
       n->dump(1);

@@ -883,11 +896,11 @@
       }
     }
   } else {
     // An other type of call, assume the worst case:
     // returned value is unknown and globally escapes.
-    assert(call->Opcode() == Op_CallDynamicJava, "add failed case check");
+    assert(call->Opcode() == Op_CallDynamicJava || call->Opcode() == Op_CallLeaf, "add failed case check");
     map_ideal_node(call, phantom_obj);
   }
 }
 
 void ConnectionGraph::process_call_arguments(CallNode *call) {

@@ -959,10 +972,13 @@
 #ifdef ASSERT
           if (!(is_arraycopy ||
                 (call->as_CallLeaf()->_name != NULL &&
                  (strcmp(call->as_CallLeaf()->_name, "g1_wb_pre")  == 0 ||
                   strcmp(call->as_CallLeaf()->_name, "g1_wb_post") == 0 ||
+                  strcmp(call->as_CallLeaf()->_name, "shenandoah_clone_barrier")  == 0 ||
+                  strcmp(call->as_CallLeaf()->_name, "shenandoah_read_barrier")  == 0 ||
+                  strcmp(call->as_CallLeaf()->_name, "shenandoah_cas_obj")  == 0 ||
                   strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32") == 0 ||
                   strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32C") == 0 ||
                   strcmp(call->as_CallLeaf()->_name, "updateBytesAdler32") == 0 ||
                   strcmp(call->as_CallLeaf()->_name, "aescrypt_encryptBlock") == 0 ||
                   strcmp(call->as_CallLeaf()->_name, "aescrypt_decryptBlock") == 0 ||

@@ -2052,10 +2068,13 @@
         }
       }
     } else if (adr_type->isa_aryptr()) {
       if (offset == arrayOopDesc::length_offset_in_bytes()) {
         // Ignore array length load.
+      } else if (UseShenandoahGC && offset == -8) {
+        // Shenandoah read barrier.
+        bt = T_ARRAY;
       } else if (find_second_addp(n, n->in(AddPNode::Base)) != NULL) {
         // Ignore first AddP.
       } else {
         const Type* elemtype = adr_type->isa_aryptr()->elem();
         bt = elemtype->array_element_basic_type();

@@ -2640,10 +2659,11 @@
   Node *result = orig_mem;
   while (prev != result) {
     prev = result;
     if (result == start_mem)
       break;  // hit one of our sentinels
+    assert(result->Opcode() != Op_ShenandoahWBMemProj, "unexpected memory slice");
     if (result->is_Mem()) {
       const Type *at = igvn->type(result->in(MemNode::Address));
       if (at == Type::TOP)
         break; // Dead
       assert (at->isa_ptr() != NULL, "pointer type required.");

@@ -3003,10 +3023,11 @@
       if (!split_AddP(n, base)) continue; // wrong type from dead path
     } else if (n->is_Phi() ||
                n->is_CheckCastPP() ||
                n->is_EncodeP() ||
                n->is_DecodeN() ||
+               n->is_ShenandoahBarrier() ||
                (n->is_ConstraintCast() && n->Opcode() == Op_CastPP)) {
       if (visited.test_set(n->_idx)) {
         assert(n->is_Phi(), "loops only through Phi's");
         continue;  // already processed
       }

@@ -3073,10 +3094,11 @@
         alloc_worklist.append_if_missing(use);
       } else if (use->is_Phi() ||
                  use->is_CheckCastPP() ||
                  use->is_EncodeNarrowPtr() ||
                  use->is_DecodeNarrowPtr() ||
+                 use->is_ShenandoahBarrier() ||
                  (use->is_ConstraintCast() && use->Opcode() == Op_CastPP)) {
         alloc_worklist.append_if_missing(use);
 #ifdef ASSERT
       } else if (use->is_Mem()) {
         assert(use->in(MemNode::Address) != n, "EA: missing allocation reference path");

@@ -3097,11 +3119,12 @@
       } else {
         uint op = use->Opcode();
         if (!(op == Op_CmpP || op == Op_Conv2B ||
               op == Op_CastP2X || op == Op_StoreCM ||
               op == Op_FastLock || op == Op_AryEq || op == Op_StrComp ||
-              op == Op_StrEquals || op == Op_StrIndexOf)) {
+              op == Op_StrEquals || op == Op_StrIndexOf ||
+              op == Op_ShenandoahWBMemProj)) {
           n->dump();
           use->dump();
           assert(false, "EA: missing allocation reference path");
         }
 #endif
< prev index next >