changeset 49760:69bae761600b

8201442: objArrayOopDesc::atomic_compare_exchange_oop() must use obj+offset in HeapAccess call Reviewed-by: shade, eosterlund
author rkennke
date Thu, 12 Apr 2018 23:10:19 +0200
parents c154476ce765
children 46dc568d6804
files src/hotspot/share/oops/objArrayOop.cpp
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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() {