Skip to content

Commit

Permalink
8314838: 3 compiler tests ignore vm flags
Browse files Browse the repository at this point in the history
Backport-of: ab6a87e6705ef7d431ac2955e8501426344a4e1c
  • Loading branch information
GoeLin committed Dec 19, 2023
1 parent fc49ca3 commit a75b88d
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

1 comment on commit a75b88d

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.