RFR: 8257876: Avoid Reference.isEnqueued in tests

Thomas Schatzl tschatzl at openjdk.java.net
Wed Dec 9 13:25:33 UTC 2020


On Tue, 8 Dec 2020 17:30:11 GMT, Mandy Chung <mchung at openjdk.org> wrote:

>> Please review this change that eliminates the use of Reference.isEnqueued by
>> tests.  There were three tests using it:
>> 
>> vmTestbase/gc/gctests/ReferencesGC/ReferencesGC.java
>> vmTestbase/gc/gctests/WeakReferenceGC/WeakReferenceGC.java
>> jdk/java/lang/ref/ReferenceEnqueue.java
>> 
>> In each of them, some combination of using Reference.refersTo and
>> ReferenceQueue.remove with a timeout were used to eliminate the use of
>> Reference.isEnqueued.
>> 
>> I also cleaned up ReferencesGC.java in various respects.  It contained
>> several bits of dead code, and the failure checks were made stronger.
>> 
>> Testing:
>> mach5 tier1
>> Locally (linux-x64) ran all three tests with each GC (including Shenandoah).
>
> Marked as reviewed by mchung (Reviewer).

I'm not able to put this in the appropriate place using the github UI:

[pre-existing] The topWeakReferenceGC.java description at the top describes that the test calls System.gc() explicitly to trigger garbage collections at the end. It does not. Maybe this could be weasel-worded around like in the other cases in that text.

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

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



More information about the hotspot-gc-dev mailing list