RFR: 8219817: Remove unused CollectedHeap::block_size()

Aleksey Shipilev shade at redhat.com
Wed Feb 27 10:29:26 UTC 2019

On 2/27/19 9:47 AM, Per Liden wrote:
> CollectedHeap::block_size() is never called. We should remove it and the implementations provided by
> the different collectors.
> Bug: https://bugs.openjdk.java.net/browse/JDK-8219817
> Webrev: http://cr.openjdk.java.net/~pliden/8219817/webrev.0

Code change looks fine to me.

There are comments in collectedHeap.hpp and g1CollectedHeap.hpp that sill mention block size:

1176   // one block.  The defining characteristic of a block is that it is
1177   // possible to find its size, and thus to progress forward to the next
1178   // block.  (Blocks may be of different sizes.)  Thus, blocks may

Aside, I wonder why block_* facility is even there. It seems to have the only use here:

oop oopDesc::oop_or_null(address addr) {
  if (is_valid(oop(addr))) {
    // We were just given an oop directly.
    return oop(addr);

  // Try to find addr using block_start.
  HeapWord* p = Universe::heap()->block_start(addr);
  if (p != NULL && Universe::heap()->block_is_obj(p)) {
    if (!is_valid(oop(p))) return NULL;
    return oop(p);

  // If we can't find it it just may mean that heap wasn't parsable.
  return NULL;

...so I wonder if we should just purge this use of CollectedHeap::block_* by returning NULL when
addr does not hit the exact object, and then purge all relevant members from CollectedHeap?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://mail.openjdk.java.net/pipermail/hotspot-gc-dev/attachments/20190227/2d6e8740/signature.asc>

More information about the hotspot-gc-dev mailing list