RFR: 8257876: Avoid Reference.isEnqueued in tests
Kim Barrett
kbarrett at openjdk.java.net
Thu Dec 10 08:46:36 UTC 2020
On Wed, 9 Dec 2020 13:26:04 GMT, Thomas Schatzl <tschatzl 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).
>
> test/hotspot/jtreg/vmTestbase/gc/gctests/ReferencesGC/ReferencesGC.java line 129:
>
>> 127: }
>> 128:
>> 129: int REMOVE = (int) (RANGE * RATIO);
>
> These two constants could be factored out as static finals to match the casing.
I'm making REMOVE and RETAIN statics, near RANGE and RATIO. (Meant to do that before, but forgot.) They can't be final though, because RANGE and RATIO aren't final, and can be set from command line arguments. So they'll get initialized in parseArgs.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1691
More information about the core-libs-dev
mailing list