|
32 | 32 | *
|
33 | 33 | * Run with varing levels of AVX and SSE support, also without the intrinsic at all
|
34 | 34 | *
|
35 |
| - * @library /compiler/patches /test/lib |
36 |
| - * @run main/othervm -Xbatch -XX:Tier4InvocationThreshold=200 -XX:CompileThreshold=100 compiler.intrinsics.string.TestStringLatin1IndexOfChar |
37 |
| - * @run main/othervm -Xbatch -XX:Tier4InvocationThreshold=200 -XX:CompileThreshold=100 -XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_indexOfL_char compiler.intrinsics.string.TestStringLatin1IndexOfChar |
38 |
| - * @run main/othervm -Xbatch -XX:Tier4InvocationThreshold=200 -XX:CompileThreshold=100 -XX:+IgnoreUnrecognizedVMOptions -XX:UseSSE=0 compiler.intrinsics.string.TestStringLatin1IndexOfChar |
39 |
| - * @run main/othervm -Xbatch -XX:Tier4InvocationThreshold=200 -XX:CompileThreshold=100 -XX:+IgnoreUnrecognizedVMOptions -XX:UseAVX=1 compiler.intrinsics.string.TestStringLatin1IndexOfChar |
40 |
| - * @run main/othervm -Xbatch -XX:Tier4InvocationThreshold=200 -XX:CompileThreshold=100 -XX:+IgnoreUnrecognizedVMOptions -XX:UseAVX=2 compiler.intrinsics.string.TestStringLatin1IndexOfChar |
41 |
| - * @run main/othervm -Xbatch -XX:Tier4InvocationThreshold=200 -XX:CompileThreshold=100 -XX:+IgnoreUnrecognizedVMOptions -XX:UseAVX=3 compiler.intrinsics.string.TestStringLatin1IndexOfChar |
| 35 | + * @requires vm.compiler2.enabled |
| 36 | + * @library /compiler/patches /test/lib / |
| 37 | + * @build jdk.test.whitebox.WhiteBox |
| 38 | + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox |
| 39 | + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI |
| 40 | + * -Xbatch compiler.intrinsics.string.TestStringLatin1IndexOfChar |
| 41 | + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI |
| 42 | + * -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_indexOfL_char compiler.intrinsics.string.TestStringLatin1IndexOfChar |
| 43 | + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI |
| 44 | + * -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:UseAVX=0 compiler.intrinsics.string.TestStringLatin1IndexOfChar |
| 45 | + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI |
| 46 | + * -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:UseAVX=1 compiler.intrinsics.string.TestStringLatin1IndexOfChar |
| 47 | + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI |
| 48 | + * -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:UseAVX=2 compiler.intrinsics.string.TestStringLatin1IndexOfChar |
| 49 | + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI |
| 50 | + * -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:UseAVX=3 compiler.intrinsics.string.TestStringLatin1IndexOfChar |
42 | 51 | */
|
43 | 52 |
|
44 | 53 | package compiler.intrinsics.string;
|
45 | 54 |
|
46 | 55 | import jdk.test.lib.Asserts;
|
| 56 | +import jdk.test.whitebox.WhiteBox; |
| 57 | +import java.lang.reflect.Method; |
| 58 | +import compiler.whitebox.CompilerWhiteBoxTest; |
47 | 59 |
|
48 | 60 | public class TestStringLatin1IndexOfChar{
|
| 61 | + private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); |
49 | 62 | private final static int MAX_LENGTH = 2048;//future proof for AVX-512 instructions
|
50 | 63 |
|
51 | 64 | public static void main(String[] args) throws Exception {
|
52 |
| - for (int i = 0; i < 1_000; ++i) {//repeat such that we enter into C2 code... |
| 65 | + Method methodFindOneItem = TestStringLatin1IndexOfChar.class.getDeclaredMethod("findOneItem"); |
| 66 | + Method methodWithOffsetTest = TestStringLatin1IndexOfChar.class.getDeclaredMethod("withOffsetTest"); |
| 67 | + Method methodTestEmpty = TestStringLatin1IndexOfChar.class.getDeclaredMethod("testEmpty"); |
| 68 | + Asserts.assertNotNull(methodFindOneItem); |
| 69 | + Asserts.assertNotNull(methodWithOffsetTest); |
| 70 | + Asserts.assertNotNull(methodTestEmpty); |
| 71 | + |
| 72 | + // Warmup - profiling must inline the methods |
| 73 | + for (int i = 0; i < 10; ++i) { |
| 74 | + findOneItem(); |
| 75 | + withOffsetTest(); |
| 76 | + testEmpty(); |
| 77 | + } |
| 78 | + |
| 79 | + // Compile |
| 80 | + WHITE_BOX.enqueueMethodForCompilation(methodFindOneItem, CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION); |
| 81 | + WHITE_BOX.enqueueMethodForCompilation(methodWithOffsetTest, CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION); |
| 82 | + WHITE_BOX.enqueueMethodForCompilation(methodTestEmpty, CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION); |
| 83 | + |
| 84 | + // Run compiled method |
| 85 | + for (int i = 0; i < 10; ++i) { |
53 | 86 | findOneItem();
|
54 | 87 | withOffsetTest();
|
55 | 88 | testEmpty();
|
|
0 commit comments