8387334: IR Framework tests should run in jtreg driver mode

Reviewed-by: epeter, shade, chagedorn, mchevalier
This commit is contained in:
Tobias Hartmann 2026-07-01 05:55:55 +00:00
parent aa17cf5608
commit 64ae319b5c
39 changed files with 180 additions and 340 deletions

View File

@ -38,7 +38,7 @@ import compiler.lib.ir_framework.*;
* @summary Tests to ensure that reachabilityFence() correctly keeps objects from being collected prematurely.
* @modules java.base/jdk.internal.misc
* @library /test/lib /
* @run main/othervm -Xbatch compiler.c2.ReachabilityFenceTest
* @run driver ${test.main.class}
*/
public class ReachabilityFenceTest {
private static final int SIZE = 100;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -38,7 +38,7 @@ import java.util.Random;
* @summary Test merging of consecutive stores
* @modules java.base/jdk.internal.misc
* @library /test/lib /
* @run main/timeout=480 compiler.c2.TestMergeStores aligned
* @run driver/timeout=480 ${test.main.class} aligned
*/
/*
@ -48,7 +48,7 @@ import java.util.Random;
* @summary Test merging of consecutive stores
* @modules java.base/jdk.internal.misc
* @library /test/lib /
* @run main/timeout=480 compiler.c2.TestMergeStores unaligned
* @run driver/timeout=480 ${test.main.class} unaligned
*/
/*
@ -58,7 +58,7 @@ import java.util.Random;
* @summary Test merging of consecutive stores
* @modules java.base/jdk.internal.misc
* @library /test/lib /
* @run main/timeout=480 compiler.c2.TestMergeStores StressIGVN
* @run driver/timeout=480 ${test.main.class} StressIGVN
*/
public class TestMergeStores {

View File

@ -31,7 +31,7 @@ import compiler.lib.ir_framework.*;
* @summary Test barriers emitted in constructors
* @library /test/lib /
* @requires os.arch=="aarch64" | os.arch=="riscv64" | os.arch=="x86_64" | os.arch=="amd64"
* @run main compiler.c2.irTests.ConstructorBarriers
* @run driver ${test.main.class}
*/
public class ConstructorBarriers {
public static void main(String[] args) {

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2023, Red Hat, Inc. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,6 @@ package compiler.c2.irTests;
import compiler.lib.ir_framework.*;
import jdk.test.lib.Utils;
import jdk.test.whitebox.WhiteBox;
import jdk.internal.misc.Unsafe;
import java.util.Random;
import java.util.Arrays;
@ -40,15 +39,12 @@ import java.util.List;
* @summary C2: vectorization fails on simple ByteBuffer loop
* @modules java.base/jdk.internal.misc
* @library /test/lib /
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI compiler.c2.irTests.TestVectorizationMismatchedAccess
* @run driver ${test.main.class}
*/
public class TestVectorizationMismatchedAccess {
private static final Unsafe UNSAFE = Unsafe.getUnsafe();
private static final Random RANDOM = Utils.getRandomInstance();
private final static WhiteBox wb = WhiteBox.getWhiteBox();
public static void main(String[] args) {
TestFramework framework = new TestFramework();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, Rivos Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -30,7 +30,7 @@
*
* @library /test/lib /
* @requires os.arch == "riscv64" & vm.cpu.features ~= ".*zbkb.*"
* @run main/othervm compiler.c2.riscv64.TestIntegerReverse
* @run driver ${test.main.class}
*/
package compiler.c2.riscv64;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, Rivos Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -30,7 +30,7 @@
*
* @library /test/lib /
* @requires os.arch == "riscv64" & vm.cpu.features ~= ".*zbkb.*"
* @run main/othervm compiler.c2.riscv64.TestLongReverse
* @run driver ${test.main.class}
*/
package compiler.c2.riscv64;

View File

@ -43,7 +43,7 @@ import test.java.lang.invoke.lib.InstructionHelper;
* @library /test/lib /test/jdk/java/lang/invoke/common /
* @build test.java.lang.invoke.lib.InstructionHelper
*
* @run main/othervm ${test.main.class}
* @run driver ${test.main.class}
*/
public class TestDebugDuringExceptionCatching {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,7 +27,7 @@
* @summary Ranges can be proven to be disjoint but not orderable (thanks to unsigned range)
* Comparing such values in such range with != should always be true.
* @library /test/lib /
* @run main compiler.igvn.CmpDisjointButNonOrderedRangesLong
* @run driver ${test.main.class}
*/
package compiler.igvn;

View File

@ -32,14 +32,11 @@ import java.util.Objects;
* @bug 8342692
* @summary C2: long counted loop/long range checks: don't create loop-nest for short running loops
* @library /test/lib /
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI compiler.longcountedloops.TestShortRunningLongCountedLoop
* @run driver ${test.main.class}
*/
public class TestShortRunningLongCountedLoop {
private static volatile int volatileField;
private final static WhiteBox wb = WhiteBox.getWhiteBox();
public static void main(String[] args) {
// IR rules expect a single loop so disable unrolling
@ -351,8 +348,9 @@ public class TestShortRunningLongCountedLoop {
throw new RuntimeException("incorrect result: " + res);
}
}
wb.enqueueMethodForCompilation(info.getTest(), CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION);
if (!wb.isMethodCompiled(info.getTest())) {
WhiteBox whitebox = WhiteBox.getWhiteBox();
whitebox.enqueueMethodForCompilation(info.getTest(), CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION);
if (!whitebox.isMethodCompiled(info.getTest())) {
throw new RuntimeException("Should be compiled now");
}
for (int i = 0; i < 10; i++) {

View File

@ -27,14 +27,14 @@
* @summary Test CountedLoopConverter::has_truncation_wrap logic that checks if
* a truncated iv (e.g. byte or char iv) is still a valid counted loop.
* @library /test/lib /
* @run main ${test.main.class}
* @run driver ${test.main.class}
*/
/*
* @test id=Xcomp
* @bug 8385855
* @library /test/lib /
* @run main ${test.main.class} -Xcomp -XX:-TieredCompilation -XX:CompileCommand=compileonly,${test.main.class}::test*
* @run driver ${test.main.class} -Xcomp -XX:-TieredCompilation -XX:CompileCommand=compileonly,${test.main.class}::test*
*/
package compiler.loopopts;

View File

@ -30,7 +30,7 @@ import compiler.lib.ir_framework.*;
* @bug 8347499
* @summary Tests that redundant safepoints can be eliminated in loops.
* @library /test/lib /
* @run main compiler.loopopts.TestRedundantSafepointElimination
* @run driver ${test.main.class}
*/
public class TestRedundantSafepointElimination {
public static void main(String[] args) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,14 +27,14 @@
* @summary Test logic in IfNode::fold_compares, which folds 2 signed comparisons
* into a single comparison.
* @library /test/lib /
* @run main ${test.main.class}
* @run driver ${test.main.class}
*/
/*
* @test id=Xcomp
* @bug 8346420
* @library /test/lib /
* @run main ${test.main.class} -Xcomp -XX:-TieredCompilation -XX:CompileCommand=compileonly,${test.main.class}::test*
* @run driver ${test.main.class} -Xcomp -XX:-TieredCompilation -XX:CompileCommand=compileonly,${test.main.class}::test*
*/
package compiler.rangechecks;

View File

@ -27,7 +27,7 @@
* @modules java.base/jdk.internal.lang
* @library /test/lib /
* @enablePreview
* @run main ${test.main.class}
* @run driver ${test.main.class}
*/
package compiler.stable;

View File

@ -29,7 +29,7 @@
* @key randomness
* @summary Test vectorization of rotate byte and short
* @library /test/lib /
* @run main/othervm TestRotateByteAndShortVector
* @run driver ${test.main.class}
*/
import java.util.Random;

View File

@ -31,7 +31,7 @@
* @library /test/lib /
* @modules java.base/jdk.internal.math
* @requires os.arch == "riscv64" & vm.cpu.features ~= ".*rvv.*"
* @run main compiler.vectorization.TestRoundVectorDoubleRandom
* @run driver ${test.main.class}
*/
package compiler.vectorization;

View File

@ -31,7 +31,7 @@
* @library /test/lib /
* @modules java.base/jdk.internal.math
* @requires os.arch == "riscv64" & vm.cpu.features ~= ".*rvv.*"
* @run main compiler.vectorization.TestRoundVectorFloatRandom
* @run driver ${test.main.class}
*/
package compiler.vectorization;

View File

@ -24,18 +24,10 @@
/*
* @test
* @summary Vectorization test on array copy
* @requires vm.compiler2.enabled
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.ArrayCopyTest
*
* @requires vm.compiler2.enabled
* @run driver ${test.main.class}
*/
package compiler.vectorization.runner;

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,18 +26,10 @@
* @test
* @summary Vectorization test on array index fill
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.ArrayIndexFillTest
*
* @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64") | (os.simpleArch == "riscv64")
* @requires vm.compiler2.enabled
*
* @run driver ${test.main.class}
*/
package compiler.vectorization.runner;

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
* Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,24 +26,11 @@
* @test
* @summary Vectorization test on array invariant fill
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* -XX:-OptimizeFill
* compiler.vectorization.runner.ArrayInvariantFillTest
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* -XX:+OptimizeFill
* compiler.vectorization.runner.ArrayInvariantFillTest
*
* @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64") | (os.simpleArch == "riscv64")
* @requires vm.compiler2.enabled
*
* @run driver ${test.main.class} NoOptimizeFill
* @run driver ${test.main.class} OptimizeFill
*/
package compiler.vectorization.runner;
@ -68,11 +56,22 @@ public class ArrayInvariantFillTest extends VectorizationTestRunner {
doubleInv = ran.nextDouble();
}
// We must pass the flags directly to the Test VM, and not the Driver VM in the @run above.
@Override
protected String[] testVMFlags(String[] args) {
return switch (args[0]) {
case "NoOptimizeFill" -> new String[]{"-XX:-OptimizeFill"};
case "OptimizeFill" -> new String[]{"-XX:+OptimizeFill"};
default -> throw new RuntimeException("Test argument not recognized: " + args[0]);
};
}
// ---------------- Simple Fill ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true", "rvv", "true"},
applyIf = {"OptimizeFill", "false"},
counts = {IRNode.REPLICATE_B, ">0"})
// TODO 8387402
//@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true", "rvv", "true"},
// applyIf = {"OptimizeFill", "false"},
// counts = {IRNode.REPLICATE_B, ">0"})
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true", "rvv", "true"},
applyIf = {"OptimizeFill", "true"},
counts = {IRNode.REPLICATE_B, "0"})

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, Rivos Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -28,18 +28,10 @@
* @bug 8183390 8332905
* @summary Vectorization test on bug-prone shift operation
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.ArrayShiftOpTest
*
* @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64") | (os.simpleArch == "riscv64")
* @requires vm.compiler2.enabled
*
* @run driver ${test.main.class}
*/
package compiler.vectorization.runner;

View File

@ -27,33 +27,12 @@
* @bug 8183390 8340010 8342095
* @summary Vectorization test on array type conversions
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @requires vm.compiler2.enabled
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
*
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.ArrayTypeConvertTest nCOH_nAV
*
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.ArrayTypeConvertTest nCOH_yAV
*
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.ArrayTypeConvertTest yCOH_nAV
*
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.ArrayTypeConvertTest yCOH_yAV
* @run driver ${test.main.class} nCOH_nAV
* @run driver ${test.main.class} nCOH_yAV
* @run driver ${test.main.class} yCOH_nAV
* @run driver ${test.main.class} yCOH_yAV
*/
package compiler.vectorization.runner;

View File

@ -25,17 +25,9 @@
* @test
* @summary Vectorization test on array unsafe operations
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.ArrayUnsafeOpTest
*
* @requires vm.compiler2.enabled
*
* @run driver ${test.main.class}
*/
package compiler.vectorization.runner;

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,17 +27,9 @@
* @summary Vectorization test on basic boolean operations
* @requires vm.opt.StressUnstableIfTraps == null | !vm.opt.StressUnstableIfTraps
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.BasicBooleanOpTest
*
* @requires vm.compiler2.enabled
*
* @run driver ${test.main.class}
*/
package compiler.vectorization.runner;

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,19 +26,9 @@
* @test
* @summary Vectorization test on basic byte operations
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* -XX:CompileCommand=CompileOnly,compiler.vectorization.runner.BasicByteOpTest::*
* -XX:LoopUnrollLimit=1000
* compiler.vectorization.runner.BasicByteOpTest
*
* @requires vm.compiler2.enabled
*
* @run driver ${test.main.class}
*/
package compiler.vectorization.runner;
@ -64,6 +54,12 @@ public class BasicByteOpTest extends VectorizationTestRunner {
}
}
// We must pass the flags directly to the test-VM, and not the driver vm in the @run above.
@Override
protected String[] testVMFlags(String[] args) {
return new String[]{"-XX:CompileCommand=CompileOnly,compiler.vectorization.runner.BasicByteOpTest::*", "-XX:LoopUnrollLimit=1000"};
}
// ---------------- Arithmetic ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true", "rvv", "true"},

View File

@ -25,17 +25,9 @@
* @test
* @summary Vectorization test on basic char operations
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.BasicCharOpTest
*
* @requires vm.compiler2.enabled
*
* @run driver ${test.main.class}
*/
package compiler.vectorization.runner;

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, Rivos Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -27,18 +27,10 @@
* @test
* @summary Vectorization test on basic double operations
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.BasicDoubleOpTest
*
* @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64") | (os.simpleArch == "riscv64")
* @requires vm.compiler2.enabled
*
* @run driver ${test.main.class}
*/
package compiler.vectorization.runner;

View File

@ -25,18 +25,10 @@
* @test
* @summary Vectorization test on basic float operations
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.BasicFloatOpTest
*
* @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64") | (os.simpleArch == "riscv64")
* @requires vm.compiler2.enabled
*
* @run driver ${test.main.class}
*/
package compiler.vectorization.runner;

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,17 +26,9 @@
* @test
* @summary Vectorization test on basic int operations
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.BasicIntOpTest
*
* @requires vm.compiler2.enabled
*
* @run driver ${test.main.class}
*/
package compiler.vectorization.runner;

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,18 +26,10 @@
* @test
* @summary Vectorization test on basic long operations
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.BasicLongOpTest
*
* @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64") | (os.simpleArch == "riscv64")
* @requires vm.compiler2.enabled
*
* @run driver ${test.main.class}
*/
package compiler.vectorization.runner;

View File

@ -27,17 +27,9 @@
* @bug 8183390 8342095
* @summary Vectorization test on basic short operations
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.BasicShortOpTest
*
* @requires vm.compiler2.enabled
*
* @run driver ${test.main.class}
*/
package compiler.vectorization.runner;

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,26 +26,13 @@
* @test
* @summary Vectorization test on loop array index computation
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
*
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* compiler.vectorization.runner.LoopArrayIndexComputeTest nAV_ySAC
*
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* compiler.vectorization.runner.LoopArrayIndexComputeTest yAV_ySAC
*
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* compiler.vectorization.runner.LoopArrayIndexComputeTest nAV_nSAC
*
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* compiler.vectorization.runner.LoopArrayIndexComputeTest yAV_nSAC
*
* @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64")
* @requires vm.compiler2.enabled
*
* @run driver ${test.main.class} nAV_ySAC
* @run driver ${test.main.class} yAV_ySAC
* @run driver ${test.main.class} nAV_nSAC
* @run driver ${test.main.class} yAV_nSAC
*/
package compiler.vectorization.runner;
@ -60,10 +47,10 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
@Override
protected String[] testVMFlags(String[] args) {
return switch (args[0]) {
case "nAV_ySAC" -> new String[]{"-XX:-AlignVector", "-XX:+UseAutoVectorizationSpeculativeAliasingChecks"};
case "yAV_ySAC" -> new String[]{"-XX:+AlignVector", "-XX:+UseAutoVectorizationSpeculativeAliasingChecks"};
case "nAV_nSAC" -> new String[]{"-XX:-AlignVector", "-XX:-UseAutoVectorizationSpeculativeAliasingChecks"};
case "yAV_nSAC" -> new String[]{"-XX:+AlignVector", "-XX:-UseAutoVectorizationSpeculativeAliasingChecks"};
case "nAV_ySAC" -> new String[]{"-XX:+UnlockDiagnosticVMOptions", "-XX:-AlignVector", "-XX:+UseAutoVectorizationSpeculativeAliasingChecks"};
case "yAV_ySAC" -> new String[]{"-XX:+UnlockDiagnosticVMOptions", "-XX:+AlignVector", "-XX:+UseAutoVectorizationSpeculativeAliasingChecks"};
case "nAV_nSAC" -> new String[]{"-XX:+UnlockDiagnosticVMOptions", "-XX:-AlignVector", "-XX:-UseAutoVectorizationSpeculativeAliasingChecks"};
case "yAV_nSAC" -> new String[]{"-XX:+UnlockDiagnosticVMOptions", "-XX:+AlignVector", "-XX:-UseAutoVectorizationSpeculativeAliasingChecks"};
default -> { throw new RuntimeException("Test argument not recognized: " + args[0]); }
};
}

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,33 +26,12 @@
* @test
* @summary Vectorization test on combined operations
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @requires vm.compiler2.enabled
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
*
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.LoopCombinedOpTest nCOH_nAV
*
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.LoopCombinedOpTest nCOH_yAV
*
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.LoopCombinedOpTest yCOH_nAV
*
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.LoopCombinedOpTest yCOH_yAV
* @run driver ${test.main.class} nCOH_nAV
* @run driver ${test.main.class} nCOH_yAV
* @run driver ${test.main.class} yCOH_nAV
* @run driver ${test.main.class} yCOH_yAV
*/
package compiler.vectorization.runner;

View File

@ -25,17 +25,9 @@
* @test
* @summary Vectorization test on simple control flow in loop
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.LoopControlFlowTest
*
* @requires vm.compiler2.enabled
*
* @run driver ${test.main.class}
*/
package compiler.vectorization.runner;

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,17 +26,9 @@
* @test
* @summary Vectorization test on loops with live out nodes
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.LoopLiveOutNodesTest
*
* @requires vm.compiler2.enabled
*
* @run driver ${test.main.class}
*/
package compiler.vectorization.runner;

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,18 +26,10 @@
* @test
* @summary Vectorization test on different loop ranges and strides
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.LoopRangeStrideTest
*
* @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64") | (os.simpleArch == "riscv64")
* @requires vm.compiler2.enabled
*
* @run driver ${test.main.class}
*/
package compiler.vectorization.runner;

View File

@ -25,19 +25,10 @@
* @test
* @summary Vectorization test on reduction operations
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.LoopReductionOpTest
*
* @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64") | (os.simpleArch == "riscv64")
* @requires vm.compiler2.enabled
*
* @run driver ${test.main.class}
*/
package compiler.vectorization.runner;

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,17 +26,9 @@
* @test
* @summary Vectorization test on multiple loops in a method
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.MultipleLoopsTest
*
* @requires vm.compiler2.enabled
*
* @run driver ${test.main.class}
*/
package compiler.vectorization.runner;

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
* Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,18 +26,9 @@
* @test
* @summary Vectorization test with small strip mining iterations
* @library /test/lib /
*
* @build jdk.test.whitebox.WhiteBox
* compiler.vectorization.runner.VectorizationTestRunner
*
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* -XX:LoopStripMiningIter=10
* compiler.vectorization.runner.StripMinedLoopTest
*
* @requires vm.compiler2.enabled
*
* @run driver ${test.main.class}
*/
package compiler.vectorization.runner;
@ -59,6 +51,12 @@ public class StripMinedLoopTest extends VectorizationTestRunner {
}
}
// We must pass the flags directly to the Test VM, and not the Driver VM in the @run above.
@Override
protected String[] testVMFlags(String[] args) {
return new String[]{"-XX:LoopStripMiningIter=10"};
}
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true", "rvv", "true"},
counts = {IRNode.STORE_VECTOR, ">0"})

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2022, 2023, Arm Limited. All rights reserved.
* Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,14 +30,23 @@ import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import jdk.test.lib.Utils;
import jdk.test.lib.helpers.ClassFileInstaller;
import jdk.test.lib.process.ProcessTools;
import jdk.test.whitebox.WhiteBox;
public class VectorizationTestRunner {
private static final WhiteBox WB = WhiteBox.getWhiteBox();
private static final String VERIFY_CORRECTNESS_ARG = "--verify-vectorization-correctness";
private static class Flags {
private static final WhiteBox WHITEBOX = WhiteBox.getWhiteBox();
}
private static final int COMP_LEVEL_INTP = 0;
private static final int COMP_LEVEL_C2 = 4;
@ -52,6 +62,35 @@ public class VectorizationTestRunner {
// invokes it twice - first time in the interpreter and second time compiled
// by C2. Then this runner compares the two return values. Hence we require
// each test method returning a primitive value or an array of primitive type.
runCorrectnessTestsInTestVM(args);
// 2) Vectorization ability test
// To test vectorizability, invoke the IR test framework to check existence of
// expected C2 IR node.
TestFramework irTest = new TestFramework(klass);
irTest.addFlags(testVMFlags(args));
irTest.start();
}
private void runCorrectnessTestsInTestVM(String[] args) {
List<String> command = new ArrayList<>();
command.addAll(Arrays.asList(testVMFlags(args)));
command.add("-Xbootclasspath/a:.");
command.add("-XX:+UnlockDiagnosticVMOptions");
command.add("-XX:+WhiteBoxAPI");
command.add(getClass().getName());
command.add(VERIFY_CORRECTNESS_ARG);
command.add(getClass().getName());
try {
ClassFileInstaller.main("jdk.test.whitebox.WhiteBox");
ProcessTools.executeTestJava(command).shouldHaveExitValue(0);
} catch (Exception e) {
throw new RuntimeException("Vectorization correctness test failed", e);
}
}
private void runCorrectnessTests() {
Class klass = getClass();
for (Method method : klass.getDeclaredMethods()) {
try {
if (method.isAnnotationPresent(Test.class)) {
@ -63,13 +102,6 @@ public class VectorizationTestRunner {
"." + method.getName() + ": " + e.getMessage());
}
}
// 2) Vectorization ability test
// To test vectorizability, invoke the IR test framework to check existence of
// expected C2 IR node.
TestFramework irTest = new TestFramework(klass);
irTest.addFlags(testVMFlags(args));
irTest.start();
}
// Override this to add extra flags.
@ -111,20 +143,20 @@ public class VectorizationTestRunner {
// Temporarily disable the compiler and invoke the method to get reference
// result from the interpreter
WB.setBooleanVMFlag("UseCompiler", false);
Flags.WHITEBOX.setBooleanVMFlag("UseCompiler", false);
try {
expected = method.invoke(this);
} catch (Exception e) {
e.printStackTrace();
fail("Exception is thrown in test method invocation (interpreter).");
}
assert(WB.getMethodCompilationLevel(method) == COMP_LEVEL_INTP);
WB.setBooleanVMFlag("UseCompiler", true);
assert(Flags.WHITEBOX.getMethodCompilationLevel(method) == COMP_LEVEL_INTP);
Flags.WHITEBOX.setBooleanVMFlag("UseCompiler", true);
// Compile the method and invoke it again
long enqueueTime = System.currentTimeMillis();
WB.enqueueMethodForCompilation(method, COMP_LEVEL_C2);
while (WB.getMethodCompilationLevel(method) != COMP_LEVEL_C2) {
Flags.WHITEBOX.enqueueMethodForCompilation(method, COMP_LEVEL_C2);
while (Flags.WHITEBOX.getMethodCompilationLevel(method) != COMP_LEVEL_C2) {
Thread.sleep(100 /*ms*/);
}
try {
@ -133,7 +165,7 @@ public class VectorizationTestRunner {
e.printStackTrace();
fail("Exception is thrown in test method invocation (C2).");
}
assert(WB.getMethodCompilationLevel(method) == COMP_LEVEL_C2);
assert(Flags.WHITEBOX.getMethodCompilationLevel(method) == COMP_LEVEL_C2);
// Check if two invocations return the same
Class retType = method.getReturnType();
@ -172,11 +204,10 @@ public class VectorizationTestRunner {
}
private static VectorizationTestRunner createTestInstance(String testName) {
if (!testName.toLowerCase().endsWith(".java")) {
fail("Invalid test file name " + testName);
if (testName.toLowerCase().endsWith(".java")) {
testName = testName.substring(0, testName.length() - 5);
testName = testName.replace('/', '.');
}
testName = testName.substring(0, testName.length() - 5);
testName = testName.replace('/', '.');
VectorizationTestRunner instance = null;
try {
@ -196,7 +227,13 @@ public class VectorizationTestRunner {
}
public static void main(String[] args) {
VectorizationTestRunner testObj = createTestInstance(Utils.TEST_NAME);
VectorizationTestRunner testObj;
if (args.length > 0 && args[0].equals(VERIFY_CORRECTNESS_ARG)) {
testObj = createTestInstance(args[1]);
testObj.runCorrectnessTests();
return;
}
testObj = createTestInstance(Utils.TEST_NAME);
testObj.run(args);
}
}