changeset 56604:a5967fd63d9d

8224962: ZGC: Strengthen ZHeap::is_oop() Reviewed-by: eosterlund
author pliden
date Wed, 05 Jun 2019 10:43:44 +0200
parents 27d3b8e5c58b
children 3f8a81f5d1b2
files src/hotspot/share/gc/z/zHeap.inline.hpp
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/z/zHeap.inline.hpp	Wed Jun 05 10:23:06 2019 +0200
+++ b/src/hotspot/share/gc/z/zHeap.inline.hpp	Wed Jun 05 10:43:44 2019 +0200
@@ -135,7 +135,11 @@
 }
 
 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