mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8139384: [TESTBUG] JVMCI test fails with java.lang.RuntimeException: a 100_000 times invoked method should be mature
A test was redesigned to track xcomp and tiered states Reviewed-by: twisti
This commit is contained in:
parent
5e051287af
commit
ad8dfcdf38
1 changed files with 20 additions and 16 deletions
|
@ -35,9 +35,11 @@
|
||||||
* -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
|
* -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
|
||||||
* compiler.jvmci.compilerToVM.IsMatureTest
|
* compiler.jvmci.compilerToVM.IsMatureTest
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package compiler.jvmci.compilerToVM;
|
package compiler.jvmci.compilerToVM;
|
||||||
|
|
||||||
import compiler.jvmci.common.testcases.SimpleClass;
|
import compiler.jvmci.common.testcases.SimpleClass;
|
||||||
|
import compiler.whitebox.CompilerWhiteBoxTest;
|
||||||
import jdk.vm.ci.hotspot.CompilerToVMHelper;
|
import jdk.vm.ci.hotspot.CompilerToVMHelper;
|
||||||
import jdk.test.lib.Asserts;
|
import jdk.test.lib.Asserts;
|
||||||
import sun.hotspot.WhiteBox;
|
import sun.hotspot.WhiteBox;
|
||||||
|
@ -46,6 +48,10 @@ import java.lang.reflect.Executable;
|
||||||
|
|
||||||
public class IsMatureTest {
|
public class IsMatureTest {
|
||||||
private static final WhiteBox WB = WhiteBox.getWhiteBox();
|
private static final WhiteBox WB = WhiteBox.getWhiteBox();
|
||||||
|
private static final boolean IS_XCOMP
|
||||||
|
= System.getProperty("java.vm.info").contains("compiled mode");
|
||||||
|
private static final boolean TIERED
|
||||||
|
= WB.getBooleanVMFlag("TieredCompilation");
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
new IsMatureTest().test();
|
new IsMatureTest().test();
|
||||||
|
@ -54,23 +60,21 @@ public class IsMatureTest {
|
||||||
public void test() throws Exception {
|
public void test() throws Exception {
|
||||||
SimpleClass sclass = new SimpleClass();
|
SimpleClass sclass = new SimpleClass();
|
||||||
Executable method = SimpleClass.class.getDeclaredMethod("testMethod");
|
Executable method = SimpleClass.class.getDeclaredMethod("testMethod");
|
||||||
long metaspaceMethodData = WB.getMethodData(method);
|
long methodData = WB.getMethodData(method);
|
||||||
Asserts.assertEQ(metaspaceMethodData, 0L, "MDO should be null for "
|
boolean isMature = CompilerToVMHelper.isMature(methodData);
|
||||||
+ "never invoked method");
|
Asserts.assertEQ(methodData, 0L,
|
||||||
boolean isMature = CompilerToVMHelper.isMature(metaspaceMethodData);
|
"Never invoked method can't have method data");
|
||||||
Asserts.assertFalse(isMature, "null MDO can't be mature");
|
Asserts.assertFalse(isMature, "Never invoked method can't be mature");
|
||||||
for (int i = 0; i < 1000; i++) {
|
for (int i = 0; i < CompilerWhiteBoxTest.THRESHOLD; i++) {
|
||||||
sclass.testMethod();
|
sclass.testMethod();
|
||||||
}
|
}
|
||||||
// warmed up, mdo should be ready for now
|
methodData = WB.getMethodData(method);
|
||||||
metaspaceMethodData = WB.getMethodData(method);
|
isMature = CompilerToVMHelper.isMature(methodData);
|
||||||
Asserts.assertNE(metaspaceMethodData, 0L,
|
Asserts.assertNE(methodData, 0L,
|
||||||
"MDO should be available after 1000 calls");
|
"Multiple times invoked method should have method data");
|
||||||
for (int i = 0; i < 100_000; i++) {
|
/* a method is not mature for -Xcomp and -Tiered,
|
||||||
sclass.testMethod();
|
see NonTieredCompPolicy::is_mature */
|
||||||
}
|
Asserts.assertEQ(isMature, !(IS_XCOMP && !TIERED),
|
||||||
isMature = CompilerToVMHelper.isMature(metaspaceMethodData);
|
"Unexpected isMature state for multiple times invoked method");
|
||||||
Asserts.assertTrue(isMature,
|
|
||||||
"a 100_000 times invoked method should be mature");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue