Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
14b1508
Initial and last commit of 2020
chhagedorn Dec 22, 2020
b6e4b98
Fix @Run and @Check, added more IR rules, refactorings, added more tests
chhagedorn Jan 15, 2021
24de07c
Refactor usage of TestFrameworkException
chhagedorn Jan 15, 2021
85a1547
Refactoring
chhagedorn Jan 18, 2021
2f5449d
Fix helper classes and add test for it
chhagedorn Jan 18, 2021
12b6629
Fixing how scenarios are defined, run, checked and error reported
chhagedorn Jan 18, 2021
9060277
Add @Run mode
chhagedorn Jan 19, 2021
66de13b
Fix compilation level for @Test
chhagedorn Jan 20, 2021
9e66467
Finishing counts rule for @IR and adding appropriate tests + fixing s…
chhagedorn Jan 25, 2021
11e7b54
Minor cleanups
chhagedorn Jan 25, 2021
6f4be30
Switch to bulk reporting for TestFormatExceptions instead of throwing…
chhagedorn Jan 26, 2021
ab5de84
Fix @Warmup and @DontCompile, add compile commands tests and more Bad…
chhagedorn Jan 26, 2021
a7fb1ac
Add PRINT_GRAPH, Xcomp and UseCompile handling, fix public Framework …
chhagedorn Jan 27, 2021
2311388
Redesign TestFramework interface
chhagedorn Jan 29, 2021
c99eb3b
Rename ArgumentValue <-> Argument
chhagedorn Feb 1, 2021
bc5375e
Add MIN/MAX as possible Argument
chhagedorn Feb 3, 2021
31e1be9
Insert Copyright headers and small clean ups
chhagedorn Feb 15, 2021
a786810
Add more "bad" tests
chhagedorn Feb 15, 2021
6dfadf2
Add more compiler control tests
chhagedorn Feb 16, 2021
f480f75
Fix @DontCompile and @ForceCompile and add tests for it, fix TestBadF…
chhagedorn Feb 16, 2021
5963c88
Update Copyright to 2021, rename INVOKE_ONCE to STANDALONE
chhagedorn Feb 16, 2021
a78e232
Finish bad tests (check, run, IR), clean up some unused code
chhagedorn Feb 17, 2021
247285c
Fixing @DontCompile to only allow one option, start writing Javadocs
chhagedorn Feb 17, 2021
3815a1c
Add more bad IR tests and doing some related small fixes and clean-ups
chhagedorn Feb 18, 2021
6801f53
Adding more IR tests
chhagedorn Feb 19, 2021
2d5f983
Add IR tests for trap, scope object, completely updated the format of…
chhagedorn Feb 24, 2021
e612085
Added remaining IR nodes for mainline with tests for them
chhagedorn Feb 24, 2021
89dd171
Rename package into compiler.testframework
chhagedorn Feb 24, 2021
4760539
Rename and move project
chhagedorn Mar 1, 2021
b6ddfdc
Move framework to /test/lib, add TestFrameworkDriver with example test
chhagedorn Mar 2, 2021
8a5c6d4
Improve jtreg support with suggestions from Igor I., split TestFramew…
chhagedorn Mar 3, 2021
1e1a394
Move and rename framework to test/lib/jdk/jdk/test/lib/hotspot/ir_fra…
chhagedorn Mar 3, 2021
c65facb
Propagate VM, test flags and scenario flags to test VM and exclude it…
chhagedorn Mar 4, 2021
0c31c5b
Some minor clean ups
chhagedorn Mar 4, 2021
1e9412b
Some first conversion attempts
chhagedorn Mar 4, 2021
ff4b2ac
Add some examples
chhagedorn Mar 4, 2021
a159794
Change VM nesting: driver VM first calls flag VM, parse flags from it…
chhagedorn Mar 5, 2021
7521523
Add support for nested class with compile commands, add checks for ne…
chhagedorn Mar 5, 2021
aeb9c6f
Fix reporting of seemingly wrong format violations due to previously …
chhagedorn Mar 8, 2021
0a1c1e6
Set up everything for Valhalla test conversions, set up helper classe…
chhagedorn Mar 8, 2021
c049042
small fixes and move remaining old tests to old_inlinetypes
chhagedorn Mar 8, 2021
5b2401c
Add new ClassFileInstaller
chhagedorn Mar 9, 2021
db7c409
Change encoding passing from flag and test VM to driver VM from using…
chhagedorn Mar 9, 2021
c833e85
Add more Javadocs
chhagedorn Mar 10, 2021
c37d30b
Add more Javadocs
chhagedorn Mar 11, 2021
fc13fb8
Fix port and host name for framework socket, fix tests accordingly, r…
chhagedorn Mar 11, 2021
25d53c4
Fix access modifier bug for checked and custom run test
chhagedorn Mar 11, 2021
bbdc9a5
Deoptimize as interface method
chhagedorn Mar 16, 2021
9763c3b
Support multiple @Test methods in custom run test (includes refactori…
chhagedorn Mar 16, 2021
40b6ce2
Support helper annotations on constructors, add @ForceCompileClassIni…
chhagedorn Mar 17, 2021
5c264c3
Add some more Javadocs
chhagedorn Mar 17, 2021
924db85
Converted TestBasicFunctionality.java to use IR framework
katyapav Mar 17, 2021
03cbebf
Fixed spaces in IR annotations
katyapav Mar 17, 2021
92e3962
Add setDefaultWarmup() and remove clear() as interface method, share …
chhagedorn Mar 18, 2021
e8bffb9
Forbid use of AbstractInfo as parameter or return type in any @Test m…
chhagedorn Mar 18, 2021
3841841
Merge branch 'TestingFramework' of https://github.com/chhagedorn/valh…
katyapav Mar 18, 2021
d92ae56
Added getTestMethod returning a Method object for particular test
katyapav Mar 18, 2021
7b525d6
Addjusted to latest TestFramework changes
katyapav Mar 18, 2021
57af353
Move TestBasicFunctionality.java 1/3
chhagedorn Mar 19, 2021
0a18c98
Move TestBasicFunctionality.java 2/3
chhagedorn Mar 19, 2021
0ca740b
Move all tests back to inlinetypes
chhagedorn Mar 19, 2021
6ccdcdb
Move TestBasicFunctionality.java 3/3
chhagedorn Mar 19, 2021
16e2a15
Remove old_inlinetypes and only keep the converted versions
chhagedorn Mar 19, 2021
004192e
Add isCompiled() and fix isCompiledAtLevel() to handle ANY
chhagedorn Mar 19, 2021
e7e9ab3
Converted the test to IT framework
katyapav Mar 22, 2021
90af9b0
Commented the check whether the method to be compiled is @Test annotated
katyapav Mar 22, 2021
01d04a1
Fix hanging socket connections blocking the framework, fix nested hel…
chhagedorn Mar 23, 2021
48488c9
Added @ForceCompileClassInitializer for helper classes to match old f…
katyapav Mar 23, 2021
e510d97
Converted tests to new IR framework.
katyapav Mar 23, 2021
eacf1aa
Improve error reporting and exception structure, add -DReproduce to r…
chhagedorn Mar 24, 2021
605aba6
Throw FormatViolation for nested helper inside test class (implicit h…
chhagedorn Mar 24, 2021
ef992a1
Synced scenarios with the ones in the test from master valhalla ws
katyapav Mar 25, 2021
f191444
Converted tests to new IR framework
katyapav Mar 25, 2021
d8535e2
Update some code style cleanups for converted tests
chhagedorn Mar 25, 2021
4513a0f
Converted the test to new IR framework
katyapav Mar 25, 2021
91f7b33
Forgot to commit tests 97-99, 107-109
katyapav Mar 25, 2021
ff58401
Converted TestJNICalls.java to new IR framework
katyapav Mar 26, 2021
d448689
Converted tests to new IR framework
katyapav Mar 26, 2021
5c9de77
Clean up some things in converted tests
chhagedorn Mar 26, 2021
0b76189
Fix bug where @ForceCompile methods could have inlined a @Test before…
chhagedorn Mar 26, 2021
b8c49f1
Converted TestMethodHandles.java to new IR framework
katyapav Mar 26, 2021
47a3d77
Add more Javadocs, update assertCompiledXXX methods and remove some u…
chhagedorn Mar 29, 2021
4b213e9
Converted TestNullableArrays to new IR framework
katyapav Mar 29, 2021
2257197
Converted TestLWorld.java to new IR framewrok
katyapav Mar 29, 2021
035c06c
Fix @ForceCompileClassInitializer and TestLWorld
chhagedorn Mar 30, 2021
2bcb459
Small test cleanups
chhagedorn Mar 31, 2021
205152d
Change IR matching from stdout based to hotspot_pid file based to fix…
chhagedorn Apr 1, 2021
e378020
Finished adding Javadocs to all classes. Missing: Example tests and r…
chhagedorn Apr 6, 2021
59293ce
Fix TestCallingConvention after clean up
chhagedorn Apr 6, 2021
d738844
Fix -DTest and -DExclude and add exception if empty set specified by …
chhagedorn Apr 7, 2021
f29d742
Cleanup and fix tests to achieve minimal number of changes
chhagedorn Apr 7, 2021
ebbe725
Fix StressCC -> ExcludeRandom
chhagedorn Apr 7, 2021
3def454
Also apply -DFlipC1C2 to @ForceCompile, fix -DScenario parsing
chhagedorn Apr 8, 2021
b5c618d
Add JTreg VM and Javaoptions Whitelist flags to enable/disable IR ver…
chhagedorn Apr 8, 2021
d014761
Convert and fix framework internal tests into JTreg tests and add REA…
chhagedorn Apr 8, 2021
98f5da6
Restrict JTreg tests with @requires, add tests for property flags
chhagedorn Apr 8, 2021
aa6c823
Cleanup and add more examples how to use the framework, add reference…
chhagedorn Apr 9, 2021
bfeeec7
Fix TestLWorld, add more tests for Test and Exclude, add tests for Ru…
chhagedorn Apr 9, 2021
3f4ea7c
Adding testlist logging through socket to reduce noise when just prin…
chhagedorn Apr 9, 2021
d0b9ed1
Fix various Javadocs, especially of class headers
chhagedorn Apr 12, 2021
40b3d42
Re-add Valhalla helper classes and update converted JTreg tests accor…
chhagedorn Apr 12, 2021
0eaa6b1
Fix more tests and clean up ArgumentValue and feedback from Tobias
chhagedorn Apr 12, 2021
61f5b74
Fix bug where socket was stuck after test VM
chhagedorn Apr 12, 2021
7faf865
Clean up VERIFY_IR and finish Javadocs review/clean-up
chhagedorn Apr 12, 2021
6c0d713
Fix compileAtLevel and assertCompiled interface methods
chhagedorn Apr 12, 2021
ac22c94
Fix default scenarios in Valhalla tests to also run with product version
chhagedorn Apr 12, 2021
2d5db90
Fix bug with VERIFY_IR which disabled IR verifications for scenarios,…
chhagedorn Apr 12, 2021
65ad9b6
Fix assertDeoptimizedByCx and improve error reporting when tests thro…
chhagedorn Apr 13, 2021
60c06ad
Converted tests to new IR framework
katyapav Apr 14, 2021
1a4720b
Code style fixes
katyapav Apr 14, 2021
d9de2f9
Cleanup Javadocs and README file, fix TestUnloadedInlineTypeField
chhagedorn Apr 14, 2021
e56df00
Fix timeout of TestNullableArrays and TestNullableInlineTypes
chhagedorn Apr 14, 2021
6a2aae6
Fix TestLWorldProfiling when run with product build
chhagedorn Apr 14, 2021
bc6924e
Fix whitespaces + timeout of TestCallingConvention
chhagedorn Apr 15, 2021
00e05a0
Adjust whitelist
chhagedorn Apr 19, 2021
1338286
Apply review comments in code from Igor I. and Vladimir K.
chhagedorn Apr 19, 2021
22ae413
Update and fixes from review comments
chhagedorn Apr 20, 2021
52a0474
Apply review comments and fix converted tests
chhagedorn Apr 27, 2021
2c0967f
Apply review comments and refactorings
chhagedorn May 3, 2021
cb45701
Add README.md file
chhagedorn Jun 1, 2021
217a626
Move framework to test/hotspot/jtreg/compiler/lib and tests to test/h…
chhagedorn May 4, 2021
f2a8aad
Fix package names and fixing internal tests, examples and README file…
chhagedorn May 4, 2021
4dd1469
Update ClassFileInstaller import
chhagedorn Jun 1, 2021
9c3bcc4
Splitting classes into subpackages and updating README accordingly, f…
chhagedorn May 4, 2021
5ef29bf
Merge lworld, fix conflicts and convert new IR tests to new framework
chhagedorn Jun 1, 2021
e258343
Fix Compiler and CompLevel ANY and fix tests after merge
chhagedorn May 31, 2021
f59b7e2
Fix tests (imports, conversion mistakes etc.)
chhagedorn Jun 2, 2021
c6932b1
Fix converted tests
chhagedorn Jun 4, 2021
3943845
Fix failing internal tests on Windows and add missing flag descriptio…
chhagedorn Jun 3, 2021
8deedc6
Move tests and examples #1
chhagedorn Jun 4, 2021
e9f9c17
Move tests and examples #2
chhagedorn Jun 4, 2021
1c43e46
Update test and example package names, README files and fix some test…
chhagedorn Jun 4, 2021
5c52651
Update whitelist
chhagedorn Jun 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions test/hotspot/jtreg/compiler/lib/ir_framework/AbstractInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/*
* Copyright (c) 2021, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

package compiler.lib.ir_framework;

import compiler.lib.ir_framework.shared.TestRunException;
import compiler.lib.ir_framework.test.TestVM;
import jdk.test.lib.Utils;

import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Random;
import java.util.stream.Collectors;

/**
* Base info class which provides some useful utility methods and information about a test.
* <p>
* <b>Base tests</b> and <b>checked tests</b> use {@link TestInfo} while <b>custom run tests</b> use {@link RunInfo}.
*
* @see Test
* @see Check
* @see Run
*/
abstract public class AbstractInfo {
private static final Random RANDOM = Utils.getRandomInstance();

protected final Class<?> testClass;
private boolean onWarmUp = true;

AbstractInfo(Class<?> testClass) {
this.testClass = testClass;
}

/**
* Get the initialized {@link Random} object.
*
* @return the random object.
*/
public Random getRandom() {
return RANDOM;
}

/**
* Returns a boolean indicating if the framework is currently warming up the associated test.
*
* @return the warm-up status of the associated test.
*
* @see Warmup
*/
public boolean isWarmUp() {
return onWarmUp;
}

/**
* Get the method object of the method {@code name} of class {@code c} with arguments {@code args}.
*
* @param c the class containing the method.
* @param name the name of the method.
* @param args the arguments of the method, leave empty if no arguments.
*
* @return the method object of the requested method.
*/
public Method getMethod(Class<?> c, String name, Class<?>... args) {
try {
return c.getMethod(name, args);
} catch (NoSuchMethodException e) {
String parameters = args == null || args.length == 0 ? "" :
" with arguments [" + Arrays.stream(args).map(Class::getName).collect(Collectors.joining(",")) + "]";
throw new TestRunException("Could not find method " + name + " in " + c + parameters, e);
}
}

/**
* Get the method object of the method {@code name} of the test class with arguments {@code args}.
*
* @param name the name of the method in the test class.
* @param args the arguments of the method, leave empty if no arguments.
*
* @return the method object of the requested method in the test class.
*/
public Method getTestClassMethod(String name, Class<?>... args) {
return getMethod(testClass, name, args);
}

/**
* Returns a boolean indicating if the test VM runs with flags that allow C2 compilations.
*
* @return {@code true} if C2 compilations are allowed;
* {@code false} otherwise (run with {@code -XX:TieredStopAtLevel={1,2,3}, -XX:-UseCompiler}).
*/
public boolean isC2CompilationEnabled() {
return TestVM.USE_COMPILER && !TestVM.TEST_C1;
}

/**
* Called by {@link TestFramework} when the warm-up is finished. Should not be called by user code.
*/
public void setWarmUpFinished() {
onWarmUp = false;
}
}
81 changes: 81 additions & 0 deletions test/hotspot/jtreg/compiler/lib/ir_framework/Argument.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* Copyright (c) 2021, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

package compiler.lib.ir_framework;

/**
* Well-defined argument values that can be used in the {@link Arguments} annotation at a {@link Test} method for a
* <b>base test</b> or a <b>checked test</b>.
*
* @see Arguments
* @see Test
* @see Check
*/
public enum Argument {
/**
* Provides the default value for any kind of primitive type and object type if the class provides a default constructor.
*/
DEFAULT,
/**
* Provides the number 42 for any primitive number type.
*/
NUMBER_42,
/**
* Provides the number -42 for any primitive number type.
*/
NUMBER_MINUS_42,
/**
* Provides the minimum value of the specified primitive number type.
*/
MIN,
/**
* Provides the maximum value of the specified primitive number type.
*/
MAX,
/**
* Provides the boolean value false.
*/
FALSE,
/**
* Provides the boolean value true.
*/
TRUE,
/**
* Provides a different boolean value on each test invocation, starting with false.
*/
BOOLEAN_TOGGLE_FIRST_FALSE,
/**
* Provides a different boolean value on each test invocation, starting with true.
*/
BOOLEAN_TOGGLE_FIRST_TRUE,
/**
* Provides a random primitive value on the first test invocation and reuses the same value for all invocation of the test.
* Float and double values are restricted to the range [-10000,10000].
*/
RANDOM_ONCE,
/**
* Provides a different random primitive value on each test invocation.
* Float and double values are restricted to the range [-10000,10000].
*/
RANDOM_EACH,
}
43 changes: 43 additions & 0 deletions test/hotspot/jtreg/compiler/lib/ir_framework/Arguments.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (c) 2021, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

package compiler.lib.ir_framework;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
* This annotation is used to specify well-defined {@link Argument} values for test methods (specifying {@link Test}) when
* used as part of a <b>base test</b> or <b>checked test</b>.
*
* @see Argument
* @see Test
* @see Check
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface Arguments {
/**
* Get the argument value.
*/
Argument[] value();
}
114 changes: 114 additions & 0 deletions test/hotspot/jtreg/compiler/lib/ir_framework/Check.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/*
* Copyright (c) 2021, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

package compiler.lib.ir_framework;

import compiler.lib.ir_framework.shared.TestFormatException;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
* Annotation for a check method of a <b>checked test</b>.
*
* <p>
* Let {@code t} be a test method specifying the {@link Test @Test} annotation and {@code c} be a check method specifying
* the {@code @Check(test = "t")} annotation. These two methods represent a so-called <i>checked test</i>. The only
* difference to a <i>base test</i> (see {@link Test}) is that the framework will invoke the check method {@code c}
* directly after the invocation of the test method {@code t} which allows to do some additional verification,
* including the return value of {@code t}. The framework does the following, similar as for <i>base tests</i>:
* <ol>
* <li><p>The framework warms {@code t} up by invoking it for a predefined number of iterations (default: 2000)
* or any number specified by an additional {@link Warmup @Warmup} annotation at {@code t} or by using
* {@link TestFramework#setDefaultWarmup(int)} (could also be 0 which skips the warm-up completely which is
* similar to simulating {@code -Xcomp}). After each invocation of {@code t}, the framework also invokes
* {@code c} if the {@code @Check} annotation specifies {@link CheckAt#EACH_INVOCATION} at {@link #when()}.
* More information about the warm-up in general can be found at {@link Warmup}</li>
* <li><p>After the warm-up, the framework compiles {@code t} at the specified compilation level set by
* {@link Test#compLevel()} (default {@link CompLevel#ANY} will pick the highest available level which is
* usually {@link CompLevel#C2}).</li>
* <li><p>The framework invokes {@code t} one more time to run the compilation. Afterwards, the framework will
* always invoke {@code c} again to be able perform additional checks after the compilation of {@code t}.</li>
* <li><p>The framework checks any specified {@link IR @IR} constraints at the test method {@code t}.
* More information about IR matching can be found at {@link IR}.</li>
* </ol>
*
* <p>
* The test method {@code t} has the same properties and follows the same constraints as stated in {@link Test}.
* <p>
* The following additional constraints must be met for the test method {@code t} and check method {@code c}:
* <ul>
* <li><p>{@code c} must specify the method name {@code t} as property in {@code @Check(test = "t")}
* (see {@link #test()}. Specifying a non-{@code @Test} annotated method or a {@code @Test} method that
* has already been used by another {@code @Check} or {@link Run @Run} method results in a {@link TestFormatException}.
* <li><p>{@code c} can specify the following method parameter combinations:
* <ul>
* <li><p>void</li>
* <li><p>One parameter: {@link TestInfo} which provides some information about {@code t} and utility methods.</li>
* <li><p>One parameter: the <i>exact</i> same type as the return value of {@code t}. When {@code c} is
* invoked by the framework, this parameter contains the return value of {@code t}.</li>
* <li><p>1st parameter: {@link TestInfo}; 2nd parameter: the <i>exact</i> same type as the return value of
* {@code t} (see above)</li>
* <li><p> Any other combination will result in a {@link TestFormatException}.
* </ul>
* <li><p>{@code c} is not compiled nor inlined.
* <li><p>{@code c} must be part of the test class. Using {@code @Check} in nested or other classes is not allowed.</li>
* <li><p>{@code c} cannot specify any helper-method-specific compile command annotations
* ({@link ForceCompile @ForceCompile}, {@link DontCompile @DontCompile}, {@link ForceInline @ForceInline},
* {@link DontInline @DontInline}).</li>
* </ul>
*
* <p>
* If no verification is required, use a <i>base test</i> (see {@link Test}). If {@code t} must be invoked with more
* complex or varying arguments and/or the {@code t} must be invoked differently in subsequent invocations, use a
* <i>custom run test</i> (see {@link Run}).
*
* <p>
* Examples on how to write checked tests can be found in {@link jdk.test.lib.hotspot.ir_framework.examples.CheckedTestExample}
* and also as part of the internal testing in the package {@link jdk.test.lib.hotspot.ir_framework.tests}.
*
* @see Test
* @see TestInfo
* @see CheckAt
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface Check {
/**
* The unique associated {@link Test} method for this {@code @Check} annotated check method. The framework will directly
* invoke the {@code @Check} method after each invocation or only after the compilation of the associated {@code @Test}
* method (depending on the value set with {@link #when()}).
* <p>
* If a non-{@code @Test} annotated method or a {@code @Test} method that has already been used by another
* {@code @Check} or {@link Run} method is specified, then a {@link TestFormatException} is thrown.
*
* @see Test
*/
String test();
/**
* When should the {@code @Check} method be invoked? By default, the check is done after each invocation which is
* encouraged if performance is not critical.
*
* @see CheckAt
*/
CheckAt when() default CheckAt.EACH_INVOCATION;
}
Loading