changeset 56353:722a19a45994

8231113: Remove CollectedHeap::check_oop_location() Reviewed-by: stefank, eosterlund, tschatzl
author pliden
date Thu, 19 Sep 2019 16:05:47 +0200
parents 408c445d04e8
children 0ff1aeedc338
files src/hotspot/share/gc/cms/cmsHeap.hpp src/hotspot/share/gc/g1/g1OopClosures.inline.hpp src/hotspot/share/gc/serial/markSweep.inline.hpp src/hotspot/share/gc/shared/collectedHeap.cpp src/hotspot/share/gc/shared/collectedHeap.hpp src/hotspot/share/gc/z/zCollectedHeap.cpp src/hotspot/share/gc/z/zCollectedHeap.hpp src/hotspot/share/oops/compressedOops.inline.hpp src/hotspot/share/oops/oop.cpp
diffstat 9 files changed, 7 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/cms/cmsHeap.hpp	Thu Sep 19 10:52:22 2019 +0200
+++ b/src/hotspot/share/gc/cms/cmsHeap.hpp	Thu Sep 19 16:05:47 2019 +0200
@@ -135,10 +135,6 @@
   bool should_do_concurrent_full_gc(GCCause::Cause cause);
 
   void collect_mostly_concurrent(GCCause::Cause cause);
-
-  // CMS forwards some non-heap value into the mark oop to reserve oops during
-  // promotion, so we can't assert about obj alignment or that the forwardee is in heap
-  virtual void check_oop_location(void* addr) const {}
 };
 
 #endif // SHARE_GC_CMS_CMSHEAP_HPP
--- a/src/hotspot/share/gc/g1/g1OopClosures.inline.hpp	Thu Sep 19 10:52:22 2019 +0200
+++ b/src/hotspot/share/gc/g1/g1OopClosures.inline.hpp	Thu Sep 19 16:05:47 2019 +0200
@@ -38,6 +38,7 @@
 #include "oops/oopsHierarchy.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/prefetch.inline.hpp"
+#include "utilities/align.hpp"
 
 template <class T>
 inline void G1ScanClosureBase::prefetch_and_push(T* p, const oop obj) {
@@ -115,7 +116,8 @@
   G1CollectedHeap* g1h = G1CollectedHeap::heap();
   // can't do because of races
   // assert(oopDesc::is_oop_or_null(obj), "expected an oop");
-  g1h->check_oop_location(obj);
+  assert(is_object_aligned(obj), "oop must be aligned");
+  assert(g1h->is_in_reserved(obj), "oop must be in reserved");
 
   HeapRegion* from = g1h->heap_region_containing(p);
 
--- a/src/hotspot/share/gc/serial/markSweep.inline.hpp	Thu Sep 19 10:52:22 2019 +0200
+++ b/src/hotspot/share/gc/serial/markSweep.inline.hpp	Thu Sep 19 16:05:47 2019 +0200
@@ -32,6 +32,7 @@
 #include "oops/access.inline.hpp"
 #include "oops/compressedOops.inline.hpp"
 #include "oops/oop.inline.hpp"
+#include "utilities/align.hpp"
 #include "utilities/stack.inline.hpp"
 
 inline void MarkSweep::mark_object(oop obj) {
@@ -87,7 +88,7 @@
            "should be forwarded");
 
     if (new_obj != NULL) {
-      DEBUG_ONLY(Universe::heap()->check_oop_location((HeapWord*)new_obj);)
+      assert(is_object_aligned(new_obj), "oop must be aligned");
       RawAccess<IS_NOT_NULL>::oop_store(p, new_obj);
     }
   }
--- a/src/hotspot/share/gc/shared/collectedHeap.cpp	Thu Sep 19 10:52:22 2019 +0200
+++ b/src/hotspot/share/gc/shared/collectedHeap.cpp	Thu Sep 19 16:05:47 2019 +0200
@@ -343,11 +343,6 @@
 }
 #endif // PRODUCT
 
-void CollectedHeap::check_oop_location(void* addr) const {
-  assert(is_object_aligned(addr), "address is not aligned");
-  assert(_reserved.contains(addr),  "address is not in reserved heap");
-}
-
 size_t CollectedHeap::max_tlab_size() const {
   // TLABs can't be bigger than we can fill with a int[Integer.MAX_VALUE].
   // This restriction could be removed by enabling filling with multiple arrays.
@@ -376,8 +371,6 @@
 {
   assert(words >= min_fill_size(), "too small to fill");
   assert(is_object_aligned(words), "unaligned size");
-  DEBUG_ONLY(Universe::heap()->check_oop_location(start);)
-  DEBUG_ONLY(Universe::heap()->check_oop_location(start + words - MinObjAlignment);)
 }
 
 void CollectedHeap::zap_filler_array(HeapWord* start, size_t words, bool zap)
--- a/src/hotspot/share/gc/shared/collectedHeap.hpp	Thu Sep 19 10:52:22 2019 +0200
+++ b/src/hotspot/share/gc/shared/collectedHeap.hpp	Thu Sep 19 16:05:47 2019 +0200
@@ -233,11 +233,6 @@
 
   DEBUG_ONLY(bool is_in_or_null(const void* p) const { return p == NULL || is_in(p); })
 
-  // This function verifies that "addr" is a valid oop location, w.r.t. heap
-  // datastructures such as bitmaps and virtual memory address. It does *not*
-  // check if the location is within committed heap memory.
-  virtual void check_oop_location(void* addr) const;
-
   virtual uint32_t hash_oop(oop obj) const;
 
   void set_gc_cause(GCCause::Cause v) {
--- a/src/hotspot/share/gc/z/zCollectedHeap.cpp	Thu Sep 19 10:52:22 2019 +0200
+++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp	Thu Sep 19 16:05:47 2019 +0200
@@ -368,11 +368,3 @@
 bool ZCollectedHeap::is_oop(oop object) const {
   return CollectedHeap::is_oop(object) && _heap.is_oop(object);
 }
-
-void ZCollectedHeap::check_oop_location(void* addr) const {
-  assert(is_object_aligned(addr), "address is not aligned");
-
-  const uintptr_t addr_int = reinterpret_cast<uintptr_t>(addr);
-  assert(addr_int >= ZAddressSpaceStart, "address is outside of the heap");
-  assert(addr_int < ZAddressSpaceEnd,    "address is outside of the heap");
-}
--- a/src/hotspot/share/gc/z/zCollectedHeap.hpp	Thu Sep 19 10:52:22 2019 +0200
+++ b/src/hotspot/share/gc/z/zCollectedHeap.hpp	Thu Sep 19 16:05:47 2019 +0200
@@ -126,7 +126,6 @@
   virtual void prepare_for_verify();
   virtual void verify(VerifyOption option /* ignored */);
   virtual bool is_oop(oop object) const;
-  virtual void check_oop_location(void* addr) const;
 };
 
 #endif // SHARE_GC_Z_ZCOLLECTEDHEAP_HPP
--- a/src/hotspot/share/oops/compressedOops.inline.hpp	Thu Sep 19 10:52:22 2019 +0200
+++ b/src/hotspot/share/oops/compressedOops.inline.hpp	Thu Sep 19 16:05:47 2019 +0200
@@ -58,7 +58,8 @@
 
 inline narrowOop CompressedOops::encode_not_null(oop v) {
   assert(!is_null(v), "oop value can never be zero");
-  DEBUG_ONLY(Universe::heap()->check_oop_location(v);)
+  assert(is_object_aligned(v), "address not aligned: " PTR_FORMAT, p2i((void*)v));
+  assert(is_in(v), "address not in heap range: " PTR_FORMAT, p2i((void*)v));
   uint64_t  pd = (uint64_t)(pointer_delta((void*)v, (void*)base(), 1));
   assert(OopEncodingHeapMax > pd, "change encoding max if new encoding");
   uint64_t result = pd >> shift();
--- a/src/hotspot/share/oops/oop.cpp	Thu Sep 19 10:52:22 2019 +0200
+++ b/src/hotspot/share/oops/oop.cpp	Thu Sep 19 16:05:47 2019 +0200
@@ -209,7 +209,6 @@
 
 #ifdef ASSERT
 void oopDesc::verify_forwardee(oop forwardee) {
-  Universe::heap()->check_oop_location(forwardee);
 #if INCLUDE_CDS_JAVA_HEAP
   assert(!HeapShared::is_archived_object(forwardee) && !HeapShared::is_archived_object(this),
          "forwarding archive object");