RFR: 8237913: G1CollectedHeap::heap_region_containing shouldn't be a template.

Thomas Schatzl tschatzl at openjdk.org
Thu Jul 21 07:42:03 UTC 2022


On Thu, 21 Jul 2022 06:26:57 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Hi all,
>> 
>>   can I have reviews for this change that removes the templates and casts around `G1CollectedHeap::heap_region_containing`?
>> 
>> Testing: tier1-5
>> 
>> Thanks,
>>   Thomas
>
> src/hotspot/share/gc/g1/g1CollectedHeap.hpp line 1129:
> 
>> 1127:   // Returns the HeapRegion that contains addr, or nullptr if that is an uncommitted
>> 1128:   // region. addr must not be nullptr.
>> 1129:   inline HeapRegion* heap_region_containing_or_null(HeapWord* addr) const;
> 
> Why does `heap_region_containing` take `void*` but `heap_region_containing_or_null` takes `HeapWord*`.  Seems like they should be the same (probably `void*` for both?).  And why did the `const` qualifier get dropped for the or_null variant?

`heap_region_containing_or_null` only needs the `HeapWord*` variant - I thought to specialize them as much as possible; dropping of the const has been unintenional. I will fix and regularize these two methods. Thanks.

-------------

PR: https://git.openjdk.org/jdk/pull/9572



More information about the hotspot-gc-dev mailing list