8201442: objArrayOopDesc::atomic_compare_exchange_oop() must use obj+offset in HeapAccess call
authorrkennke
Thu, 12 Apr 2018 23:10:19 +0200
changeset 49760 69bae761600b
parent 49759 c154476ce765
child 49761 46dc568d6804
8201442: objArrayOopDesc::atomic_compare_exchange_oop() must use obj+offset in HeapAccess call Reviewed-by: shade, eosterlund
src/hotspot/share/oops/objArrayOop.cpp
--- a/src/hotspot/share/oops/objArrayOop.cpp	Thu Apr 12 15:50:03 2018 -0400
+++ b/src/hotspot/share/oops/objArrayOop.cpp	Thu Apr 12 23:10:19 2018 +0200
@@ -31,13 +31,13 @@
 
 oop objArrayOopDesc::atomic_compare_exchange_oop(int index, oop exchange_value,
                                                  oop compare_value) {
-  volatile HeapWord* dest;
+  ptrdiff_t offs;
   if (UseCompressedOops) {
-    dest = (HeapWord*)obj_at_addr<narrowOop>(index);
+    offs = objArrayOopDesc::obj_at_offset<narrowOop>(index);
   } else {
-    dest = (HeapWord*)obj_at_addr<oop>(index);
+    offs = objArrayOopDesc::obj_at_offset<oop>(index);
   }
-  return HeapAccess<>::oop_atomic_cmpxchg(exchange_value, dest, compare_value);
+  return HeapAccess<IN_HEAP_ARRAY>::oop_atomic_cmpxchg_at(exchange_value, as_oop(), offs, compare_value);
 }
 
 Klass* objArrayOopDesc::element_klass() {