8232729: Shenandoah: assert ShenandoahHeap::cas_oop addresses are aligned
Reviewed-by: rkennke
--- 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));