Skip to content
Closed
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2025, 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
Expand Down Expand Up @@ -34,18 +34,18 @@
* @summary Test that CompileThreshold flag is ignored when passed as Java/VM option to the framework.
* Normally, the framework should be called with driver.
* @library /test/lib /testlibrary_tests /
* @run main/othervm -XX:CompileThreshold=12 -XX:+UseG1GC ir_framework.tests.TestCompileThreshold
* @run main/othervm -XX:CompileThreshold=3000 -XX:+UseG1GC ir_framework.tests.TestCompileThreshold
*/

public class TestCompileThreshold {
public int iFld = 0;

public static void main(String[] args) throws Exception {
try {
// CompileThreshold=12 passed to the JTreg test is ignored even though we prefer command line flags.
// CompileThreshold=10 is user defined and passed directly to the framework and thus not ignored.
// InterpreterProfilePercentage=0 ensures that we compile exactly after 10 invocations.
TestFramework.runWithFlags("-XX:CompileThreshold=10", "-XX:InterpreterProfilePercentage=0",
// CompileThreshold=3000 passed to the JTreg test is ignored even though we prefer command line flags.
// CompileThreshold=2000 is user defined and passed directly to the framework and thus not ignored.
// InterpreterProfilePercentage=0 ensures that we compile exactly after 2000 invocations.
TestFramework.runWithFlags("-XX:CompileThreshold=2000", "-XX:InterpreterProfilePercentage=0",
"-XX:-TieredCompilation", "-DTest=testWithCompileThreshold",
"-DPreferCommandLineFlags=true");
} catch (IRViolationException e) {
Expand All @@ -71,12 +71,12 @@ public void testWithCompileThreshold() {
}

@Run(test = "testWithCompileThreshold")
@Warmup(20)
@Warmup(2010)
public void runTestWithCompileThreshold(RunInfo info) {
if (iFld == 10) {
if (iFld == 2000) {
TestFramework.assertNotCompiled(info.getTest());
} else if (iFld == 11) {
// CompileThreshold=10 is passed directly as a flag to the framework.
} else if (iFld == 2001) {
// CompileThreshold=2000 is passed directly as a flag to the framework.
// Therefore, testWithCompileThreshold() must be compiled by now.
TestFramework.assertCompiled(info.getTest());
}
Expand All @@ -91,12 +91,12 @@ public void testWithoutCompileThreshold() {
}

@Run(test = "testWithoutCompileThreshold")
@Warmup(20)
@Warmup(2010)
public void runTestWithoutCompileThreshold(RunInfo info) {
testWithCompileThreshold();
if (info.isWarmUp()) {
// CompileThreshold=12 is passed to the JTreg test but not directly to the framework.
// Therefore, it is ignored and we do not trigger a compilation until the framework does.
// CompileThreshold=3000 is passed to the JTreg test but not directly to the framework.
// Therefore, it is ignored, and we do not trigger a compilation until the framework does.
TestFramework.assertNotCompiled(info.getTest());
}
}
Expand Down