RFR: Check that pointer is in heap before checking the affiliation of owning region

William Kemper wkemper at openjdk.java.net
Thu Jul 22 17:33:41 UTC 2021


On Thu, 22 Jul 2021 16:05:07 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

>> This is a small bug fix that was meant to go in with the concurrent remembered set scanning changes
>
> src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp line 756:
> 
>> 754: 
>> 755: bool ShenandoahHeap::is_in_young(const void* p) const {
>> 756:   return is_in(p) && heap_region_containing(p)->affiliation() == ShenandoahRegionAffiliation::YOUNG_GENERATION;
> 
> Is there a valid case where we would check off-heap pointers? If not, then better do this as assert?

This also handles the case of `NULL` pointers and there are times when this API could be called for off-heap roots (during scanning).

> src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp line 399:
> 
>> 397:   // When this reference was discovered, it would not have been marked. If it ends up surviving
>> 398:   // the cycle, we need to dirty the card if the reference is old and the referent is young.  Note
>> 399:   // that if the reference is not dropped, then its pointer to the referent will be cleared before
> 
> Those changes seem unrelated.

Will revert this change.

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

PR: https://git.openjdk.java.net/shenandoah/pull/52


More information about the shenandoah-dev mailing list