< prev index next >

src/hotspot/share/opto/library_call.cpp

Print this page

        

@@ -3365,11 +3365,13 @@
     PATH_LIMIT
   };
 
   RegionNode* region = new RegionNode(PATH_LIMIT);
   Node*       phi    = new PhiNode(region, TypeInt::BOOL);
+  Node*       mem_phi= new PhiNode(region, Type::MEMORY, TypePtr::BOTTOM);
   record_for_igvn(region);
+  Node* init_mem = map()->memory();
 
   const TypePtr* adr_type = TypeRawPtr::BOTTOM;   // memory type of loads
   const TypeKlassPtr* kls_type = TypeKlassPtr::OBJECT_OR_NULL;
   int class_klass_offset = java_lang_Class::klass_offset_in_bytes();
 

@@ -3428,22 +3430,28 @@
   phi->set_req(_prim_same_path,   intcon(1));
   phi->set_req(_ref_subtype_path, intcon(1));
 
   // pull together the cases:
   assert(region->req() == PATH_LIMIT, "sane region");
+  Node* cur_mem = reset_memory();
   for (uint i = 1; i < region->req(); i++) {
     Node* ctl = region->in(i);
     if (ctl == NULL || ctl == top()) {
       region->set_req(i, top());
       phi   ->set_req(i, top());
-    } else if (phi->in(i) == NULL) {
-      phi->set_req(i, intcon(0)); // all other paths produce 'false'
+      mem_phi->set_req(i, top());
+    } else {
+      if (phi->in(i) == NULL) {
+        phi->set_req(i, intcon(0)); // all other paths produce 'false'
+      }
+      mem_phi->set_req(i, (i == _prim_0_path || i == _prim_same_path) ?  cur_mem : init_mem);
     }
   }
 
   set_control(_gvn.transform(region));
   set_result(_gvn.transform(phi));
+  set_all_memory(_gvn.transform(mem_phi));
   return true;
 }
 
 //---------------------generate_array_guard_common------------------------
 Node* LibraryCallKit::generate_array_guard_common(Node* kls, RegionNode* region,

@@ -3724,10 +3732,13 @@
         } else {
           ac->set_copyofrange(validated);
         }
         Node* n = _gvn.transform(ac);
         if (n == ac) {
+          if (UseShenandoahGC) {
+            ac->_adr_type = TypePtr::BOTTOM;
+          }
           ac->connect_outputs(this);
         } else {
           assert(validated, "shouldn't transform if all arguments not validated");
           set_all_memory(n);
         }

@@ -4324,10 +4335,13 @@
           Node* alloc = tightly_coupled_allocation(alloc_obj, NULL);
           ArrayCopyNode* ac = ArrayCopyNode::make(this, true, obj, intcon(0), alloc_obj, intcon(0), obj_length, alloc != NULL, false);
           ac->set_cloneoop();
           Node* n = _gvn.transform(ac);
           assert(n == ac, "cannot disappear");
+          if (UseShenandoahGC) {
+            ac->_adr_type = TypePtr::BOTTOM;
+          }
           ac->connect_outputs(this);
 
           result_reg->init_req(_objArray_path, control());
           result_val->init_req(_objArray_path, alloc_obj);
           result_i_o ->set_req(_objArray_path, i_o());

@@ -4804,10 +4818,13 @@
 
   ac->set_arraycopy(validated);
 
   Node* n = _gvn.transform(ac);
   if (n == ac) {
+    if (UseShenandoahGC) {
+      ac->_adr_type = TypePtr::BOTTOM;
+    }
     ac->connect_outputs(this);
   } else {
     assert(validated, "shouldn't transform if all arguments not validated");
     set_all_memory(n);
   }

@@ -5006,16 +5023,21 @@
      __ if_then(z, BoolTest::eq, null()); {
        __ increment (need_alloc, one);
      } __ else_(); {
        // Update graphKit memory and control from IdealKit.
        sync_kit(ideal);
-       Node *cast = new CastPPNode(z, TypePtr::NOTNULL);
-       cast->init_req(0, control());
-       _gvn.set_type(cast, cast->bottom_type());
-       C->record_for_igvn(cast);
-
-       Node* zlen_arg = load_array_length(cast);
+       Node* zlen_arg = NULL;
+       if (UseShenandoahGC) {
+         Node *cast = new CastPPNode(z, TypePtr::NOTNULL);
+         cast->init_req(0, control());
+         _gvn.set_type(cast, cast->bottom_type());
+         C->record_for_igvn(cast);
+
+         zlen_arg = load_array_length(cast);
+       } else {
+         zlen_arg = load_array_length(z);
+       }
        // Update IdealKit memory and control from graphKit.
        __ sync_kit(this);
        __ if_then(zlen_arg, BoolTest::lt, zlen); {
          __ increment (need_alloc, one);
        } __ end_if();
< prev index next >