< prev index next >

src/share/vm/oops/oop.inline.hpp

Print this page

        

@@ -43,10 +43,13 @@
 #include "runtime/os.hpp"
 #include "utilities/macros.hpp"
 #ifdef TARGET_ARCH_x86
 # include "bytes_x86.hpp"
 #endif
+#ifdef TARGET_ARCH_aarch64
+# include "bytes_aarch64.hpp"
+#endif
 #ifdef TARGET_ARCH_sparc
 # include "bytes_sparc.hpp"
 #endif
 #ifdef TARGET_ARCH_zero
 # include "bytes_zero.hpp"

@@ -56,10 +59,14 @@
 #endif
 #ifdef TARGET_ARCH_ppc
 # include "bytes_ppc.hpp"
 #endif
 
+#if INCLUDE_ALL_GCS
+#include "gc_implementation/shenandoah/shenandoahBarrierSet.hpp"
+#endif
+
 // Implementation of all inlined member functions defined in oop.hpp
 // We need a separate file to avoid circular references
 
 inline void oopDesc::release_set_mark(markOop m) {
   OrderAccess::release_store_ptr(&_mark, m);

@@ -286,27 +293,43 @@
 
 
 // These functions are only used to exchange oop fields in instances,
 // not headers.
 inline oop oopDesc::atomic_exchange_oop(oop exchange_value, volatile HeapWord *dest) {
+  oop result;
   if (UseCompressedOops) {
     // encode exchange value from oop to T
     narrowOop val = encode_heap_oop(exchange_value);
     narrowOop old = (narrowOop)Atomic::xchg(val, (narrowOop*)dest);
     // decode old from T to oop
-    return decode_heap_oop(old);
+    result = decode_heap_oop(old);
   } else {
-    return (oop)Atomic::xchg_ptr(exchange_value, (oop*)dest);
+    result = (oop)Atomic::xchg_ptr(exchange_value, (oop*)dest);
   }
+#if INCLUDE_ALL_GCS
+  if (UseShenandoahGC) {
+    if (exchange_value != NULL) {
+      ShenandoahBarrierSet::barrier_set()->storeval_barrier(exchange_value);
+    }
+    result = ShenandoahBarrierSet::barrier_set()->load_reference_barrier(result);
+  }
+#endif
+  return result;
 }
 
 // In order to put or get a field out of an instance, must first check
 // if the field has been compressed and uncompress it.
 inline oop oopDesc::obj_field(int offset) const {
-  return UseCompressedOops ?
+  oop obj = UseCompressedOops ?
     load_decode_heap_oop(obj_field_addr<narrowOop>(offset)) :
     load_decode_heap_oop(obj_field_addr<oop>(offset));
+#if INCLUDE_ALL_GCS
+  if (UseShenandoahGC) {
+    obj = ShenandoahBarrierSet::barrier_set()->load_reference_barrier(obj);
+  }
+#endif
+  return obj;
 }
 inline volatile oop oopDesc::obj_field_volatile(int offset) const {
   volatile oop value = obj_field(offset);
   OrderAccess::acquire();
   return value;

@@ -337,11 +360,11 @@
 
 inline jbyte oopDesc::byte_field(int offset) const                  { return (jbyte) *byte_field_addr(offset);    }
 inline void oopDesc::byte_field_put(int offset, jbyte contents)     { *byte_field_addr(offset) = (jint) contents; }
 
 inline jboolean oopDesc::bool_field(int offset) const               { return (jboolean) *bool_field_addr(offset); }
-inline void oopDesc::bool_field_put(int offset, jboolean contents)  { *bool_field_addr(offset) = (( (jint) contents) & 1); }
+inline void oopDesc::bool_field_put(int offset, jboolean contents)  { *bool_field_addr(offset) =  (( (jint) contents) & 1); }
 
 inline jchar oopDesc::char_field(int offset) const                  { return (jchar) *char_field_addr(offset);    }
 inline void oopDesc::char_field_put(int offset, jchar contents)     { *char_field_addr(offset) = (jint) contents; }
 
 inline jint oopDesc::int_field(int offset) const                    { return *int_field_addr(offset);        }

@@ -361,15 +384,21 @@
 
 inline address oopDesc::address_field(int offset) const              { return *address_field_addr(offset);     }
 inline void oopDesc::address_field_put(int offset, address contents) { *address_field_addr(offset) = contents; }
 
 inline oop oopDesc::obj_field_acquire(int offset) const {
-  return UseCompressedOops ?
+  oop obj = UseCompressedOops ?
              decode_heap_oop((narrowOop)
                OrderAccess::load_acquire(obj_field_addr<narrowOop>(offset)))
            : decode_heap_oop((oop)
                OrderAccess::load_ptr_acquire(obj_field_addr<oop>(offset)));
+#if INCLUDE_ALL_GCS
+  if (UseShenandoahGC) {
+    obj = ShenandoahBarrierSet::barrier_set()->load_reference_barrier(obj);
+  }
+#endif
+  return obj;
 }
 inline void oopDesc::release_obj_field_put(int offset, oop value) {
   UseCompressedOops ?
     oop_store((volatile narrowOop*)obj_field_addr<narrowOop>(offset), value) :
     oop_store((volatile oop*)      obj_field_addr<oop>(offset),       value);

@@ -386,11 +415,11 @@
 
 inline jint oopDesc::int_field_acquire(int offset) const                    { return OrderAccess::load_acquire(int_field_addr(offset));      }
 inline void oopDesc::release_int_field_put(int offset, jint contents)       { OrderAccess::release_store(int_field_addr(offset), contents);  }
 
 inline jshort oopDesc::short_field_acquire(int offset) const                { return (jshort)OrderAccess::load_acquire(short_field_addr(offset)); }
-inline void oopDesc::release_short_field_put(int offset, jshort contents)   { OrderAccess::release_store(short_field_addr(offset), contents);     }
+inline void oopDesc::release_short_field_put(int offset, jshort contents)   { OrderAccess::release_store(short_field_addr(offset), contents); }
 
 inline jlong oopDesc::long_field_acquire(int offset) const                  { return OrderAccess::load_acquire(long_field_addr(offset));       }
 inline void oopDesc::release_long_field_put(int offset, jlong contents)     { OrderAccess::release_store(long_field_addr(offset), contents);   }
 
 inline jfloat oopDesc::float_field_acquire(int offset) const                { return OrderAccess::load_acquire(float_field_addr(offset));      }

@@ -538,10 +567,15 @@
 
 inline oop oopDesc::atomic_compare_exchange_oop(oop exchange_value,
                                                 volatile HeapWord *dest,
                                                 oop compare_value,
                                                 bool prebarrier) {
+#if INCLUDE_ALL_GCS
+  if (UseShenandoahGC && ShenandoahCASBarrier) {
+    return ShenandoahBarrierSet::barrier_set()->oop_atomic_cmpxchg_in_heap(exchange_value, dest, compare_value);
+  }
+#endif
   if (UseCompressedOops) {
     if (prebarrier) {
       update_barrier_set_pre((narrowOop*)dest, exchange_value);
     }
     // encode exchange and compare value from oop to T
< prev index next >