< prev index next >

src/share/vm/opto/parse3.cpp

Print this page

        

@@ -160,10 +160,14 @@
   bool is_vol = field->is_volatile();
 
   // Compute address and memory type.
   int offset = field->offset_in_bytes();
   const TypePtr* adr_type = C->alias_type(field)->adr_type();
+
+  // Insert read barrier for Shenandoah.
+  obj = shenandoah_read_barrier(obj);
+
   Node *adr = basic_plus_adr(obj, obj, offset);
   BasicType bt = field->layout_type();
 
   // Build the resultant type of the load
   const Type *type;

@@ -242,10 +246,13 @@
   // If reference is volatile, prevent following memory ops from
   // floating down past the volatile write.  Also prevents commoning
   // another volatile read.
   if (is_vol)  insert_mem_bar(Op_MemBarRelease);
 
+  // Insert write barrier for Shenandoah.
+  obj = shenandoah_write_barrier(obj);
+
   // Compute address and memory type.
   int offset = field->offset_in_bytes();
   const TypePtr* adr_type = C->alias_type(field)->adr_type();
   Node* adr = basic_plus_adr(obj, obj, offset);
   BasicType bt = field->layout_type();

@@ -271,10 +278,13 @@
     if (!field->type()->is_loaded()) {
       field_type = TypeInstPtr::BOTTOM;
     } else {
       field_type = TypeOopPtr::make_from_klass(field->type()->as_klass());
     }
+
+    val = shenandoah_read_barrier_nomem(val);
+
     store = store_oop_to_object(control(), obj, adr, adr_type, val, field_type, bt, mo);
   } else {
     bool needs_atomic_access = is_vol || AlwaysAtomicAccesses;
     store = store_to_memory(control(), adr, val, bt, adr_type, mo, needs_atomic_access);
   }
< prev index next >