8232729: Shenandoah: assert ShenandoahHeap::cas_oop addresses are aligned

Reviewed-by: rkennke
This commit is contained in:
Aleksey Shipilev 2019-10-21 22:44:49 +02:00
parent d262906093
commit fd9052f3c5

View File

@ -130,15 +130,18 @@ inline oop ShenandoahHeap::evac_update_with_forwarded(T* p) {
}
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));