8224962: ZGC: Strengthen ZHeap::is_oop()

Reviewed-by: eosterlund
This commit is contained in:
Per Lidén 2019-06-05 10:43:44 +02:00
parent 27d8c3f7b4
commit 06c7a66c22

@ -135,7 +135,11 @@ inline void ZHeap::check_out_of_memory() {
}
inline bool ZHeap::is_oop(oop object) const {
return ZAddress::is_good(ZOop::to_address(object));
// Verify that we have a good address. Note that ZAddress::is_good()
// would not be a strong enough verification, since it only verifies
// that the metadata bits are good.
const uintptr_t addr = ZOop::to_address(object);
return ZAddress::good(addr) == addr;
}
#endif // SHARE_GC_Z_ZHEAP_INLINE_HPP