Skip to content

Commit

Permalink
8314838: 3 compiler tests ignore vm flags
Browse files Browse the repository at this point in the history
Reviewed-by: eastigeevich, kvn, lmesnik
  • Loading branch information
Evgeny Nikitin authored and Evgeny Astigeevich committed Sep 8, 2023
1 parent b3dfc39 commit ab6a87e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2023, 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 @@ -54,7 +54,7 @@ public static void main(String[] args) throws Exception {
w.flush();
w.close();

ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
ProcessBuilder pb = ProcessTools.createTestJvm(
"-XX:+UnlockDiagnosticVMOptions",
"-Xmx100M",
"-XX:+ReplayCompiles", "-XX:ReplayDataFile=./bogus-replay-file.txt");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public static void main(String[] args) {
}

public static void main(String[] args) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
ProcessBuilder pb = ProcessTools.createTestJvm(
"--enable-preview", "--add-modules", "jdk.incubator.vector",
"-Xbatch", "-XX:+TraceLoopPredicate", Launcher.class.getName());
OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
Expand Down
30 changes: 15 additions & 15 deletions test/hotspot/jtreg/compiler/sharedstubs/SharedStubToInterpTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,21 @@
*/

/**
* @test SharedStubToInterpTest
* @summary Checks that stubs to the interpreter can be shared for static or final method.
* @test id=C1
* @bug 8280481
* @summary Checks that stubs to the interpreter can be shared for static or final method.
* @library /test/lib
* @requires vm.opt.TieredStopAtLevel == null & vm.opt.TieredCompilation == null
* @requires vm.simpleArch == "x86" | vm.simpleArch == "x64" | vm.simpleArch == "aarch64" | vm.simpleArch == "riscv64"
* @requires vm.debug
* @run driver compiler.sharedstubs.SharedStubToInterpTest -XX:TieredStopAtLevel=1
*
* @requires os.arch=="amd64" | os.arch=="x86_64" | os.arch=="i386" | os.arch=="x86" | os.arch=="aarch64" | os.arch=="riscv64"
* @test id=C2
* @requires vm.opt.TieredStopAtLevel == null & vm.opt.TieredCompilation == null
* @requires vm.simpleArch == "x86" | vm.simpleArch == "x64" | vm.simpleArch == "aarch64" | vm.simpleArch == "riscv64"
* @requires vm.debug
* @run driver compiler.sharedstubs.SharedStubToInterpTest -XX:-TieredCompilation
*
* @run driver compiler.sharedstubs.SharedStubToInterpTest
*/

package compiler.sharedstubs;
Expand All @@ -45,10 +51,9 @@
public class SharedStubToInterpTest {
private final static int ITERATIONS_TO_HEAT_LOOP = 20_000;

private static void runTest(String compiler, String test) throws Exception {
private static void runTest(String test) throws Exception {
String testClassName = SharedStubToInterpTest.class.getName() + "$" + test;
ArrayList<String> command = new ArrayList<String>();
command.add(compiler);
command.add("-XX:+UnlockDiagnosticVMOptions");
command.add("-Xbatch");
command.add("-XX:+PrintRelocations");
Expand All @@ -61,7 +66,7 @@ private static void runTest(String compiler, String test) throws Exception {
command.add("-XX:CompileCommand=dontinline," + testClassName + "::" + "log02");
command.add(testClassName);

ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(command);
ProcessBuilder pb = ProcessTools.createTestJvm(command);

OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());

Expand All @@ -73,14 +78,9 @@ private static void runTest(String compiler, String test) throws Exception {
}

public static void main(String[] args) throws Exception {
List<String> compilers = java.util.Arrays.asList("-XX:-TieredCompilation" /* C2 */,
"-XX:TieredStopAtLevel=1" /* C1 */);
List<String> tests = java.util.Arrays.asList("StaticMethodTest",
"FinalClassTest", "FinalMethodTest");
for (String compiler : compilers) {
for (String test : tests) {
runTest(compiler, test);
}
String[] methods = new String[] { "StaticMethodTest", "FinalClassTest", "FinalMethodTest"};
for (String methodName : methods) {
runTest(methodName);
}
}

Expand Down
21 changes: 8 additions & 13 deletions test/hotspot/jtreg/compiler/sharedstubs/SharedTrampolineTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,32 @@
*/

/**
* @test SharedTrampolineTest
* @test SharedTrampolineTest id=C2
* @summary Checks that trampolines can be shared for static method.
* @bug 8280152
* @library /test/lib
*
* @requires vm.opt.TieredCompilation == null
* @requires os.arch=="aarch64" | os.arch=="riscv64"
* @requires vm.debug
*
* @run driver compiler.sharedstubs.SharedTrampolineTest
* @run driver compiler.sharedstubs.SharedTrampolineTest -XX:-TieredCompilation
*/

package compiler.sharedstubs;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.regex.Pattern;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;

public class SharedTrampolineTest {
private final static int ITERATIONS_TO_HEAT_LOOP = 20_000;

private static void runTest(String compiler, String test) throws Exception {
private static void runTest(String test) throws Exception {
String testClassName = SharedTrampolineTest.class.getName() + "$" + test;
ArrayList<String> command = new ArrayList<String>();
command.add(compiler);
command.add("-XX:+UnlockDiagnosticVMOptions");
command.add("-Xbatch");
command.add("-XX:+PrintRelocations");
Expand All @@ -60,7 +58,7 @@ private static void runTest(String compiler, String test) throws Exception {
command.add(testClassName);
command.add("a");

ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(command);
ProcessBuilder pb = ProcessTools.createTestJvm(command);

OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());

Expand All @@ -72,12 +70,9 @@ private static void runTest(String compiler, String test) throws Exception {
}

public static void main(String[] args) throws Exception {
List<String> compilers = List.of("-XX:-TieredCompilation" /* C2 */);
List<String> tests = List.of("StaticMethodTest");
for (String compiler : compilers) {
for (String test : tests) {
runTest(compiler, test);
}
String[] tests = new String[] {"StaticMethodTest"};
for (String test : tests) {
runTest(test);
}
}

Expand Down

3 comments on commit ab6a87e

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on ab6a87e Dec 15, 2023

Choose a reason for hiding this comment

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

/backport jdk21u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on ab6a87e Dec 15, 2023

Choose a reason for hiding this comment

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

@GoeLin the backport was successfully created on the branch backport-GoeLin-ab6a87e6 in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit ab6a87e6 from the openjdk/jdk repository.

The commit being backported was authored by Evgeny Nikitin on 8 Sep 2023 and was reviewed by Evgeny Astigeevich, Vladimir Kozlov and Leonid Mesnik.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev:

$ git fetch https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-ab6a87e6:backport-GoeLin-ab6a87e6
$ git checkout backport-GoeLin-ab6a87e6
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-ab6a87e6

Please sign in to comment.