RFR: 8262049: [TESTBUG] Fix TestReferenceRefersTo.java for Shenandoah IU mode [v3]
Kim Barrett
kbarrett at openjdk.java.net
Mon Feb 22 15:34:42 UTC 2021
On Mon, 22 Feb 2021 15:12:03 GMT, Roman Kennke <rkennke at openjdk.org> wrote:
>> Shenandoah's IU mode allows referents to be cleared even when accessed during concurrent marking. The test TestReferenceRefersTo.java needs to be adjusted to allow for that.
>>
>> Test:
>> - [x] TestReferenceRefersTo.java + Shenandoah/IU
>> - [x] TestReferenceRefersTo.java + Shenandoah/SATB
>> - [x] TestReferenceRefersTo.java + G1
>
> Roman Kennke has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix compilation failures after renames
Changes requested by kbarrett (Reviewer).
test/hotspot/jtreg/gc/TestReferenceRefersTo.java line 241:
> 239: }
> 240: if ((testWeak4 == null) != (obj4 == null)) {
> 241: fail("either referent is cleared and we got notified, or neither of this happened");
It might be helpful if the failure reported which one was non-null. Not that it should ever fail...
test/hotspot/jtreg/gc/TestReferenceRefersToDuringConcMark.java line 96:
> 94: }
> 95:
> 96: private static void expectCleared(Reference<TestObject> ref,
Unused.
test/hotspot/jtreg/gc/TestReferenceRefersToDuringConcMark.java line 27:
> 25:
> 26: /* @test
> 27: * @requires vm.gc != "Epsilon"
I think this test "works" for Epsilon just as well as it does for Serial or Parallel or any other GC that doesn't support concurrent breakpoints, and either all should be excluded or none.
test/hotspot/jtreg/gc/TestReferenceRefersToDuringConcMark.java line 28:
> 26: /* @test
> 27: * @requires vm.gc != "Epsilon"
> 28: * @requires vm.gc != "Shenandoah"
I think this test works for Shenandoah so long as it's not in IU mode. Is that possible to exclude with another `@requires` constraint?
test/hotspot/jtreg/gc/TestReferenceRefersToDuringConcMark.java line 39:
> 37: */
> 38:
> 39: import java.lang.ref.PhantomReference;
PhantomReference is unused.
test/hotspot/jtreg/gc/TestReferenceRefersToDuringConcMark.java line 145:
> 143:
> 144: progress("acquire control of concurrent cycles");
> 145: WB.concurrentGCAcquireControl();
I think this test could be made a lot smaller and more obvious if it was explicitly just testing the keep-alive behavior of Reference.get for most concurrent collectors, rather than being a trimmed down copy of the earlier test.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2653
More information about the hotspot-gc-dev
mailing list