Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/jdk17u
Path: blob/master/test/hotspot/jtreg/compiler/lib/ir_framework/Test.java
64507 views
1
/*
2
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
package compiler.lib.ir_framework;
25
26
import java.lang.annotation.Retention;
27
import java.lang.annotation.RetentionPolicy;
28
29
/**
30
* Annotate all methods in your test class which the framework should test with {@code @Test}.
31
* <p>
32
* Let {@code m} be a test method specifying the {@code @Test} annotation. If {@code m} is neither part of a
33
* <b>checked test</b> (an additional method specifying {@link Check @Check} with {@code @Check(test = "m")}) nor part
34
* of a <b>custom run test</b> (an additional method specifying {@link Run @Run} with {@code @Run(test = "m")}),
35
* then {@code m} is a so-called <b>base test</b> and the the framework invokes {@code m} in the following way:
36
* <ol>
37
* <li><p>The framework warms {@code m} up by invoking it for a predefined number of iterations (default: 2000)
38
* or any number specified by an additional {@link Warmup @Warmup} annotation at {@code m} or by using
39
* {@link TestFramework#setDefaultWarmup(int)} (could also be 0 which skips the warm-up completely which is similar
40
* to simulating {@code -Xcomp}). More information about the warm-up in general can be found at {@link Warmup}</li>
41
* <li><p>After the warm-up, the framework compiles {@code m} at the specified compilation level set by
42
* {@link #compLevel()} (default {@link CompLevel#ANY} will pick the highest available level which is usually
43
* {@link CompLevel#C2}).</li>
44
* <li><p>The framework invokes {@code m} one more time to run the compilation.</li>
45
* <li><p>The framework checks any specified {@link IR @IR} constraints at {@code m}. More information about IR matching
46
* can be found at {@link IR}.</li>
47
* </ol>
48
*
49
* <p>
50
* {@code m} has the following properties:
51
* <ul>
52
* <li><p>If {@code m} specifies no parameters, the framework can directly invoke {@code m}.</li>
53
* <li><p>If {@code m} specifies parameters, the framework needs to know how to invoke {@code m}. Use {@link Arguments}
54
* with {@link Argument} properties for each parameter to use well-defined parameters by the framework. If the method
55
* requires a more specific argument value, use a custom run test (see {@link Run}).</li>
56
* <li><p>{@code m} cannot specify {@link AbstractInfo} or any of its subclasses as parameter or return type.</li>
57
* <li><p>{@code m} is not inlined by the framework.</li>
58
* <li><p>Verification of the return value of {@code m} can only be done in a checked test (see {@link Check}) or
59
* custom run test (see {@link Run}).</li>
60
* </ul>
61
*
62
* <p>
63
* The following constraints must be met for the test method {@code m} specifying {@code @Test}:
64
* <ul>
65
* <li><p>{@code m} must be part of the test class. Using {@code @Test} in nested or helper classes is not allowed.</li>
66
* <li><p>{@code m} cannot have the same name as another {@code @Test} method in the same test class. Method
67
* overloading is only allowed (but not encouraged) with other non-{@code @Test} methods.</li>
68
* <li><p>{@code m} cannot specify any helper-method-specific compile command annotations
69
* ({@link ForceCompile @ForceCompile}, {@link DontCompile @DontCompile}, {@link ForceInline @ForceInline},
70
* {@link DontInline @DontInline}). </li>
71
* </ul>
72
*
73
* <p>
74
* Examples on how to write base tests can be found in {@link ir_framework.examples.BaseTestExample}
75
* and also as part of the internal testing in the package {@link ir_framework.tests}.
76
*
77
* @see Arguments
78
*/
79
@Retention(RetentionPolicy.RUNTIME)
80
public @interface Test {
81
/**
82
* Specify at which compilation level the framework should eventually compile the test method after an optional
83
* warm-up period. The default {@link CompLevel#ANY} will let the framework compile the method at the highest
84
* available level which is usually {@link CompLevel#C2}.
85
*/
86
CompLevel compLevel() default CompLevel.ANY;
87
}
88
89