[jdk16] RFR: 8260473: [vector] ZGC: VectorReshape test produces incorrect results with ZGC enabled
王超
github.com+25214855+casparcwang at openjdk.java.net
Mon Feb 1 12:10:45 UTC 2021
On Mon, 1 Feb 2021 11:35:13 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:
> > compileonly and compilercount=1 will let the VM run slow enough to wait for a gc to be finished.
>
> That's a strange way to provoke the bug. You could just increase the number of iterations instead.
>
> But the right way to fix it is to stress ZGC to continuously run in the background while the test case aggressively unboxes vectors in compiled code. `-Xmx256m` helps with that while `-XX:CICompilerCount=1` is irrelevant.
Yes, it's very weird to provoke the bug like this. If CICompilerCount=1 is removed, the test failed 60% roughly on my machine.
And the iteration has already changed from 100 to 1000, the run time of the test is nearly 30s on release version of jvm.
If I add the following patch, the test always fails on my machine,
diff --git a/test/hotspot/jtreg/compiler/vectorapi/VectorRebracket128Test.java b/test/hotspot/jtreg/compiler/vectorapi/VectorRebracket128Test.java
index 1843ec0..959b29a 100644
--- a/test/hotspot/jtreg/compiler/vectorapi/VectorRebracket128Test.java
+++ b/test/hotspot/jtreg/compiler/vectorapi/VectorRebracket128Test.java
@@ -44,7 +44,7 @@ import jdk.internal.vm.annotation.ForceInline;
* @modules jdk.incubator.vector
* @modules java.base/jdk.internal.vm.annotation
* @run testng/othervm -XX:CompileCommand=compileonly,jdk/incubator/vector/ByteVector.fromByteBuffer
- * -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:+UseZGC -Xbatch -Xmx256m VectorRebracket128Test
+ * -XX:-TieredCompilation -XX:+UseZGC -Xmx256m VectorRebracket128Test
*/
@Test
@@ -125,6 +125,14 @@ public class VectorRebracket128Test {
@ForceInline
static <E,F>
void testVectorRebracket(VectorSpecies<E> a, VectorSpecies<F> b, byte[] input, byte[] output) {
+ new Thread(() -> {
+ while (true) {
+ try {
+ System.gc();
+ Thread.sleep(100);
+ } catch (Exception e) {}
+ }
+ }).start();
Vector<E> av = a.fromByteArray(input, 0, ByteOrder.nativeOrder());
int block;
assert(input.length == output.length);
-------------
PR: https://git.openjdk.java.net/jdk16/pull/139
More information about the hotspot-gc-dev
mailing list