8232729: Shenandoah: assert ShenandoahHeap::cas_oop addresses are aligned
authorshade
Mon, 21 Oct 2019 22:44:49 +0200
changeset 58730 ca620b06b5c9
parent 58729 15f4471787b9
child 58731 de395bbd7a93
8232729: Shenandoah: assert ShenandoahHeap::cas_oop addresses are aligned Reviewed-by: rkennke
src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp	Mon Oct 21 22:44:48 2019 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp	Mon Oct 21 22:44:49 2019 +0200
@@ -130,15 +130,18 @@
 }
 
 inline oop ShenandoahHeap::cas_oop(oop n, oop* addr, oop c) {
+  assert(is_aligned(addr, HeapWordSize), "Address should be aligned: " PTR_FORMAT, p2i(addr));
   return (oop) Atomic::cmpxchg(n, addr, c);
 }
 
 inline oop ShenandoahHeap::cas_oop(oop n, narrowOop* addr, narrowOop c) {
+  assert(is_aligned(addr, sizeof(narrowOop)), "Address should be aligned: " PTR_FORMAT, p2i(addr));
   narrowOop val = CompressedOops::encode(n);
   return CompressedOops::decode((narrowOop) Atomic::cmpxchg(val, addr, c));
 }
 
 inline oop ShenandoahHeap::cas_oop(oop n, narrowOop* addr, oop c) {
+  assert(is_aligned(addr, sizeof(narrowOop)), "Address should be aligned: " PTR_FORMAT, p2i(addr));
   narrowOop cmp = CompressedOops::encode(c);
   narrowOop val = CompressedOops::encode(n);
   return CompressedOops::decode((narrowOop) Atomic::cmpxchg(val, addr, cmp));