RFR: 8219817: Remove unused CollectedHeap::block_size()
Per Liden
per.liden at oracle.com
Mon Mar 4 09:51:59 UTC 2019
Hi,
On 2/27/19 11:29 AM, Aleksey Shipilev wrote:
> 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.
Thanks for reviewing!
>
> 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
Hmm, this property still holds. I.e. a block has a size. But with the
block_size function removed it's more of a GC internal thing.
>
> 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?
I personally agree, but I know there are people who would like to keep
these, so I'll leave them for now. Removing block_size is less
controversial.
cheers,
Per
More information about the hotspot-gc-dev
mailing list