< prev index next >

src/share/vm/oops/objArrayOop.hpp

Print this page

        

@@ -23,12 +23,17 @@
  */
 
 #ifndef SHARE_VM_OOPS_OBJARRAYOOP_HPP
 #define SHARE_VM_OOPS_OBJARRAYOOP_HPP
 
+#include "memory/barrierSet.hpp"
 #include "oops/arrayOop.hpp"
 
+#if INCLUDE_ALL_GCS
+#include "gc_implementation/shenandoah/shenandoahBarrierSet.hpp"
+#endif
+
 // An objArrayOop is an array containing oops.
 // Evaluating "String arg[10]" will create an objArrayOop.
 
 class objArrayOopDesc : public arrayOopDesc {
   friend class ObjArrayKlass;

@@ -77,17 +82,24 @@
   // base is the address following the header.
   HeapWord* base() const      { return (HeapWord*) arrayOopDesc::base(T_OBJECT); }
 
   // Accessing
   oop obj_at(int index) const {
+    oop obj;
     // With UseCompressedOops decode the narrow oop in the objArray to an
     // uncompressed oop.  Otherwise this is simply a "*" operator.
     if (UseCompressedOops) {
-      return load_decode_heap_oop(obj_at_addr<narrowOop>(index));
+      obj = load_decode_heap_oop(obj_at_addr<narrowOop>(index));
     } else {
-      return load_decode_heap_oop(obj_at_addr<oop>(index));
+      obj = load_decode_heap_oop(obj_at_addr<oop>(index));
+    }
+#if INCLUDE_ALL_GCS
+    if (UseShenandoahGC) {
+      obj = ShenandoahBarrierSet::barrier_set()->load_reference_barrier(obj);
     }
+#endif
+    return obj;
   }
 
   void obj_at_put(int index, oop value) {
     if (UseCompressedOops) {
       oop_store(obj_at_addr<narrowOop>(index), value);
< prev index next >