On Mon, 16 Nov 2020 18:30:38 GMT, Mandy Chung <mch...@openjdk.org> wrote:

>> A follow-up to JDK-8256106, this is adding two asserts to check that the API 
>> is used as it should be, i.e. only on inactive FinalReferences. Also, in 
>> Finalizer, where getInactive() is used, there is a null-check. The GC must 
>> never clean the referent, and Java code doesn't clean it either, it would be 
>> a bug if we ever see null there. I think it's better to fail there (with 
>> assert or NPE) when that happens instead of silently accepting it.
>> 
>> Testing:
>>  - [x] tier1
>>  - [x] tier2
>
> Thanks for adding this asserts.  If there is any reason to use `getInactive` 
> by other references in the future, we could remove these asserts at that time.

I didn't notice this before it was integrated.

The test for inactive isn't right; rather than `next == this` it
should be `next != null`.  This becomes apparent once
FinalizerHistogram is fixed to call getInactive() rather than get().

I noticed this while working on JDK-8256517, where I ran into some
similar issues.  I will address these problems as part of that change.

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

PR: https://git.openjdk.java.net/jdk/pull/1231

Reply via email to