8219817: Remove unused CollectedHeap::block_size()
authorpliden
Wed, 13 Mar 2019 11:31:00 +0100
changeset 54093 9d02451b536e
parent 54092 48a02303574e
child 54094 ed3c6f07faab
8219817: Remove unused CollectedHeap::block_size() Reviewed-by: shade, stefank
src/hotspot/share/gc/epsilon/epsilonHeap.hpp
src/hotspot/share/gc/g1/g1CollectedHeap.cpp
src/hotspot/share/gc/g1/g1CollectedHeap.hpp
src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp
src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp
src/hotspot/share/gc/shared/collectedHeap.hpp
src/hotspot/share/gc/shared/genCollectedHeap.cpp
src/hotspot/share/gc/shared/genCollectedHeap.hpp
src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp
src/hotspot/share/gc/z/zCollectedHeap.cpp
src/hotspot/share/gc/z/zCollectedHeap.hpp
src/hotspot/share/gc/z/zHeap.cpp
src/hotspot/share/gc/z/zHeap.hpp
src/hotspot/share/gc/z/zPage.hpp
src/hotspot/share/gc/z/zPage.inline.hpp
--- a/src/hotspot/share/gc/epsilon/epsilonHeap.hpp	Wed Mar 13 11:31:00 2019 +0100
+++ b/src/hotspot/share/gc/epsilon/epsilonHeap.hpp	Wed Mar 13 11:31:00 2019 +0100
@@ -128,7 +128,6 @@
 
   // No support for block parsing.
   virtual HeapWord* block_start(const void* addr) const { return NULL;  }
-  virtual size_t block_size(const HeapWord* addr) const { return 0;     }
   virtual bool block_is_obj(const HeapWord* addr) const { return false; }
 
   // No GC threads
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Wed Mar 13 11:31:00 2019 +0100
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Wed Mar 13 11:31:00 2019 +0100
@@ -2254,11 +2254,6 @@
   return hr->block_start(addr);
 }
 
-size_t G1CollectedHeap::block_size(const HeapWord* addr) const {
-  HeapRegion* hr = heap_region_containing(addr);
-  return hr->block_size(addr);
-}
-
 bool G1CollectedHeap::block_is_obj(const HeapWord* addr) const {
   HeapRegion* hr = heap_region_containing(addr);
   return hr->block_is_obj(addr);
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Wed Mar 13 11:31:00 2019 +0100
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Wed Mar 13 11:31:00 2019 +0100
@@ -1191,11 +1191,6 @@
   // non-object.
   virtual HeapWord* block_start(const void* addr) const;
 
-  // Requires "addr" to be the start of a chunk, and returns its size.
-  // "addr + size" is required to be the start of a new chunk, or the end
-  // of the active area of the heap.
-  virtual size_t block_size(const HeapWord* addr) const;
-
   // Requires "addr" to be the start of a block, and returns "TRUE" iff
   // the block is an object.
   virtual bool block_is_obj(const HeapWord* addr) const;
--- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp	Wed Mar 13 11:31:00 2019 +0100
+++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp	Wed Mar 13 11:31:00 2019 +0100
@@ -532,10 +532,6 @@
   return 0;
 }
 
-size_t ParallelScavengeHeap::block_size(const HeapWord* addr) const {
-  return oop(addr)->size();
-}
-
 bool ParallelScavengeHeap::block_is_obj(const HeapWord* addr) const {
   return block_start(addr) == addr;
 }
--- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp	Wed Mar 13 11:31:00 2019 +0100
+++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp	Wed Mar 13 11:31:00 2019 +0100
@@ -220,7 +220,6 @@
   void safe_object_iterate(ObjectClosure* cl) { object_iterate(cl); }
 
   HeapWord* block_start(const void* addr) const;
-  size_t block_size(const HeapWord* addr) const;
   bool block_is_obj(const HeapWord* addr) const;
 
   jlong millis_since_last_gc();
--- a/src/hotspot/share/gc/shared/collectedHeap.hpp	Wed Mar 13 11:31:00 2019 +0100
+++ b/src/hotspot/share/gc/shared/collectedHeap.hpp	Wed Mar 13 11:31:00 2019 +0100
@@ -450,11 +450,6 @@
   // non-object.
   virtual HeapWord* block_start(const void* addr) const = 0;
 
-  // Requires "addr" to be the start of a chunk, and returns its size.
-  // "addr + size" is required to be the start of a new chunk, or the end
-  // of the active area of the heap.
-  virtual size_t block_size(const HeapWord* addr) const = 0;
-
   // Requires "addr" to be the start of a block, and returns "TRUE" iff
   // the block is an object.
   virtual bool block_is_obj(const HeapWord* addr) const = 0;
--- a/src/hotspot/share/gc/shared/genCollectedHeap.cpp	Wed Mar 13 11:31:00 2019 +0100
+++ b/src/hotspot/share/gc/shared/genCollectedHeap.cpp	Wed Mar 13 11:31:00 2019 +0100
@@ -1064,18 +1064,6 @@
   return _old_gen->block_start(addr);
 }
 
-size_t GenCollectedHeap::block_size(const HeapWord* addr) const {
-  assert(is_in_reserved(addr), "block_size of address outside of heap");
-  if (_young_gen->is_in_reserved(addr)) {
-    assert(_young_gen->is_in(addr), "addr should be in allocated part of generation");
-    return _young_gen->block_size(addr);
-  }
-
-  assert(_old_gen->is_in_reserved(addr), "Some generation should contain the address");
-  assert(_old_gen->is_in(addr), "addr should be in allocated part of generation");
-  return _old_gen->block_size(addr);
-}
-
 bool GenCollectedHeap::block_is_obj(const HeapWord* addr) const {
   assert(is_in_reserved(addr), "block_is_obj of address outside of heap");
   assert(block_start(addr) == addr, "addr must be a block start");
--- a/src/hotspot/share/gc/shared/genCollectedHeap.hpp	Wed Mar 13 11:31:00 2019 +0100
+++ b/src/hotspot/share/gc/shared/genCollectedHeap.hpp	Wed Mar 13 11:31:00 2019 +0100
@@ -278,13 +278,6 @@
   // non-object.
   virtual HeapWord* block_start(const void* addr) const;
 
-  // Requires "addr" to be the start of a chunk, and returns its size.
-  // "addr + size" is required to be the start of a new chunk, or the end
-  // of the active area of the heap. Assumes (and verifies in non-product
-  // builds) that addr is in the allocated part of the heap and is
-  // the start of a chunk.
-  virtual size_t block_size(const HeapWord* addr) const;
-
   // Requires "addr" to be the start of a block, and returns "TRUE" iff
   // the block is an object. Assumes (and verifies in non-product
   // builds) that addr is in the allocated part of the heap and is
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Wed Mar 13 11:31:00 2019 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Wed Mar 13 11:31:00 2019 +0100
@@ -1192,12 +1192,6 @@
   return NULL;
 }
 
-size_t ShenandoahHeap::block_size(const HeapWord* addr) const {
-  Space* sp = heap_region_containing(addr);
-  assert(sp != NULL, "block_size of address outside of heap");
-  return sp->block_size(addr);
-}
-
 bool ShenandoahHeap::block_is_obj(const HeapWord* addr) const {
   Space* sp = heap_region_containing(addr);
   return sp->block_is_obj(addr);
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp	Wed Mar 13 11:31:00 2019 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp	Wed Mar 13 11:31:00 2019 +0100
@@ -567,7 +567,6 @@
 
   // Used for parsing heap during error printing
   HeapWord* block_start(const void* addr) const;
-  size_t block_size(const HeapWord* addr) const;
   bool block_is_obj(const HeapWord* addr) const;
 
   // Used for native heap walkers: heap dumpers, mostly
--- a/src/hotspot/share/gc/z/zCollectedHeap.cpp	Wed Mar 13 11:31:00 2019 +0100
+++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp	Wed Mar 13 11:31:00 2019 +0100
@@ -245,11 +245,6 @@
   return (HeapWord*)_heap.block_start((uintptr_t)addr);
 }
 
-size_t ZCollectedHeap::block_size(const HeapWord* addr) const {
-  size_t size_in_bytes = _heap.block_size((uintptr_t)addr);
-  return ZUtils::bytes_to_words(size_in_bytes);
-}
-
 bool ZCollectedHeap::block_is_obj(const HeapWord* addr) const {
   return _heap.block_is_obj((uintptr_t)addr);
 }
--- a/src/hotspot/share/gc/z/zCollectedHeap.hpp	Wed Mar 13 11:31:00 2019 +0100
+++ b/src/hotspot/share/gc/z/zCollectedHeap.hpp	Wed Mar 13 11:31:00 2019 +0100
@@ -100,7 +100,6 @@
   virtual void safe_object_iterate(ObjectClosure* cl);
 
   virtual HeapWord* block_start(const void* addr) const;
-  virtual size_t block_size(const HeapWord* addr) const;
   virtual bool block_is_obj(const HeapWord* addr) const;
 
   virtual void register_nmethod(nmethod* nm);
--- a/src/hotspot/share/gc/z/zHeap.cpp	Wed Mar 13 11:31:00 2019 +0100
+++ b/src/hotspot/share/gc/z/zHeap.cpp	Wed Mar 13 11:31:00 2019 +0100
@@ -185,11 +185,6 @@
   return page->block_start(addr);
 }
 
-size_t ZHeap::block_size(uintptr_t addr) const {
-  const ZPage* const page = _pagetable.get(addr);
-  return page->block_size(addr);
-}
-
 bool ZHeap::block_is_obj(uintptr_t addr) const {
   const ZPage* const page = _pagetable.get(addr);
   return page->block_is_obj(addr);
--- a/src/hotspot/share/gc/z/zHeap.hpp	Wed Mar 13 11:31:00 2019 +0100
+++ b/src/hotspot/share/gc/z/zHeap.hpp	Wed Mar 13 11:31:00 2019 +0100
@@ -99,7 +99,6 @@
 
   // Block
   uintptr_t block_start(uintptr_t addr) const;
-  size_t block_size(uintptr_t addr) const;
   bool block_is_obj(uintptr_t addr) const;
 
   // Workers
--- a/src/hotspot/share/gc/z/zPage.hpp	Wed Mar 13 11:31:00 2019 +0100
+++ b/src/hotspot/share/gc/z/zPage.hpp	Wed Mar 13 11:31:00 2019 +0100
@@ -85,7 +85,6 @@
   bool is_in(uintptr_t addr) const;
 
   uintptr_t block_start(uintptr_t addr) const;
-  size_t block_size(uintptr_t addr) const;
   bool block_is_obj(uintptr_t addr) const;
 
   bool is_active() const;
--- a/src/hotspot/share/gc/z/zPage.inline.hpp	Wed Mar 13 11:31:00 2019 +0100
+++ b/src/hotspot/share/gc/z/zPage.inline.hpp	Wed Mar 13 11:31:00 2019 +0100
@@ -32,7 +32,6 @@
 #include "gc/z/zNUMA.hpp"
 #include "gc/z/zPage.hpp"
 #include "gc/z/zPhysicalMemory.inline.hpp"
-#include "gc/z/zUtils.inline.hpp"
 #include "gc/z/zVirtualMemory.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/atomic.hpp"
@@ -160,14 +159,6 @@
   }
 }
 
-inline size_t ZPage::block_size(uintptr_t addr) const {
-  if (block_is_obj(addr)) {
-    return ZUtils::object_size(addr);
-  } else {
-    return end() - top();
-  }
-}
-
 inline bool ZPage::block_is_obj(uintptr_t addr) const {
   return ZAddress::offset(addr) < top();
 }