Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions test/hotspot/jtreg/ProblemList-Xcomp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,4 @@ vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/TestDescription.java 829

vmTestbase/nsk/stress/thread/thread006.java 8321476 linux-all

compiler/cha/TypeProfileFinalMethod.java 8341039 generic-all

gc/arguments/TestNewSizeFlags.java 8299116 macosx-aarch64
33 changes: 17 additions & 16 deletions test/hotspot/jtreg/compiler/cha/TypeProfileFinalMethod.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, Alibaba Group Holding Limited. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand All @@ -25,7 +25,7 @@
/*
* @test
* @summary test c1 to record type profile with CHA optimization
* @requires vm.flavor == "server" & (vm.opt.TieredStopAtLevel == null | vm.opt.TieredStopAtLevel == 4)
* @requires vm.flavor == "server" & vm.flagless
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this change is part of the "Make the test flagless" part (and TieredStopAtLevel filters seem anyway a bit odd) but did you figure out why this was added first? Was it possibly just a mistake (since we create a new process anyway)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review @dafedafe!

I guess this change is part of the "Make the test flagless" part (and TieredStopAtLevel filters seem anyway a bit odd) but did you figure out why this was added first?

I would guess the conditions for TieredStopAtLevel were added to ensure this particular flag could not break the test. However, there are many other flags that can also break the test. Hence, we need flagless (which subsumes the TieredStopAtLevel conditions).

Was it possibly just a mistake (since we create a new process anyway)?

The createTestJavaProcessBuilder method adds the default jvm options from jtreg, test.vm.opts and test.java.opts (see the source code comment for createTestJavaProcessBuilder). So no, not a mistake, but also not a complete safeguard.

* @library /test/lib
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
Expand All @@ -48,6 +48,7 @@ public static void main(String[] args) throws Exception {
"-Xbatch", "-XX:-UseOnStackReplacement",
"-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI",
"-XX:Tier3InvocationThreshold=200", "-XX:Tier4InvocationThreshold=5000",
"-XX:CompileCommand=CompileOnly," + Launcher.class.getName() + "::test*",
Launcher.class.getName());
OutputAnalyzer output = ProcessTools.executeProcess(pb);
System.out.println("debug output");
Expand All @@ -61,7 +62,7 @@ public static void main(String[] args) throws Exception {
while (matcher.find()) {
matchCnt++;
}
Asserts.assertEquals(matchCnt, 2); // inline Child1::m() twice
Asserts.assertEquals(2, matchCnt); // inline Child1::m() twice
}

static class Launcher {
Expand All @@ -86,23 +87,23 @@ public static void main(String[] args) throws Exception {

static void addCompilerDirectives() {
WhiteBox WB = WhiteBox.getWhiteBox();
// do not inline getInstance() for test1() and test2()
// Directive for test1
String directive = "[{ match: [\"" + Launcher.class.getName() + "::test1\"]," +
"inline:[\"-" + Launcher.class.getName()+"::getInstance()\"] }]";
// Do not inline getInstance
"inline:[\"-" + Launcher.class.getName()+"::getInstance\"] }]";
WB.addCompilerDirective(directive);

// Directive for test2
directive = "[{ match: [\"" + Launcher.class.getName() + "::test2\"]," +
"inline:[\"-" + Launcher.class.getName()+"::getInstance()\"] }]";
WB.addCompilerDirective(directive);

// do not inline test1() for test2() in c1 compilation
directive = "[{ match: [\"" + Launcher.class.getName() + "::test2\"]," +
"c1: { inline:[\"-" + Launcher.class.getName()+"::test1()\"] } }]";
WB.addCompilerDirective(directive);

// print inline tree for checking
directive = "[{ match: [\"" + Launcher.class.getName() + "::test2\"]," +
"c2: { PrintInlining: true } }]";
// Do not inline getInstance
"inline:[\"-" + Launcher.class.getName()+"::getInstance\"]," +
// Do not inline test1 in C1 compilation
"c1: { inline:[\"-" + Launcher.class.getName()+"::test1\"] }," +
// Make sure to inline test1 in C2 compilation
"c2: { inline:[\"+" + Launcher.class.getName()+"::test1\"]," +
// Print the inline tree for checking
" PrintInlining:true }" +
"}]";
WB.addCompilerDirective(directive);
}

Expand Down