mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-19 10:34:38 +02:00
8264805: Remove the experimental Ahead-of-Time Compiler
Reviewed-by: coleenp, erikj, stefank, iignatyev, dholmes, aph, shade, iklam, mchung, iveresov
This commit is contained in:
parent
15d4787724
commit
694acedf18
378 changed files with 200 additions and 26970 deletions
|
@ -1,280 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2020, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package compiler.aot;
|
||||
|
||||
import jdk.test.lib.Platform;
|
||||
import jdk.test.lib.artifacts.Artifact;
|
||||
import jdk.test.lib.artifacts.ArtifactResolver;
|
||||
import jdk.test.lib.artifacts.ArtifactResolverException;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import jdk.test.lib.JDKToolLauncher;
|
||||
import jdk.test.lib.Utils;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
/**
|
||||
* A simple class calling AOT compiler over requested items
|
||||
*/
|
||||
public class AotCompiler {
|
||||
|
||||
private final static String METHODS_LIST_FILENAME = "methodsList.txt";
|
||||
|
||||
public static void main(String args[]) {
|
||||
String className = null;
|
||||
List<String> compileList = new ArrayList<>();
|
||||
String libName = null;
|
||||
List<String> extraopts = new ArrayList<>();
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
switch (args[i]) {
|
||||
case "-class":
|
||||
className = args[++i];
|
||||
break;
|
||||
case "-compile":
|
||||
compileList.add("compileOnly " + args[++i]);
|
||||
break;
|
||||
case "-libname":
|
||||
libName = args[++i];
|
||||
break;
|
||||
case "-extraopt":
|
||||
extraopts.add(args[++i]);
|
||||
break;
|
||||
default:
|
||||
throw new Error("Unknown option: " + args[i]);
|
||||
}
|
||||
}
|
||||
extraopts.add("-classpath");
|
||||
extraopts.add(Utils.TEST_CLASS_PATH + File.pathSeparator + Utils.TEST_SRC);
|
||||
if (className != null && libName != null) {
|
||||
OutputAnalyzer oa = launchCompiler(libName, className, extraopts, compileList);
|
||||
oa.shouldHaveExitValue(0);
|
||||
} else {
|
||||
printUsage();
|
||||
throw new Error("Mandatory arguments aren't passed");
|
||||
}
|
||||
}
|
||||
|
||||
public static OutputAnalyzer launchCompilerSimple(String... args) {
|
||||
return launchJaotc(Arrays.asList(args), null);
|
||||
}
|
||||
|
||||
public static OutputAnalyzer launchCompiler(String libName, String item, List<String> extraopts,
|
||||
List<String> compList) {
|
||||
Path file = null;
|
||||
if (compList != null && !compList.isEmpty()) {
|
||||
file = Paths.get(METHODS_LIST_FILENAME);
|
||||
try {
|
||||
Files.write(file, compList, StandardOpenOption.CREATE);
|
||||
} catch (IOException e) {
|
||||
throw new Error("Couldn't write " + METHODS_LIST_FILENAME + " " + e, e);
|
||||
}
|
||||
}
|
||||
List<String> args = new ArrayList<>();
|
||||
args.add("--compile-with-assertions");
|
||||
args.add("--info");
|
||||
args.add("--output");
|
||||
args.add(libName);
|
||||
if (file != null) {
|
||||
args.add("--compile-commands");
|
||||
args.add(file.toString());
|
||||
}
|
||||
args.add("--class-name");
|
||||
args.add(item);
|
||||
String linker = resolveLinker();
|
||||
if (linker != null) {
|
||||
args.add("--linker-path");
|
||||
args.add(linker);
|
||||
}
|
||||
// Execute with asserts
|
||||
args.add("-J-ea");
|
||||
args.add("-J-esa");
|
||||
// we don't want to run jaotc w/ Xcomp even if it's in extraopts
|
||||
args.add("-J-Xmixed");
|
||||
return launchJaotc(args, extraopts);
|
||||
}
|
||||
|
||||
private static OutputAnalyzer launchJaotc(List<String> args, List<String> extraVmOpts) {
|
||||
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jaotc");
|
||||
for (String vmOpt : Utils.getTestJavaOpts()) {
|
||||
launcher.addVMArg(vmOpt);
|
||||
}
|
||||
if (extraVmOpts != null) {
|
||||
for (String vmOpt : extraVmOpts) {
|
||||
launcher.addVMArg(vmOpt);
|
||||
}
|
||||
}
|
||||
for (String arg : args) {
|
||||
launcher.addToolArg(arg);
|
||||
}
|
||||
try {
|
||||
return ProcessTools.executeCommand(new ProcessBuilder(launcher.getCommand()).redirectErrorStream(true));
|
||||
} catch (Throwable e) {
|
||||
throw new Error("Can't start test process: " + e, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void printUsage() {
|
||||
System.err.println("Usage: " + AotCompiler.class.getName()
|
||||
+ " -class <class> -libname <.so name>"
|
||||
+ " [-compile <compileItems>]* [-extraopt <java option>]*");
|
||||
}
|
||||
|
||||
// runs ld -v and check its exit code
|
||||
private static boolean checkLd(Path bin) {
|
||||
try {
|
||||
return 0 == ProcessTools.executeCommand(bin.toString(), "-v")
|
||||
.getExitValue();
|
||||
} catch (Throwable t) {
|
||||
// any errors mean ld doesn't work
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static String resolveLinker() {
|
||||
Path linker = null;
|
||||
// if non windows, 1st, check if PATH has ld
|
||||
if (!Platform.isWindows()) {
|
||||
String bin = "ld";
|
||||
for (String path : System.getenv("PATH").split(File.pathSeparator)) {
|
||||
Path ld = Paths.get(path).resolve("ld");
|
||||
if (Files.exists(ld)) {
|
||||
// there is ld in PATH
|
||||
if (checkLd(ld)) {
|
||||
System.out.println("found working linker: " + ld);
|
||||
// ld works, jaotc is supposed to find and use it
|
||||
return null;
|
||||
} else {
|
||||
System.out.println("found broken linker: " + ld);
|
||||
// ld exists in PATH, but doesn't work, have to use devkit
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// there is no ld in PATH, will use ld from devkit
|
||||
// artifacts are got from common/conf/jib-profiles.js
|
||||
try {
|
||||
if (Platform.isWindows()) {
|
||||
if (Platform.isX64()) {
|
||||
@Artifact(organization = "jpg.infra.builddeps",
|
||||
name = "devkit-windows_x64",
|
||||
revision = "VS2017-15.5.5+1.0",
|
||||
extension = "tar.gz")
|
||||
class DevkitWindowsX64 { }
|
||||
String artifactName = "jpg.infra.builddeps."
|
||||
+ "devkit-windows_x64-"
|
||||
+ "VS2017-15.5.5+1.0";
|
||||
Path devkit = ArtifactResolver.resolve(DevkitWindowsX64.class)
|
||||
.get(artifactName);
|
||||
linker = devkit.resolve("VC")
|
||||
.resolve("bin")
|
||||
.resolve("x64")
|
||||
.resolve("link.exe");
|
||||
}
|
||||
} else if (Platform.isOSX()) {
|
||||
@Artifact(organization = "jpg.infra.builddeps",
|
||||
name = "devkit-macosx_x64",
|
||||
revision = "Xcode6.3-MacOSX10.9+1.0",
|
||||
extension = "tar.gz")
|
||||
class DevkitMacosx { }
|
||||
String artifactName = "jpg.infra.builddeps."
|
||||
+ "devkit-macosx_x64-"
|
||||
+ "Xcode6.3-MacOSX10.9+1.0";
|
||||
Path devkit = ArtifactResolver.resolve(DevkitMacosx.class)
|
||||
.get(artifactName);
|
||||
linker = devkit.resolve("Xcode.app")
|
||||
.resolve("Contents")
|
||||
.resolve("Developer")
|
||||
.resolve("Toolchains")
|
||||
.resolve("XcodeDefault.xctoolchain")
|
||||
.resolve("usr")
|
||||
.resolve("bin")
|
||||
.resolve("ld");
|
||||
} else if (Platform.isLinux()) {
|
||||
if (Platform.isAArch64()) {
|
||||
@Artifact(organization = "jpg.infra.builddeps",
|
||||
name = "devkit-linux_aarch64",
|
||||
revision = "gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux+1.0",
|
||||
extension = "tar.gz")
|
||||
class DevkitLinuxAArch64 { }
|
||||
|
||||
String artifactName = "jpg.infra.builddeps."
|
||||
+ "devkit-linux_aarch64-"
|
||||
+ "gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux+1.0";
|
||||
Path devkit = ArtifactResolver.resolve(DevkitLinuxAArch64.class)
|
||||
.get(artifactName);
|
||||
linker = devkit.resolve("aarch64-linux-gnu")
|
||||
.resolve("bin")
|
||||
.resolve("ld");
|
||||
} else if (Platform.isARM()) {
|
||||
@Artifact(organization = "jpg.infra.builddeps",
|
||||
name = "devkit-linux_arm",
|
||||
revision = "gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux+1.0",
|
||||
extension = "tar.gz")
|
||||
class DevkitLinuxARM { }
|
||||
|
||||
String artifactName = "jpg.infra.builddeps."
|
||||
+ "devkit-linux_arm-"
|
||||
+ "gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux+1.0";
|
||||
Path devkit = ArtifactResolver.resolve(DevkitLinuxARM.class)
|
||||
.get(artifactName);
|
||||
linker = devkit.resolve("arm-linux-gnueabihf")
|
||||
.resolve("bin")
|
||||
.resolve("ld");
|
||||
} else if (Platform.isX64()) {
|
||||
@Artifact(organization = "jpg.infra.builddeps",
|
||||
name = "devkit-linux_x64",
|
||||
revision = "gcc7.3.0-OEL6.4+1.0",
|
||||
extension = "tar.gz")
|
||||
class DevkitLinuxX64 { }
|
||||
|
||||
String artifactName = "jpg.infra.builddeps."
|
||||
+ "devkit-linux_x64-"
|
||||
+ "gcc7.3.0-OEL6.4+1.0";
|
||||
Path devkit = ArtifactResolver.resolve(DevkitLinuxX64.class)
|
||||
.get(artifactName);
|
||||
linker = devkit.resolve("bin")
|
||||
.resolve("ld");
|
||||
}
|
||||
}
|
||||
} catch (ArtifactResolverException e) {
|
||||
System.err.println("artifact resolution error: " + e);
|
||||
e.printStackTrace(System.err);
|
||||
// let jaotc try to find linker
|
||||
return null;
|
||||
}
|
||||
if (linker != null) {
|
||||
return linker.toAbsolutePath().toString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.aot.DeoptimizationTest
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname libDeoptimizationTest.so
|
||||
* -class compiler.aot.DeoptimizationTest
|
||||
* -compile compiler.aot.DeoptimizationTest.testMethod()D
|
||||
* -extraopt -XX:-UseCompressedOops
|
||||
* @run main/othervm -Xmixed -XX:+UnlockExperimentalVMOptions -XX:+UseAOT -XX:+TieredCompilation
|
||||
* -XX:-UseCompressedOops
|
||||
* -XX:CompileCommand=dontinline,compiler.aot.DeoptimizationTest::*
|
||||
* -XX:AOTLibrary=./libDeoptimizationTest.so -Xbootclasspath/a:.
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
|
||||
* compiler.aot.DeoptimizationTest
|
||||
* @summary check if aot code can be deoptimized
|
||||
*/
|
||||
|
||||
package compiler.aot;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.Utils;
|
||||
import sun.hotspot.WhiteBox;
|
||||
import compiler.whitebox.CompilerWhiteBoxTest;
|
||||
|
||||
public final class DeoptimizationTest {
|
||||
private static final String TEST_METHOD = "testMethod";
|
||||
private static final WhiteBox WB = WhiteBox.getWhiteBox();
|
||||
private final Method testMethod;
|
||||
|
||||
private DeoptimizationTest() {
|
||||
try {
|
||||
testMethod = getClass().getDeclaredMethod(TEST_METHOD);
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw new Error("TEST BUG: no test method found", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
new DeoptimizationTest().test();
|
||||
}
|
||||
|
||||
private double testMethod() {
|
||||
return 42 / 0;
|
||||
}
|
||||
|
||||
private void test() {
|
||||
Asserts.assertTrue(WB.isMethodCompiled(testMethod),
|
||||
"Method expected to be compiled");
|
||||
Asserts.assertEQ(WB.getMethodCompilationLevel(testMethod),
|
||||
CompilerWhiteBoxTest.COMP_LEVEL_AOT,
|
||||
"Unexpected compilation level at start");
|
||||
Utils.runAndCheckException(() -> testMethod(), ArithmeticException.class);
|
||||
Asserts.assertFalse(WB.isMethodCompiled(testMethod),
|
||||
"Method is unexpectedly compiled after deoptimization");
|
||||
Asserts.assertEQ(WB.getMethodCompilationLevel(testMethod), 0,
|
||||
"Unexpected compilation level after deoptimization");
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package compiler.aot;
|
||||
|
||||
public class HelloWorldPrinter {
|
||||
public static final String MESSAGE = "Hello world";
|
||||
public static final String CLINIT_MESSAGE = "Hello <clinit> world";
|
||||
|
||||
static {
|
||||
System.out.println(CLINIT_MESSAGE);
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
print();
|
||||
}
|
||||
|
||||
public static void print() {
|
||||
System.out.println(MESSAGE);
|
||||
}
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.aot.RecompilationTest
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname libRecompilationTest1.so
|
||||
* -class compiler.whitebox.SimpleTestCaseHelper
|
||||
* -extraopt -Dgraal.TieredAOT=true -extraopt -Dgraal.ProfileSimpleMethods=true
|
||||
* -extraopt -Dgraal.ProbabilisticProfiling=false
|
||||
* -extraopt -XX:+UnlockDiagnosticVMOptions -extraopt -XX:+WhiteBoxAPI -extraopt -Xbootclasspath/a:.
|
||||
* -extraopt -XX:-UseCompressedOops
|
||||
* -extraopt -XX:CompileCommand=dontinline,compiler.whitebox.SimpleTestCaseHelper::*
|
||||
* @run driver compiler.aot.AotCompiler -libname libRecompilationTest2.so
|
||||
* -class compiler.whitebox.SimpleTestCaseHelper
|
||||
* -extraopt -Dgraal.TieredAOT=false
|
||||
* -extraopt -XX:+UnlockDiagnosticVMOptions -extraopt -XX:+WhiteBoxAPI -extraopt -Xbootclasspath/a:.
|
||||
* -extraopt -XX:-UseCompressedOops
|
||||
* -extraopt -XX:CompileCommand=dontinline,compiler.whitebox.SimpleTestCaseHelper::*
|
||||
* @run main/othervm -Xmixed -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT -XX:-TieredCompilation
|
||||
* -XX:-UseCounterDecay -XX:-UseCompressedOops
|
||||
* -XX:-Inline
|
||||
* -XX:AOTLibrary=./libRecompilationTest2.so -Xbootclasspath/a:.
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
|
||||
* -Dcompiler.aot.RecompilationTest.check_level=-1
|
||||
* compiler.aot.RecompilationTest
|
||||
* @summary check if recompilation after aot goes fine
|
||||
*/
|
||||
|
||||
/* having whitebox-related options for aot compiler is a temporary solution,
|
||||
because of JDK-8146201
|
||||
*/
|
||||
|
||||
package compiler.aot;
|
||||
|
||||
import compiler.whitebox.CompilerWhiteBoxTest;
|
||||
import java.lang.reflect.Executable;
|
||||
import jdk.test.lib.Asserts;
|
||||
|
||||
public final class RecompilationTest extends CompilerWhiteBoxTest {
|
||||
private static final int CHECK_LEVEL = Integer.getInteger(
|
||||
"compiler.aot.RecompilationTest.check_level");
|
||||
|
||||
public static void main(String args[]) {
|
||||
CompilerWhiteBoxTest.main(RecompilationTest::new, args);
|
||||
}
|
||||
|
||||
private RecompilationTest(TestCase testCase) {
|
||||
super(testCase);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void test() throws Exception {
|
||||
if (testCase.isOsr()) {
|
||||
/* aot compiler is not using osr compilation */
|
||||
System.out.println("Skipping OSR case");
|
||||
return;
|
||||
}
|
||||
Executable e = testCase.getExecutable();
|
||||
Asserts.assertTrue(WHITE_BOX.isMethodCompiled(e),
|
||||
testCase.name() + ": an executable expected to be compiled");
|
||||
Asserts.assertEQ(WHITE_BOX.getMethodCompilationLevel(e),
|
||||
COMP_LEVEL_AOT,
|
||||
String.format("%s: unexpected compilation level at start",
|
||||
testCase.name()));
|
||||
compile();
|
||||
Asserts.assertTrue(WHITE_BOX.isMethodCompiled(e), testCase.name()
|
||||
+ ": method expected to be compiled");
|
||||
/* a case with AOT'ed code checks exact compilation level equality
|
||||
while another case checks minimum level and if method compiled
|
||||
because there might be different compilation level transitions */
|
||||
if (CHECK_LEVEL != COMP_LEVEL_AOT) {
|
||||
Asserts.assertGTE(WHITE_BOX.getMethodCompilationLevel(e),
|
||||
CHECK_LEVEL,
|
||||
String.format("%s: expected compilation level"
|
||||
+ " after compilation to be no less than %d for %s",
|
||||
testCase.name(), CHECK_LEVEL, testCase.name()));
|
||||
} else {
|
||||
Asserts.assertEQ(WHITE_BOX.getMethodCompilationLevel(e),
|
||||
COMP_LEVEL_AOT, String.format("%s: expected compilation"
|
||||
+ " level after compilation to be equal to %d for %s",
|
||||
testCase.name(), COMP_LEVEL_AOT, testCase.name()));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2019, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.aot.SharedUsageTest
|
||||
* compiler.aot.AotCompiler
|
||||
* @run driver compiler.aot.AotCompiler -libname libSharedUsageTest.so
|
||||
* -class compiler.aot.SharedUsageTest
|
||||
* -extraopt -XX:-UseCompressedOops
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./libSharedUsageTest.so
|
||||
* -XX:-UseCompressedOops
|
||||
* -Dcompiler.aot.SharedUsageTest.parent=true
|
||||
* compiler.aot.SharedUsageTest
|
||||
* @summary check if .so can be successfully shared with 2 java processes
|
||||
*/
|
||||
|
||||
package compiler.aot;
|
||||
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.process.ExitCode;
|
||||
import jdk.test.lib.Utils;
|
||||
import jdk.test.lib.cli.CommandLineOptionTest;
|
||||
|
||||
public class SharedUsageTest {
|
||||
private static final String HELLO_MSG = "HelloWorld";
|
||||
private static final boolean ADD_TEST_VM_OPTION = false;
|
||||
private static boolean shouldBeFalseInParent = false;
|
||||
private static final boolean IS_PARENT = Boolean.getBoolean(
|
||||
"compiler.aot.SharedUsageTest.parent");
|
||||
|
||||
public static void main(String args[]) throws Throwable {
|
||||
Asserts.assertFalse(shouldBeFalseInParent,
|
||||
"A test invariant is broken");
|
||||
if (IS_PARENT) {
|
||||
/* An output of .so being used is verified after launch.
|
||||
A respective message is triggered by PrintAOT option. */
|
||||
CommandLineOptionTest.verifyJVMStartup(
|
||||
new String[]{"libSharedUsageTest.so aot library",
|
||||
HELLO_MSG}, null, "Unexpected exit code",
|
||||
"Unexpected output", ExitCode.OK, ADD_TEST_VM_OPTION,
|
||||
"-XX:+UnlockExperimentalVMOptions", "-XX:+UseAOT", "-XX:+PrintAOT",
|
||||
"-Dtest.jdk=" + Utils.TEST_JDK,
|
||||
"-XX:AOTLibrary=./libSharedUsageTest.so",
|
||||
SharedUsageTest.class.getName());
|
||||
Asserts.assertFalse(shouldBeFalseInParent, "A static member got "
|
||||
+ "unexpectedly changed");
|
||||
} else {
|
||||
shouldBeFalseInParent = true;
|
||||
Asserts.assertTrue(shouldBeFalseInParent, "A static member wasn't"
|
||||
+ "changed as expected");
|
||||
System.out.println(HELLO_MSG);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, Arm Limited. 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8244164
|
||||
* @requires vm.aot & vm.bits == 64
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.aot.TestHeapBase
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname libTestHeapBase.so
|
||||
* -class compiler.aot.TestHeapBase
|
||||
* -compile compiler.aot.TestHeapBase.test()V
|
||||
* -extraopt -XX:+UseCompressedOops -extraopt -Xmx1g
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:+UseCompressedOops -XX:HeapBaseMinAddress=32g
|
||||
* -XX:AOTLibrary=./libTestHeapBase.so -Xbootclasspath/a:.
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xlog:aot+class+load=trace
|
||||
* compiler.aot.TestHeapBase
|
||||
* @summary check for crash when jaotc is run with zero-based compressed oops then
|
||||
* generated code is loaded in vm with non-zero-based compressed oops.
|
||||
*/
|
||||
|
||||
package compiler.aot;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.Utils;
|
||||
import sun.hotspot.WhiteBox;
|
||||
import compiler.whitebox.CompilerWhiteBoxTest;
|
||||
|
||||
public final class TestHeapBase {
|
||||
private static final String TEST_METHOD = "test";
|
||||
private static final WhiteBox WB = WhiteBox.getWhiteBox();
|
||||
private final Method testMethod;
|
||||
|
||||
private TestHeapBase() {
|
||||
try {
|
||||
testMethod = getClass().getDeclaredMethod(TEST_METHOD);
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw new Error("TEST BUG: no test method found", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
new TestHeapBase().test();
|
||||
}
|
||||
|
||||
private void test() {
|
||||
System.out.println("Hello, World!");
|
||||
|
||||
Asserts.assertTrue(WB.isMethodCompiled(testMethod),
|
||||
"Method expected to be compiled");
|
||||
Asserts.assertEQ(WB.getMethodCompilationLevel(testMethod),
|
||||
CompilerWhiteBoxTest.COMP_LEVEL_AOT,
|
||||
"Expected method to be AOT compiled");
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.org.objectweb.asm
|
||||
* java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeDynamic
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver compiler.calls.common.InvokeDynamicPatcher
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname AotInvokeDynamic2AotTest.so
|
||||
* -class compiler.calls.common.InvokeDynamic
|
||||
* -extraopt -XX:+UnlockDiagnosticVMOptions -extraopt -XX:+WhiteBoxAPI -extraopt -Xbootclasspath/a:.
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeDynamic2AotTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeDynamic
|
||||
* -checkCallerCompileLevel -1 -checkCalleeCompileLevel -1
|
||||
* @summary check calls from aot to aot code using invokedynamic
|
||||
*/
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.org.objectweb.asm
|
||||
* java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeDynamic
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver compiler.calls.common.InvokeDynamicPatcher
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname AotInvokeDynamic2CompiledTest.so
|
||||
* -class compiler.calls.common.InvokeDynamic
|
||||
* -compile compiler.calls.common.InvokeDynamic.caller()V
|
||||
* @run main/othervm -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeDynamic2CompiledTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeDynamic -compileCallee 1
|
||||
* -checkCalleeCompileLevel 1
|
||||
* @run main/othervm -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeDynamic2CompiledTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeDynamic -compileCallee 4
|
||||
* -checkCalleeCompileLevel 4
|
||||
* @summary check calls from aot to jit-compiled code using invokedynamic
|
||||
*/
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.org.objectweb.asm
|
||||
* java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeDynamic
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver compiler.calls.common.InvokeDynamicPatcher
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler
|
||||
* -libname AotInvokeDynamic2InterpretedTest.so
|
||||
* -class compiler.calls.common.InvokeDynamic
|
||||
* -compile compiler.calls.common.InvokeDynamic.caller()V
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions
|
||||
* -XX:AOTLibrary=./AotInvokeDynamic2InterpretedTest.so
|
||||
* -XX:CompileCommand=exclude,compiler.calls.common.InvokeDynamic::callee
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* -XX:+UseAOT compiler.calls.common.InvokeDynamic -checkCallerCompileLevel -1
|
||||
* @summary check calls from aot to interpreted code using invokedynamic
|
||||
*/
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.org.objectweb.asm
|
||||
* java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeDynamic
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver compiler.calls.common.InvokeDynamicPatcher
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname AotInvokeDynamic2NativeTest.so
|
||||
* -class compiler.calls.common.InvokeDynamic
|
||||
* -compile compiler.calls.common.InvokeDynamic.caller()V
|
||||
* @run main/othervm/native -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeDynamic2NativeTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeDynamic -nativeCallee -checkCallerCompileLevel -1
|
||||
* @summary check calls from aot to native code using invokedynamic
|
||||
*/
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeInterface
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname AotInvokeInterface2AotTest.so
|
||||
* -class compiler.calls.common.InvokeInterface
|
||||
* -extraopt -XX:+UnlockDiagnosticVMOptions -extraopt -XX:+WhiteBoxAPI -extraopt -Xbootclasspath/a:.
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeInterface2AotTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeInterface
|
||||
* -checkCallerCompileLevel -1 -checkCalleeCompileLevel -1
|
||||
* @summary check calls from aot to aot code using invokeinterface
|
||||
*/
|
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeInterface
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler
|
||||
* -libname AotInvokeInterface2CompiledTest.so
|
||||
* -class compiler.calls.common.InvokeInterface
|
||||
* -compile compiler.calls.common.InvokeInterface.caller()V
|
||||
* @run main/othervm -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeInterface2CompiledTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeInterface -compileCallee 1
|
||||
* -checkCalleeCompileLevel 1
|
||||
* @run main/othervm -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeInterface2CompiledTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeInterface -compileCallee 4
|
||||
* -checkCalleeCompileLevel 4
|
||||
* @summary check calls from aot to jit-compiled code using invokeinterface
|
||||
*/
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeInterface
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler
|
||||
* -libname AotInvokeInterface2InterpretedTest.so
|
||||
* -class compiler.calls.common.InvokeInterface
|
||||
* -compile compiler.calls.common.InvokeInterface.caller()V
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeInterface2InterpretedTest.so
|
||||
* -XX:CompileCommand=exclude,compiler.calls.common.InvokeInterface::callee
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeInterface -checkCallerCompileLevel -1
|
||||
* @summary check calls from aot to interpreted code using invokeinterface
|
||||
*/
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeInterface
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname AotInvokeInterface2NativeTest.so
|
||||
* -class compiler.calls.common.InvokeInterface
|
||||
* -compile compiler.calls.common.InvokeInterface.caller()V
|
||||
* @run main/othervm/native -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeInterface2NativeTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeInterface -nativeCallee -checkCallerCompileLevel -1
|
||||
* @summary check calls from aot to native code using invokeinterface
|
||||
*/
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeSpecial
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname AotInvokeSpecial2AotTest.so
|
||||
* -class compiler.calls.common.InvokeSpecial
|
||||
* -extraopt -XX:+UnlockDiagnosticVMOptions -extraopt -XX:+WhiteBoxAPI -extraopt -Xbootclasspath/a:.
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeSpecial2AotTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeSpecial
|
||||
* -checkCallerCompileLevel -1 -checkCalleeCompileLevel -1
|
||||
* @summary check calls from aot to aot code using invokespecial
|
||||
*/
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeSpecial
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname AotInvokeSpecial2CompiledTest.so
|
||||
* -class compiler.calls.common.InvokeSpecial
|
||||
* -compile compiler.calls.common.InvokeSpecial.caller()V
|
||||
* @run main/othervm -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeSpecial2CompiledTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeSpecial -compileCallee 1
|
||||
* -checkCalleeCompileLevel 1
|
||||
* @run main/othervm -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeSpecial2CompiledTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeSpecial -compileCallee 4
|
||||
* -checkCalleeCompileLevel 4
|
||||
* @summary check calls from aot to jit-compiled code using invokespecial
|
||||
*/
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeSpecial
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler
|
||||
* -libname AotInvokeSpecial2InterpretedTest.so
|
||||
* -class compiler.calls.common.InvokeSpecial
|
||||
* -compile compiler.calls.common.InvokeSpecial.caller()V
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeSpecial2InterpretedTest.so
|
||||
* -XX:CompileCommand=exclude,compiler.calls.common.InvokeSpecial::callee
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeSpecial -checkCallerCompileLevel -1
|
||||
* @summary check calls from aot to interpreted code using invokespecial
|
||||
*/
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeSpecial
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname AotInvokeSpecial2NativeTest.so
|
||||
* -class compiler.calls.common.InvokeSpecial
|
||||
* -compile compiler.calls.common.InvokeSpecial.caller()V
|
||||
* @run main/othervm/native -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeSpecial2NativeTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeSpecial -nativeCallee -checkCallerCompileLevel -1
|
||||
* @summary check calls from aot to interpreted code using invokespecial
|
||||
*/
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeStatic
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname AotInvokeStatic2AotTest.so
|
||||
* -class compiler.calls.common.InvokeStatic
|
||||
* -extraopt -XX:+UnlockDiagnosticVMOptions -extraopt -XX:+WhiteBoxAPI -extraopt -Xbootclasspath/a:.
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeStatic2AotTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeStatic
|
||||
* -checkCallerCompileLevel -1 -checkCalleeCompileLevel -1
|
||||
* @summary check calls from aot to aot code using invokestatic
|
||||
*/
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeStatic
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname AotInvokeStatic2CompiledTest.so
|
||||
* -class compiler.calls.common.InvokeStatic
|
||||
* -compile compiler.calls.common.InvokeStatic.caller()V
|
||||
* @run main/othervm -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeStatic2CompiledTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeStatic -compileCallee 1
|
||||
* -checkCalleeCompileLevel 1
|
||||
* @run main/othervm -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeStatic2CompiledTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeStatic -compileCallee 4
|
||||
* -checkCalleeCompileLevel 4
|
||||
* @summary check calls from aot to jit-compiled code using invokestatic
|
||||
*/
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeStatic
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler
|
||||
* -libname AotInvokeStatic2InterpretedTest.so
|
||||
* -class compiler.calls.common.InvokeStatic
|
||||
* -compile compiler.calls.common.InvokeStatic.caller()V
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeStatic2InterpretedTest.so
|
||||
* -XX:CompileCommand=exclude,compiler.calls.common.InvokeStatic::callee
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeStatic -checkCallerCompileLevel -1
|
||||
* @summary check calls from aot to interpreted code using invokestatic
|
||||
*/
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeStatic
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname AotInvokeStatic2NativeTest.so
|
||||
* -class compiler.calls.common.InvokeStatic
|
||||
* -compile compiler.calls.common.InvokeStatic.caller()V
|
||||
* @run main/othervm/native -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeStatic2NativeTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeStatic -nativeCallee -checkCallerCompileLevel -1
|
||||
* @summary check calls from aot to native code using invokestatic
|
||||
*/
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeVirtual
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname AotInvokeVirtual2AotTest.so
|
||||
* -class compiler.calls.common.InvokeVirtual
|
||||
* -extraopt -XX:+UnlockDiagnosticVMOptions -extraopt -XX:+WhiteBoxAPI -extraopt -Xbootclasspath/a:.
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeVirtual2AotTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeVirtual
|
||||
* -checkCallerCompileLevel -1 -checkCalleeCompileLevel -1
|
||||
* @summary check calls from aot to aot code, using invokevirtual
|
||||
*/
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeVirtual
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname AotInvokeVirtual2CompiledTest.so
|
||||
* -class compiler.calls.common.InvokeVirtual
|
||||
* -compile compiler.calls.common.InvokeVirtual.caller()V
|
||||
* @run main/othervm -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeVirtual2CompiledTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeVirtual -compileCallee 1
|
||||
* -checkCalleeCompileLevel 1
|
||||
* @run main/othervm -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeVirtual2CompiledTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeVirtual -compileCallee 4
|
||||
* -checkCalleeCompileLevel 4
|
||||
* @summary check calls from aot to jit-compiled code, using invokevirtual
|
||||
*/
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeVirtual
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler
|
||||
* -libname AotInvokeVirtual2InterpretedTest.so
|
||||
* -class compiler.calls.common.InvokeVirtual
|
||||
* -compile compiler.calls.common.InvokeVirtual.caller()V
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeVirtual2InterpretedTest.so
|
||||
* -XX:CompileCommand=exclude,compiler.calls.common.InvokeVirtual::callee
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeVirtual -checkCallerCompileLevel -1
|
||||
* @summary check calls from aot to interpreted code, using invokevirtual
|
||||
*/
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeVirtual
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname AotInvokeVirtual2NativeTest.so
|
||||
* -class compiler.calls.common.InvokeVirtual
|
||||
* -compile compiler.calls.common.InvokeVirtual.caller()V
|
||||
* @run main/othervm/native -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./AotInvokeVirtual2NativeTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeVirtual -nativeCallee -checkCallerCompileLevel -1
|
||||
* @summary check calls from aot to native code, using invokevirtual
|
||||
*/
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.org.objectweb.asm
|
||||
* java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeDynamic
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.calls.common.InvokeDynamicPatcher
|
||||
* @run driver compiler.aot.AotCompiler -libname CompiledInvokeDynamic2AotTest.so
|
||||
* -class compiler.calls.common.InvokeDynamic
|
||||
* -compile compiler.calls.common.InvokeDynamic.callee.*
|
||||
* @run main/othervm -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./CompiledInvokeDynamic2AotTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeDynamic -compileCaller 1
|
||||
* -checkCalleeCompileLevel -1 -checkCallerCompileLevel 1
|
||||
* @run main/othervm -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./CompiledInvokeDynamic2AotTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeDynamic -compileCaller 4
|
||||
* -checkCallerCompileLevel 4 -checkCalleeCompileLevel -1
|
||||
* @summary check calls from jit-compiled to aot code using invokedynamic
|
||||
*/
|
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeInterface
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler
|
||||
* -libname CompiledInvokeInterface2AotTest.so
|
||||
* -class compiler.calls.common.InvokeInterface
|
||||
* -compile compiler.calls.common.InvokeInterface.callee.*
|
||||
* @run main/othervm -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./CompiledInvokeInterface2AotTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeInterface -compileCaller 1
|
||||
* -checkCalleeCompileLevel -1 -checkCallerCompileLevel 1
|
||||
* @run main/othervm -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./CompiledInvokeInterface2AotTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeInterface -compileCaller 4
|
||||
* -checkCallerCompileLevel 4 -checkCalleeCompileLevel -1
|
||||
* @summary check calls from jit-compiled to aot code using invokeinterface
|
||||
*/
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeSpecial
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname CompiledInvokeSpecial2AotTest.so
|
||||
* -class compiler.calls.common.InvokeSpecial
|
||||
* -compile compiler.calls.common.InvokeSpecial.callee.*
|
||||
* @run main/othervm -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./CompiledInvokeSpecial2AotTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeSpecial -compileCaller 1
|
||||
* -checkCalleeCompileLevel -1 -checkCallerCompileLevel 1
|
||||
* @run main/othervm -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./CompiledInvokeSpecial2AotTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeSpecial -compileCaller 4
|
||||
* -checkCallerCompileLevel 4 -checkCalleeCompileLevel -1
|
||||
* @summary check calls from jit-compiled to aot code using invokespecial
|
||||
*/
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeStatic
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname CompiledInvokeStatic2AotTest.so
|
||||
* -class compiler.calls.common.InvokeStatic
|
||||
* -compile compiler.calls.common.InvokeStatic.callee.*
|
||||
* @run main/othervm -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./CompiledInvokeStatic2AotTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeStatic -compileCaller 1
|
||||
* -checkCalleeCompileLevel -1 -checkCallerCompileLevel 1
|
||||
* @run main/othervm -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./CompiledInvokeStatic2AotTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeStatic -compileCaller 4
|
||||
* -checkCallerCompileLevel 4 -checkCalleeCompileLevel -1
|
||||
* @summary check calls from jit-compiled to aot code using invokestatic
|
||||
*/
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeVirtual
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname CompiledInvokeVirtual2AotTest.so
|
||||
* -class compiler.calls.common.InvokeVirtual
|
||||
* -compile compiler.calls.common.InvokeVirtual.callee.*
|
||||
* @run main/othervm -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./CompiledInvokeVirtual2AotTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeVirtual -compileCaller 1
|
||||
* -checkCalleeCompileLevel -1 -checkCallerCompileLevel 1
|
||||
* @run main/othervm -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./CompiledInvokeVirtual2AotTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeVirtual -compileCaller 4
|
||||
* -checkCallerCompileLevel 4 -checkCalleeCompileLevel -1
|
||||
* @summary check calls from jit-compiled to aot code using invokevirtual
|
||||
*/
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.org.objectweb.asm
|
||||
* java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeDynamic
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.calls.common.InvokeDynamicPatcher
|
||||
* @run driver compiler.aot.AotCompiler
|
||||
* -libname InterpretedInvokeDynamic2AotTest.so
|
||||
* -class compiler.calls.common.InvokeDynamic
|
||||
* -compile compiler.calls.common.InvokeDynamic.callee.*
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./InterpretedInvokeDynamic2AotTest.so
|
||||
* -XX:CompileCommand=exclude,compiler.calls.common.InvokeDynamic::caller
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeDynamic -checkCalleeCompileLevel -1
|
||||
* @summary check calls from interpreted to aot code using invokedynamic
|
||||
*/
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeInterface
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler
|
||||
* -libname InterpretedInvokeInterface2AotTest.so
|
||||
* -class compiler.calls.common.InvokeInterface
|
||||
* -compile compiler.calls.common.InvokeInterface.callee.*
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./InterpretedInvokeInterface2AotTest.so
|
||||
* -XX:CompileCommand=exclude,compiler.calls.common.InvokeInterface::caller
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeInterface -checkCalleeCompileLevel -1
|
||||
* @summary check calls from interpreted to aot code using invokeinterface
|
||||
*/
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeSpecial
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler
|
||||
* -libname InterpretedInvokeSpecial2AotTest.so
|
||||
* -class compiler.calls.common.InvokeSpecial
|
||||
* -compile compiler.calls.common.InvokeSpecial.callee.*
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./InterpretedInvokeSpecial2AotTest.so
|
||||
* -XX:CompileCommand=exclude,compiler.calls.common.InvokeSpecial::caller
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeSpecial -checkCalleeCompileLevel -1
|
||||
* @summary check calls from interpreted to aot code using invokespecial
|
||||
*/
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeStatic
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler
|
||||
* -libname InterpretedInvokeStatic2AotTest.so
|
||||
* -class compiler.calls.common.InvokeStatic
|
||||
* -compile compiler.calls.common.InvokeStatic.callee.*
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./InterpretedInvokeStatic2AotTest.so
|
||||
* -XX:CompileCommand=exclude,compiler.calls.common.InvokeStatic::caller
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeStatic -checkCalleeCompileLevel -1
|
||||
* @summary check calls from interpreted to aot code using invokestatic
|
||||
*/
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeVirtual
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler
|
||||
* -libname InterpretedInvokeVirtual2AotTest.so
|
||||
* -class compiler.calls.common.InvokeVirtual
|
||||
* -compile compiler.calls.common.InvokeVirtual.callee.*
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./InterpretedInvokeVirtual2AotTest.so
|
||||
* -XX:CompileCommand=exclude,compiler.calls.common.InvokeVirtual::caller
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeVirtual -checkCalleeCompileLevel -1
|
||||
* @summary check calls from interpreted to aot code using invokevirtual
|
||||
*/
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeSpecial
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname NativeInvokeSpecial2AotTest.so
|
||||
* -class compiler.calls.common.InvokeSpecial
|
||||
* -compile compiler.calls.common.InvokeSpecial.callee.*
|
||||
* @run main/othervm/native -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./NativeInvokeSpecial2AotTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeSpecial -nativeCaller -checkCalleeCompileLevel -1
|
||||
* @summary check calls from native to aot code using invokespecial
|
||||
*/
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeStatic
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname NativeInvokeStatic2AotTest.so
|
||||
* -class compiler.calls.common.InvokeStatic
|
||||
* -compile compiler.calls.common.InvokeStatic.callee.*
|
||||
* @run main/othervm/native -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./NativeInvokeStatic2AotTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeStatic -nativeCaller -checkCalleeCompileLevel -1
|
||||
* @summary check calls from native to aot code using invokestatic
|
||||
*/
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.calls.common.InvokeVirtual
|
||||
* sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run driver compiler.aot.AotCompiler -libname NativeInvokeVirtual2AotTest.so
|
||||
* -class compiler.calls.common.InvokeVirtual
|
||||
* -compile compiler.calls.common.InvokeVirtual.callee.*
|
||||
* @run main/othervm/native -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* -XX:AOTLibrary=./NativeInvokeVirtual2AotTest.so
|
||||
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* compiler.calls.common.InvokeVirtual -nativeCaller -checkCalleeCompileLevel -1
|
||||
* @summary check calls from native to aot code using invokevirtual
|
||||
*/
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2019, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package compiler.aot.cli;
|
||||
|
||||
import compiler.aot.HelloWorldPrinter;
|
||||
import jdk.test.lib.process.ExitCode;
|
||||
import jdk.test.lib.cli.CommandLineOptionTest;
|
||||
|
||||
public class AotLibraryNegativeBase {
|
||||
private static final String[] UNEXPECTED_MESSAGES = new String[] {
|
||||
HelloWorldPrinter.MESSAGE
|
||||
};
|
||||
|
||||
public static void launchTest(String option, String expectedMessages[]) {
|
||||
try {
|
||||
boolean addTestVMOptions = true;
|
||||
CommandLineOptionTest.verifyJVMStartup(expectedMessages,
|
||||
UNEXPECTED_MESSAGES,
|
||||
"Unexpected exit code using " + option,
|
||||
"Unexpected output using " + option, ExitCode.FAIL,
|
||||
addTestVMOptions, "-XX:+UnlockExperimentalVMOptions", "-XX:+UseAOT",
|
||||
"-XX:+PrintAOT", option, HelloWorldPrinter.class.getName());
|
||||
} catch (Throwable t) {
|
||||
throw new Error("Problems executing test using " + option
|
||||
+ ": " + t, t);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2019, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @build compiler.aot.cli.DisabledAOTWithLibraryTest
|
||||
* compiler.aot.AotCompiler
|
||||
* @run driver compiler.aot.AotCompiler -libname libDisabledAOTWithLibraryTest.so
|
||||
* -class compiler.aot.HelloWorldPrinter
|
||||
* -compile compiler.aot.HelloWorldPrinter.print()V
|
||||
* @run driver compiler.aot.cli.DisabledAOTWithLibraryTest
|
||||
* @summary check if providing aot library with aot disabled is handled properly
|
||||
*/
|
||||
|
||||
package compiler.aot.cli;
|
||||
|
||||
import compiler.aot.HelloWorldPrinter;
|
||||
import jdk.test.lib.process.ExitCode;
|
||||
import jdk.test.lib.cli.CommandLineOptionTest;
|
||||
|
||||
public class DisabledAOTWithLibraryTest {
|
||||
private final static String LIB_NAME = "libDisabledAOTWithLibraryTest.so";
|
||||
private final static String[] UNEXPECTED_MESSAGES = new String[] {
|
||||
LIB_NAME + " aot library"
|
||||
};
|
||||
|
||||
private final static String[] EXPECTED_MESSAGES = new String[] {
|
||||
HelloWorldPrinter.MESSAGE
|
||||
};
|
||||
|
||||
public static void main(String args[]) {
|
||||
try {
|
||||
boolean addTestVMOptions = true;
|
||||
CommandLineOptionTest.verifyJVMStartup(EXPECTED_MESSAGES,
|
||||
UNEXPECTED_MESSAGES, "Unexpected exit code",
|
||||
"Unexpected output", ExitCode.OK, addTestVMOptions,
|
||||
"-XX:+UnlockExperimentalVMOptions", "-XX:-UseAOT", "-XX:+PrintAOT",
|
||||
"-XX:AOTLibrary=./" + LIB_NAME,
|
||||
HelloWorldPrinter.class.getName());
|
||||
} catch (Throwable t) {
|
||||
throw new Error("Problems executing test " + t, t);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.lib.helpers.ClassFileInstaller
|
||||
* @run driver compiler.aot.cli.IncorrectAOTLibraryTest
|
||||
* @summary check if incorrect aot library is handled properly
|
||||
*/
|
||||
|
||||
package compiler.aot.cli;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public class IncorrectAOTLibraryTest {
|
||||
private static final String OPTION
|
||||
= "-XX:AOTLibrary=./" + Paths.get("jdk", "test", "lib", "helpers", "ClassFileInstaller.class").toString();
|
||||
private static final String[] EXPECTED_MESSAGES = new String[] {
|
||||
"error opening file:"
|
||||
};
|
||||
|
||||
public static void main(String args[]) {
|
||||
AotLibraryNegativeBase.launchTest(OPTION, EXPECTED_MESSAGES);
|
||||
}
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2019, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.aot.cli.MultipleAOTLibraryTest
|
||||
* compiler.aot.AotCompiler
|
||||
* @run driver compiler.aot.AotCompiler
|
||||
* -libname libMultipleAOTLibraryTest1.so
|
||||
* -class compiler.aot.HelloWorldPrinter
|
||||
* -compile compiler.aot.HelloWorldPrinter.*
|
||||
* -extraopt -XX:+UseCompressedOops
|
||||
* @run driver compiler.aot.AotCompiler
|
||||
* -libname libMultipleAOTLibraryTest2.so
|
||||
* -class compiler.aot.HelloWorldPrinter
|
||||
* -compile compiler.aot.HelloWorldPrinter.print()V
|
||||
* -extraopt -XX:+UseCompressedOops
|
||||
* @run driver compiler.aot.cli.MultipleAOTLibraryTest -XX:+UseCompressedOops
|
||||
* @run driver compiler.aot.AotCompiler -libname libMultipleAOTLibraryTest1.so
|
||||
* -class compiler.aot.HelloWorldPrinter
|
||||
* -compile compiler.aot.HelloWorldPrinter.*
|
||||
* -extraopt -XX:-UseCompressedOops
|
||||
* @run driver compiler.aot.AotCompiler -libname libMultipleAOTLibraryTest2.so
|
||||
* -class compiler.aot.HelloWorldPrinter
|
||||
* -compile compiler.aot.HelloWorldPrinter.print()V
|
||||
* -extraopt -XX:-UseCompressedOops
|
||||
* @run driver compiler.aot.cli.MultipleAOTLibraryTest -XX:-UseCompressedOops
|
||||
* @summary check if multiple aot libraries are loaded successfully
|
||||
*/
|
||||
|
||||
package compiler.aot.cli;
|
||||
|
||||
import compiler.aot.HelloWorldPrinter;
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import jdk.test.lib.process.ExitCode;
|
||||
import jdk.test.lib.cli.CommandLineOptionTest;
|
||||
|
||||
public final class MultipleAOTLibraryTest {
|
||||
private final static String EXPECTED_OUTPUT[] = new String[] {
|
||||
"libMultipleAOTLibraryTest1.so aot library",
|
||||
"libMultipleAOTLibraryTest2.so aot library",
|
||||
HelloWorldPrinter.MESSAGE
|
||||
};
|
||||
private final static String UNEXPECTED_OUTPUT[] = null;
|
||||
|
||||
public static void main(String args[]) {
|
||||
new MultipleAOTLibraryTest().runTest(args);
|
||||
}
|
||||
|
||||
private void runTest(String args[]) {
|
||||
try {
|
||||
boolean addTestVMOptions = true;
|
||||
String[] allArgs = Arrays.copyOf(args, args.length + 5);
|
||||
allArgs[args.length] = "-XX:+UnlockExperimentalVMOptions";
|
||||
allArgs[args.length + 1] = "-XX:AOTLibrary="
|
||||
+ "." + File.separator
|
||||
+ "libMultipleAOTLibraryTest1.so"
|
||||
+ File.pathSeparator
|
||||
+ "." + File.separator
|
||||
+ "libMultipleAOTLibraryTest2.so";
|
||||
allArgs[args.length + 2] = "-XX:+PrintAOT";
|
||||
allArgs[args.length + 3] = "-XX:+UseAOT";
|
||||
allArgs[args.length + 4] = HelloWorldPrinter.class.getName();
|
||||
CommandLineOptionTest.verifyJVMStartup(EXPECTED_OUTPUT,
|
||||
UNEXPECTED_OUTPUT, "Unexpected exit code",
|
||||
"Unexpected output", ExitCode.OK, addTestVMOptions,
|
||||
allArgs);
|
||||
} catch (Throwable t) {
|
||||
throw new Error("Problems executing test: " + t, t);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2017, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @run driver compiler.aot.cli.NonExistingAOTLibraryTest
|
||||
* @summary check if non-existing aot library is handled properly
|
||||
*/
|
||||
|
||||
package compiler.aot.cli;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class NonExistingAOTLibraryTest {
|
||||
private static final String PATH = "./NonExisting.so";
|
||||
private static final String OPTION = "-XX:AOTLibrary=" + PATH;
|
||||
private static final String[] EXPECTED_MESSAGES = new String[] {
|
||||
"error opening file"
|
||||
};
|
||||
|
||||
public static void main(String args[]) {
|
||||
if (new File(PATH).exists()) {
|
||||
throw new Error("TESTBUG: " + PATH + " unexpectedly exists");
|
||||
}
|
||||
AotLibraryNegativeBase.launchTest(OPTION, EXPECTED_MESSAGES);
|
||||
}
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2019, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib / /testlibrary
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.aot.cli.SingleAOTLibraryTest
|
||||
* compiler.aot.AotCompiler
|
||||
* @run driver compiler.aot.AotCompiler -libname libSingleAOTLibraryTest.so
|
||||
* -class compiler.aot.HelloWorldPrinter
|
||||
* -compile compiler.aot.HelloWorldPrinter.print()V
|
||||
* -extraopt -XX:+UseCompressedOops
|
||||
* @run driver compiler.aot.cli.SingleAOTLibraryTest -XX:+UseCompressedOops
|
||||
* @run driver compiler.aot.AotCompiler -libname libSingleAOTLibraryTest.so
|
||||
* -class compiler.aot.HelloWorldPrinter
|
||||
* -compile compiler.aot.HelloWorldPrinter.print()V
|
||||
* -extraopt -XX:-UseCompressedOops
|
||||
* @run driver compiler.aot.cli.SingleAOTLibraryTest -XX:-UseCompressedOops
|
||||
* @summary check if single aot library is loaded successfully
|
||||
*/
|
||||
|
||||
package compiler.aot.cli;
|
||||
|
||||
import compiler.aot.HelloWorldPrinter;
|
||||
import jdk.test.lib.process.ExitCode;
|
||||
import jdk.test.lib.cli.CommandLineOptionTest;
|
||||
|
||||
public final class SingleAOTLibraryTest {
|
||||
private static final String[] EXPECTED_MESSAGES = new String[] {
|
||||
"libSingleAOTLibraryTest.so aot library",
|
||||
HelloWorldPrinter.MESSAGE
|
||||
};
|
||||
private static final String[] UNEXPECTED_MESSAGES = null;
|
||||
public static void main(String args[]) {
|
||||
if (args.length == 1) {
|
||||
new SingleAOTLibraryTest().runTest(args[0]);
|
||||
} else {
|
||||
throw new Error("Test expects 1 parameter");
|
||||
}
|
||||
}
|
||||
|
||||
private void runTest(String arg) {
|
||||
try {
|
||||
boolean addTestVMOptions = true;
|
||||
CommandLineOptionTest.verifyJVMStartup(EXPECTED_MESSAGES,
|
||||
UNEXPECTED_MESSAGES, "Unexpected exit code using " + arg,
|
||||
"Unexpected output using " + arg, ExitCode.OK,
|
||||
addTestVMOptions, "-XX:+UnlockExperimentalVMOptions", "-XX:+UseAOT",
|
||||
"-XX:+PrintAOT", arg, "-XX:AOTLibrary=./libSingleAOTLibraryTest.so",
|
||||
HelloWorldPrinter.class.getName());
|
||||
} catch (Throwable t) {
|
||||
throw new Error("Problems executing test: " + t, t);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2019, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /testlibrary /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.aot.cli.SingleAOTOptionTest
|
||||
* compiler.aot.AotCompiler
|
||||
* @run driver compiler.aot.AotCompiler -libname libSingleAOTOptionTest.so
|
||||
* -class compiler.aot.HelloWorldPrinter
|
||||
* -compile compiler.aot.HelloWorldPrinter.print()V
|
||||
* -extraopt -XX:+UseCompressedOops
|
||||
* @run driver compiler.aot.cli.SingleAOTOptionTest -XX:+UseCompressedOops
|
||||
* -XX:+UnlockExperimentalVMOptions -XX:AOTLibrary=./libSingleAOTOptionTest.so
|
||||
* @run main compiler.aot.cli.SingleAOTOptionTest
|
||||
* -XX:+UseCompressedOops -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* @run driver compiler.aot.AotCompiler -libname libSingleAOTOptionTest.so
|
||||
* -class compiler.aot.HelloWorldPrinter
|
||||
* -compile compiler.aot.HelloWorldPrinter.print()V
|
||||
* -extraopt -XX:-UseCompressedOops
|
||||
* @run driver compiler.aot.cli.SingleAOTOptionTest -XX:-UseCompressedOops
|
||||
* -XX:+UnlockExperimentalVMOptions -XX:AOTLibrary=./libSingleAOTOptionTest.so
|
||||
* @run driver compiler.aot.cli.SingleAOTOptionTest
|
||||
* -XX:-UseCompressedOops -XX:+UnlockExperimentalVMOptions -XX:+UseAOT
|
||||
* @summary check if specifying only one aot option handled properly
|
||||
*/
|
||||
|
||||
package compiler.aot.cli;
|
||||
|
||||
import compiler.aot.HelloWorldPrinter;
|
||||
import jdk.test.lib.process.ExitCode;
|
||||
import jdk.test.lib.cli.CommandLineOptionTest;
|
||||
|
||||
public class SingleAOTOptionTest {
|
||||
private static final String[] EXPECTED_MESSAGES = new String[] {
|
||||
HelloWorldPrinter.MESSAGE
|
||||
};
|
||||
private static final String[] UNEXPECTED_MESSAGES = null;
|
||||
|
||||
public static void main(String args[]) {
|
||||
if (args.length == 3) {
|
||||
new SingleAOTOptionTest().runTest(args[0], args[1], args[2]);
|
||||
} else {
|
||||
throw new Error("Test expects 2 parameters");
|
||||
}
|
||||
}
|
||||
|
||||
private void runTest(String arg1, String arg2, String arg3) {
|
||||
try {
|
||||
String exitCodeErrorMessage = String.format("Unexpected exit code "
|
||||
+ "using %s %s %s", arg1, arg2, arg3);
|
||||
String outputErrorMessage = String.format("Unexpected output using"
|
||||
+ " %s %s", arg1, arg2, arg3);
|
||||
boolean addTestVMOptions = true;
|
||||
CommandLineOptionTest.verifyJVMStartup(EXPECTED_MESSAGES,
|
||||
UNEXPECTED_MESSAGES, exitCodeErrorMessage,
|
||||
outputErrorMessage, ExitCode.OK, addTestVMOptions, arg1,
|
||||
arg2, arg3, HelloWorldPrinter.class.getName());
|
||||
} catch (Throwable t) {
|
||||
throw new Error("Problems executing test: " + t, t);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary check at-file jaotc support
|
||||
* @comment based on CompileClassTest with arguments wrote in 'jaotc.cmd' file
|
||||
* @requires vm.aot
|
||||
* @bug 8215322
|
||||
* @library / /test/lib /testlibrary
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.aot.cli.jaotc.AtFileTest
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller compiler.aot.cli.jaotc.data.HelloWorldOne
|
||||
* @run driver compiler.aot.cli.jaotc.AtFileTest
|
||||
*/
|
||||
|
||||
package compiler.aot.cli.jaotc;
|
||||
|
||||
import compiler.aot.cli.jaotc.data.HelloWorldOne;
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class AtFileTest {
|
||||
public static void main(String[] args) throws Exception {
|
||||
Path file = Paths.get("jaotc.cmd");
|
||||
Files.write(file, List.of("--class-name",
|
||||
JaotcTestHelper.getClassAotCompilationName(HelloWorldOne.class)));
|
||||
OutputAnalyzer oa = JaotcTestHelper.compileLibrary("@" + file.toString());
|
||||
oa.shouldHaveExitValue(0);
|
||||
File compiledLibrary = new File(JaotcTestHelper.DEFAULT_LIB_PATH);
|
||||
Asserts.assertTrue(compiledLibrary.exists(), "Compiled library file missing");
|
||||
Asserts.assertGT(compiledLibrary.length(), 0L, "Unexpected compiled library size");
|
||||
JaotcTestHelper.checkLibraryUsage(HelloWorldOne.class.getName());
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2017, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library / /testlibrary/ /test/lib
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @compile data/HelloWorldOne.java
|
||||
* @run driver compiler.aot.cli.jaotc.ClasspathOptionUnknownClassTest
|
||||
* @summary check jaotc can't compile class not from classpath
|
||||
*/
|
||||
|
||||
package compiler.aot.cli.jaotc;
|
||||
|
||||
import java.io.File;
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class ClasspathOptionUnknownClassTest {
|
||||
public static void main(String[] args) {
|
||||
OutputAnalyzer oa = JaotcTestHelper.compileLibrary("--class-name", "HelloWorldOne");
|
||||
Asserts.assertNE(oa.getExitValue(), 0, "Unexpected compilation exit code");
|
||||
File compiledLibrary = new File(JaotcTestHelper.DEFAULT_LIB_PATH);
|
||||
Asserts.assertFalse(compiledLibrary.exists(), "Compiler library unexpectedly exists");
|
||||
}
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library / /test/lib /testlibrary
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.aot.cli.jaotc.CompileAbsoluteDirectoryTest
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller compiler.aot.cli.jaotc.data.HelloWorldOne
|
||||
* compiler.aot.cli.jaotc.data.HelloWorldTwo
|
||||
* @run driver compiler.aot.cli.jaotc.CompileAbsoluteDirectoryTest
|
||||
* @summary check jaotc can compile directory with classes where directory is specified by absolute path
|
||||
* @bug 8218859
|
||||
*/
|
||||
package compiler.aot.cli.jaotc;
|
||||
|
||||
import compiler.aot.cli.jaotc.data.HelloWorldOne;
|
||||
import compiler.aot.cli.jaotc.data.HelloWorldTwo;
|
||||
import java.io.File;
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class CompileAbsoluteDirectoryTest {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
String dir = new java.io.File(".").getAbsolutePath();
|
||||
System.out.println("Do test --directory " + dir);
|
||||
OutputAnalyzer oa = JaotcTestHelper.compileLibrary("--directory", dir);
|
||||
oa.shouldHaveExitValue(0);
|
||||
File compiledLibrary = new File(JaotcTestHelper.DEFAULT_LIB_PATH);
|
||||
Asserts.assertTrue(compiledLibrary.exists(), "Compiled library file missing");
|
||||
Asserts.assertGT(compiledLibrary.length(), 0L, "Unexpected compiled library size");
|
||||
JaotcTestHelper.checkLibraryUsage(HelloWorldOne.class.getName());
|
||||
JaotcTestHelper.checkLibraryUsage(HelloWorldTwo.class.getName());
|
||||
} catch (Exception e) {
|
||||
throw new Error("Can't get full path name for '.', got exception " + e, e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library / /test/lib /testlibrary
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.aot.cli.jaotc.CompileClassTest
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller compiler.aot.cli.jaotc.data.HelloWorldOne
|
||||
* @run driver compiler.aot.cli.jaotc.CompileClassTest
|
||||
* @summary check jaotc can compile class
|
||||
*/
|
||||
|
||||
package compiler.aot.cli.jaotc;
|
||||
|
||||
import compiler.aot.cli.jaotc.data.HelloWorldOne;
|
||||
import java.io.File;
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class CompileClassTest {
|
||||
public static void main(String[] args) {
|
||||
OutputAnalyzer oa = JaotcTestHelper.compileLibrary("--class-name", JaotcTestHelper
|
||||
.getClassAotCompilationName(HelloWorldOne.class));
|
||||
oa.shouldHaveExitValue(0);
|
||||
File compiledLibrary = new File(JaotcTestHelper.DEFAULT_LIB_PATH);
|
||||
Asserts.assertTrue(compiledLibrary.exists(), "Compiled library file missing");
|
||||
Asserts.assertGT(compiledLibrary.length(), 0L, "Unexpected compiled library size");
|
||||
JaotcTestHelper.checkLibraryUsage(HelloWorldOne.class.getName());
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library / /test/lib /testlibrary
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.aot.cli.jaotc.CompileClassWithDebugTest
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller compiler.aot.cli.jaotc.data.HelloWorldOne
|
||||
* @run driver compiler.aot.cli.jaotc.CompileClassWithDebugTest
|
||||
* @summary check that jaotc can compile a class with a --debug flag
|
||||
*/
|
||||
|
||||
package compiler.aot.cli.jaotc;
|
||||
|
||||
import compiler.aot.cli.jaotc.data.HelloWorldOne;
|
||||
import java.io.File;
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class CompileClassWithDebugTest {
|
||||
public static void main(String[] args) {
|
||||
OutputAnalyzer oa = JaotcTestHelper.compileLibrary("--debug", "--class-name", JaotcTestHelper
|
||||
.getClassAotCompilationName(HelloWorldOne.class));
|
||||
oa.shouldHaveExitValue(0);
|
||||
File compiledLibrary = new File(JaotcTestHelper.DEFAULT_LIB_PATH);
|
||||
Asserts.assertTrue(compiledLibrary.exists(), "Compiled library file missing");
|
||||
Asserts.assertGT(compiledLibrary.length(), 0L, "Unexpected compiled library size");
|
||||
JaotcTestHelper.checkLibraryUsage(HelloWorldOne.class.getName());
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library / /test/lib /testlibrary
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.aot.cli.jaotc.CompileDirectoryTest
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller compiler.aot.cli.jaotc.data.HelloWorldOne
|
||||
* compiler.aot.cli.jaotc.data.HelloWorldTwo
|
||||
* @run driver compiler.aot.cli.jaotc.CompileDirectoryTest
|
||||
* @summary check jaotc can compile directory with classes where directory is specified by relative path
|
||||
*/
|
||||
package compiler.aot.cli.jaotc;
|
||||
|
||||
import compiler.aot.cli.jaotc.data.HelloWorldOne;
|
||||
import compiler.aot.cli.jaotc.data.HelloWorldTwo;
|
||||
import java.io.File;
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class CompileDirectoryTest {
|
||||
public static void main(String[] args) {
|
||||
OutputAnalyzer oa =JaotcTestHelper.compileLibrary("--directory", ".");
|
||||
oa.shouldHaveExitValue(0);
|
||||
File compiledLibrary = new File(JaotcTestHelper.DEFAULT_LIB_PATH);
|
||||
Asserts.assertTrue(compiledLibrary.exists(), "Compiled library file missing");
|
||||
Asserts.assertGT(compiledLibrary.length(), 0L, "Unexpected compiled library size");
|
||||
JaotcTestHelper.checkLibraryUsage(HelloWorldOne.class.getName());
|
||||
JaotcTestHelper.checkLibraryUsage(HelloWorldTwo.class.getName());
|
||||
}
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library / /test/lib /testlibrary
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.aot.cli.jaotc.CompileJarTest
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller compiler.aot.cli.jaotc.data.HelloWorldOne
|
||||
* compiler.aot.cli.jaotc.data.HelloWorldTwo
|
||||
* @run driver compiler.aot.cli.jaotc.CompileJarTest
|
||||
* @summary check jaotc can compile jar
|
||||
*/
|
||||
|
||||
package compiler.aot.cli.jaotc;
|
||||
|
||||
import compiler.aot.cli.jaotc.data.HelloWorldOne;
|
||||
import compiler.aot.cli.jaotc.data.HelloWorldTwo;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.JDKToolLauncher;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class CompileJarTest {
|
||||
private static final String JAR_NAME = "test.jar";
|
||||
|
||||
public static void main(String[] args) {
|
||||
createJar();
|
||||
OutputAnalyzer oa = JaotcTestHelper.compileLibrary("--jar", JAR_NAME);
|
||||
oa.shouldHaveExitValue(0);
|
||||
File compiledLibrary = new File(JaotcTestHelper.DEFAULT_LIB_PATH);
|
||||
Asserts.assertTrue(compiledLibrary.exists(), "Compiled library file missing");
|
||||
Asserts.assertGT(compiledLibrary.length(), 0L, "Unexpected compiled library size");
|
||||
JaotcTestHelper.checkLibraryUsage(HelloWorldOne.class.getName());
|
||||
JaotcTestHelper.checkLibraryUsage(HelloWorldTwo.class.getName());
|
||||
}
|
||||
|
||||
private static void createJar() {
|
||||
JDKToolLauncher jar = JDKToolLauncher.create("jar")
|
||||
.addToolArg("-cf")
|
||||
.addToolArg(JAR_NAME)
|
||||
.addToolArg("-C")
|
||||
.addToolArg(".")
|
||||
.addToolArg(".");
|
||||
OutputAnalyzer oa;
|
||||
try {
|
||||
oa = new OutputAnalyzer(new ProcessBuilder(jar.getCommand()).start());
|
||||
} catch (IOException e) {
|
||||
throw new Error("Problems launching jar: " + e, e);
|
||||
}
|
||||
oa.shouldHaveExitValue(0);
|
||||
}
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2017, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library / /test/lib /testlibrary
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @run driver compiler.aot.cli.jaotc.CompileModuleTest
|
||||
* @summary check jaotc can compile module
|
||||
*/
|
||||
|
||||
package compiler.aot.cli.jaotc;
|
||||
|
||||
import compiler.aot.cli.jaotc.data.HelloWorldTwo;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.Arrays;
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class CompileModuleTest {
|
||||
private static final String TESTED_CLASS_NAME = HelloWorldTwo.class.getName();
|
||||
private static final String STRING_LENGTH = String.class.getName() + ".length";
|
||||
private static final String COMPILE_COMMAND = "compileOnly " + STRING_LENGTH + ".*";
|
||||
private static final Path COMPILE_COMMAND_FILE = Paths.get("stringLengthOnly.list");
|
||||
private static final String[] EXPECTED = new String[]{
|
||||
JaotcTestHelper.DEFAULT_LIBRARY_LOAD_MESSAGE,
|
||||
STRING_LENGTH
|
||||
};
|
||||
private static final String[] UNEXPECTED = new String[]{
|
||||
TESTED_CLASS_NAME
|
||||
};
|
||||
|
||||
public static void main(String[] args) {
|
||||
// compile only java.lang.String::length from java.base module to have reasonable compilation time
|
||||
try {
|
||||
Files.write(COMPILE_COMMAND_FILE, Arrays.asList(COMPILE_COMMAND),
|
||||
StandardOpenOption.WRITE, StandardOpenOption.CREATE_NEW);
|
||||
} catch (IOException e) {
|
||||
throw new Error("TESTBUG: can't write list file " + e, e);
|
||||
}
|
||||
OutputAnalyzer oa = JaotcTestHelper.compileLibrary("--compile-commands",
|
||||
COMPILE_COMMAND_FILE.toString(), "--module", "java.base");
|
||||
oa.shouldHaveExitValue(0);
|
||||
File compiledLibrary = new File(JaotcTestHelper.DEFAULT_LIB_PATH);
|
||||
Asserts.assertTrue(compiledLibrary.exists(), "Compiled library file missing");
|
||||
Asserts.assertGT(compiledLibrary.length(), 0L, "Unexpected compiled library size");
|
||||
JaotcTestHelper.checkLibraryUsage(TESTED_CLASS_NAME, EXPECTED, UNEXPECTED);
|
||||
}
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 2020, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library / /test/lib /testlibrary
|
||||
* @compile IllegalClass.jasm
|
||||
* @run driver/timeout=360 compiler.aot.cli.jaotc.IgnoreErrorsTest
|
||||
*/
|
||||
|
||||
package compiler.aot.cli.jaotc;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class IgnoreErrorsTest {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
Files.write(Paths.get("Empty.class"), new byte[] { }, StandardOpenOption.CREATE_NEW);
|
||||
} catch (IOException e) {
|
||||
throw new Error("can't create empty class file", e);
|
||||
}
|
||||
File compiledLibrary = new File(JaotcTestHelper.DEFAULT_LIB_PATH);
|
||||
OutputAnalyzer oa;
|
||||
|
||||
System.out.println("Compiling empty class file w/o --ignore-errors");
|
||||
oa = JaotcTestHelper.compileLibrary(
|
||||
"--class-name", "Empty",
|
||||
"--class-name", "java.lang.Object");
|
||||
oa.shouldNotHaveExitValue(0);
|
||||
Asserts.assertTrue(!compiledLibrary.exists(), "Compiled library file exists");
|
||||
|
||||
System.out.println("Compiling empty class file w/ --ignore-errors");
|
||||
oa = JaotcTestHelper.compileLibrary(
|
||||
"--ignore-errors",
|
||||
"--class-name", "Empty",
|
||||
"--class-name", "java.lang.Object");
|
||||
oa.shouldHaveExitValue(0);
|
||||
Asserts.assertTrue(compiledLibrary.exists(), "Compiled library file is missed");
|
||||
JaotcTestHelper.checkLibraryUsage("-version");
|
||||
compiledLibrary.delete();
|
||||
|
||||
System.out.println("Compiling illegal class file w/o --ignore-errors");
|
||||
oa = JaotcTestHelper.compileLibrary(
|
||||
"--class-name", "IllegalClass",
|
||||
"--class-name", "java.lang.Object");
|
||||
oa.shouldNotHaveExitValue(0);
|
||||
Asserts.assertTrue(!compiledLibrary.exists(), "Compiled library file exists");
|
||||
|
||||
System.out.println("Compiling illegal class file w/ --ignore-errors");
|
||||
oa = JaotcTestHelper.compileLibrary(
|
||||
"--ignore-errors",
|
||||
"--class-name", "IllegalClass",
|
||||
"--class-name", "java.lang.Object");
|
||||
oa.shouldHaveExitValue(0);
|
||||
Asserts.assertTrue(compiledLibrary.exists(), "Compiled library file is missed");
|
||||
JaotcTestHelper.checkLibraryUsage("-version");
|
||||
compiledLibrary.delete();
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
super public class IllegalClass
|
||||
extends java/lang/String
|
||||
version 46:0
|
||||
{ }
|
|
@ -1,93 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2019, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package compiler.aot.cli.jaotc;
|
||||
|
||||
import compiler.aot.AotCompiler;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import jdk.test.lib.process.ExitCode;
|
||||
import jdk.test.lib.Platform;
|
||||
import jdk.test.lib.JDKToolLauncher;
|
||||
import jdk.test.lib.Utils;
|
||||
import jdk.test.lib.cli.CommandLineOptionTest;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
public class JaotcTestHelper {
|
||||
public static final String DEFAULT_LIB_PATH = "./unnamed." + Platform.sharedLibraryExt();
|
||||
public static final String DEFAULT_LIBRARY_LOAD_MESSAGE = "loaded " + DEFAULT_LIB_PATH
|
||||
+ " aot library";
|
||||
private static final String UNLOCK_EXPERIMENTAL_VM_OPTIONS = "-XX:+UnlockExperimentalVMOptions";
|
||||
private static final String ENABLE_AOT = "-XX:+UseAOT";
|
||||
private static final String AOT_LIBRARY = "-XX:AOTLibrary=" + DEFAULT_LIB_PATH;
|
||||
private static final String PRINT_AOT = "-XX:+PrintAOT";
|
||||
|
||||
public static OutputAnalyzer compileLibrary(String... args) {
|
||||
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jaotc");
|
||||
for (String vmOpt : Utils.getTestJavaOpts()) {
|
||||
launcher.addVMArg(vmOpt);
|
||||
}
|
||||
launcher.addToolArg("--compile-with-assertions");
|
||||
for (String arg : args) {
|
||||
launcher.addToolArg(arg);
|
||||
}
|
||||
String linker = AotCompiler.resolveLinker();
|
||||
if (linker != null) {
|
||||
launcher.addToolArg("--linker-path");
|
||||
launcher.addToolArg(linker);
|
||||
}
|
||||
String[] cmd = launcher.getCommand();
|
||||
try {
|
||||
return ProcessTools.executeCommand(cmd);
|
||||
} catch (Throwable e) {
|
||||
throw new Error("Can't start test process: " + e, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkLibraryUsage(String classToRun) {
|
||||
checkLibraryUsage(classToRun, new String[]{DEFAULT_LIBRARY_LOAD_MESSAGE}, null);
|
||||
}
|
||||
|
||||
public static void checkLibraryUsage(String classToRun, String[] expectedOutput,
|
||||
String[] unexpectedOutput) {
|
||||
try {
|
||||
CommandLineOptionTest.verifyJVMStartup(expectedOutput, unexpectedOutput,
|
||||
"Unexpected exit code", "Unexpected output", ExitCode.OK,
|
||||
/* addTestVMOpts */ true, UNLOCK_EXPERIMENTAL_VM_OPTIONS,
|
||||
ENABLE_AOT, AOT_LIBRARY, PRINT_AOT, classToRun);
|
||||
} catch (Throwable t) {
|
||||
throw new Error("Library usage verification failed: " + t, t);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getClassAotCompilationFilename(Class<?> classToCompile) {
|
||||
return classToCompile.getName().replaceAll("\\.","/") + ".class";
|
||||
}
|
||||
|
||||
public static String getClassAotCompilationName(Class<?> classToCompile) {
|
||||
return classToCompile.getName();
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library / /test/lib /testlibrary
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.aot.cli.jaotc.ListOptionNotExistingTest
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller compiler.aot.cli.jaotc.data.HelloWorldOne
|
||||
* @run driver compiler.aot.cli.jaotc.ListOptionNotExistingTest
|
||||
* @summary check jaotc can handle situation with missing --compile-commands file
|
||||
*/
|
||||
|
||||
package compiler.aot.cli.jaotc;
|
||||
|
||||
import compiler.aot.cli.jaotc.data.HelloWorldOne;
|
||||
import java.io.File;
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class ListOptionNotExistingTest {
|
||||
private static final String COMPILE_ITEM
|
||||
= JaotcTestHelper.getClassAotCompilationName(HelloWorldOne.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
OutputAnalyzer oa = JaotcTestHelper.compileLibrary("--compile-commands", "./notExisting.list",
|
||||
"--class-name", COMPILE_ITEM);
|
||||
int exitCode = oa.getExitValue();
|
||||
Asserts.assertNE(exitCode, 0, "Unexpected compilation exit code");
|
||||
File compiledLibrary = new File(JaotcTestHelper.DEFAULT_LIB_PATH);
|
||||
Asserts.assertFalse(compiledLibrary.exists(), "Compiler library unexpectedly exists");
|
||||
}
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library / /test/lib /testlibrary
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.aot.cli.jaotc.ListOptionTest
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller compiler.aot.cli.jaotc.data.HelloWorldOne
|
||||
* @run driver compiler.aot.cli.jaotc.ListOptionTest
|
||||
* @summary check jaotc can use --compile-commands option successfully and respective compileCommand is applied
|
||||
*/
|
||||
|
||||
package compiler.aot.cli.jaotc;
|
||||
|
||||
import compiler.aot.cli.jaotc.data.HelloWorldOne;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.Arrays;
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class ListOptionTest {
|
||||
private static final String TESTED_CLASS_NAME = HelloWorldOne.class.getName();
|
||||
private static final String HELLOWORLDONE_MAIN = TESTED_CLASS_NAME + ".main";
|
||||
private static final String COMPILE_COMMAND = "compileOnly " + HELLOWORLDONE_MAIN + ".*";
|
||||
private static final Path COMPILE_COMMAND_FILE = Paths.get("helloWorldMainMethodOnly.list");
|
||||
private static final String[] EXPECTED = new String[]{
|
||||
JaotcTestHelper.DEFAULT_LIBRARY_LOAD_MESSAGE,
|
||||
TESTED_CLASS_NAME + ".main"
|
||||
};
|
||||
private static final String[] UNEXPECTED = new String[]{
|
||||
TESTED_CLASS_NAME + ".<init>"
|
||||
};
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
Files.write(COMPILE_COMMAND_FILE, Arrays.asList(COMPILE_COMMAND),
|
||||
StandardOpenOption.WRITE, StandardOpenOption.CREATE_NEW);
|
||||
} catch (IOException e) {
|
||||
throw new Error("TESTBUG: can't write list file " + e, e);
|
||||
}
|
||||
OutputAnalyzer oa = JaotcTestHelper.compileLibrary("--compile-commands", COMPILE_COMMAND_FILE.toString(),
|
||||
"--class-name", JaotcTestHelper.getClassAotCompilationName(HelloWorldOne.class));
|
||||
oa.shouldHaveExitValue(0);
|
||||
File compiledLibrary = new File(JaotcTestHelper.DEFAULT_LIB_PATH);
|
||||
Asserts.assertTrue(compiledLibrary.exists(), "Compiled library file missing");
|
||||
Asserts.assertGT(compiledLibrary.length(), 0L, "Unexpected compiled library size");
|
||||
JaotcTestHelper.checkLibraryUsage(TESTED_CLASS_NAME, EXPECTED, UNEXPECTED);
|
||||
}
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library / /test/lib /testlibrary
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.aot.cli.jaotc.ListOptionWrongFileTest
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller compiler.aot.cli.jaotc.data.HelloWorldOne
|
||||
* @run driver compiler.aot.cli.jaotc.ListOptionWrongFileTest
|
||||
* @summary check jaotc can handle incorrect --compile-commands file
|
||||
*/
|
||||
|
||||
package compiler.aot.cli.jaotc;
|
||||
|
||||
import compiler.aot.cli.jaotc.data.HelloWorldOne;
|
||||
import java.io.File;
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class ListOptionWrongFileTest {
|
||||
private static final String TESTED_CLASS_NAME = HelloWorldOne.class.getName();
|
||||
private static final String[] EXPECTED = new String[]{
|
||||
JaotcTestHelper.DEFAULT_LIBRARY_LOAD_MESSAGE,
|
||||
TESTED_CLASS_NAME
|
||||
};
|
||||
|
||||
private static final String COMPILE_ITEM
|
||||
= JaotcTestHelper.getClassAotCompilationName(HelloWorldOne.class);
|
||||
|
||||
private static final String COMPILE_FILE
|
||||
= JaotcTestHelper.getClassAotCompilationFilename(HelloWorldOne.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
// expecting wrong file to be read but no compilation directive recognized, so, all compiled
|
||||
OutputAnalyzer oa = JaotcTestHelper.compileLibrary("--compile-commands", COMPILE_FILE, "--class-name", COMPILE_ITEM);
|
||||
oa.shouldHaveExitValue(0);
|
||||
File compiledLibrary = new File(JaotcTestHelper.DEFAULT_LIB_PATH);
|
||||
Asserts.assertTrue(compiledLibrary.exists(), "Expected compiler library to exist");
|
||||
JaotcTestHelper.checkLibraryUsage(HelloWorldOne.class.getName(), EXPECTED, null);
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package compiler.aot.cli.jaotc.data;
|
||||
|
||||
public class HelloWorldOne {
|
||||
public static final String MESSAGE = "HelloWorld1";
|
||||
|
||||
public static void main(String args[]) {
|
||||
System.out.println(MESSAGE);
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package compiler.aot.cli.jaotc.data;
|
||||
|
||||
public class HelloWorldTwo {
|
||||
public static final String MESSAGE = "HelloWorld2";
|
||||
|
||||
public static void main(String args[]) {
|
||||
System.out.println(MESSAGE);
|
||||
System.out.println("Message length = " + MESSAGE.length());
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2018, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package compiler.aot.fingerprint;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.PrintStream;
|
||||
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
// Usage:
|
||||
// java CDSDumper <classpath> <classlist> <archive> <heapsize> <class1> <class2> ...
|
||||
public class CDSDumper {
|
||||
public static void main(String[] args) throws Exception {
|
||||
String classpath = args[0];
|
||||
String classlist = args[1];
|
||||
String archive = args[2];
|
||||
String heapsize = args[3];
|
||||
|
||||
// Prepare the classlist
|
||||
FileOutputStream fos = new FileOutputStream(classlist);
|
||||
PrintStream ps = new PrintStream(fos);
|
||||
|
||||
for (int i=4; i<args.length; i++) {
|
||||
ps.println(args[i].replace('.', '/'));
|
||||
}
|
||||
ps.close();
|
||||
fos.close();
|
||||
|
||||
// Dump the archive
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
heapsize,
|
||||
"-XX:+IgnoreUnrecognizedVMOptions",
|
||||
"-cp", classpath,
|
||||
"-XX:ExtraSharedClassListFile=" + classlist,
|
||||
"-XX:SharedArchiveFile=" + archive,
|
||||
"-Xshare:dump",
|
||||
"-Xlog:gc+heap+coops",
|
||||
"-Xlog:cds");
|
||||
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
System.out.println("[stdout = " + output.getStdout() + "]");
|
||||
System.out.println("[stderr = " + output.getStderr() + "]");
|
||||
output.shouldContain("Loading classes to share");
|
||||
output.shouldHaveExitValue(0);
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2018, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package compiler.aot.fingerprint;
|
||||
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
// Usage:
|
||||
// java CDSRunner <vmargs> <class> <args> ...
|
||||
public class CDSRunner {
|
||||
public static void main(String[] args) throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
|
||||
System.out.println("[stdout = " + output.getStdout() + "]");
|
||||
System.out.println("[stderr = " + output.getStderr() + "]");
|
||||
|
||||
output.shouldContain("PASSED");
|
||||
output.shouldHaveExitValue(0);
|
||||
}
|
||||
}
|
|
@ -1,132 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2019, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary AOT methods should be swept if a super class has changed.
|
||||
* @library /test/lib /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
* @requires vm.aot
|
||||
* @build compiler.aot.fingerprint.SelfChanged
|
||||
* compiler.aot.AotCompiler
|
||||
*
|
||||
* @run main
|
||||
* compiler.aot.fingerprint.SelfChanged WRITE-UNMODIFIED-CLASS
|
||||
* @run driver compiler.aot.AotCompiler -libname libSelfChanged.so
|
||||
* -class compiler.aot.fingerprint.Blah
|
||||
*
|
||||
* @run main/othervm
|
||||
* compiler.aot.fingerprint.SelfChanged TEST-UNMODIFIED
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseAOT -XX:+PrintAOT
|
||||
* -XX:AOTLibrary=./libSelfChanged.so
|
||||
* -Xlog:aot+class+fingerprint=trace -Xlog:aot+class+load=trace
|
||||
* compiler.aot.fingerprint.SelfChanged TEST-UNMODIFIED
|
||||
*
|
||||
* @run main
|
||||
* compiler.aot.fingerprint.SelfChanged WRITE-MODIFIED-CLASS
|
||||
* @run main
|
||||
* compiler.aot.fingerprint.SelfChanged TEST-MODIFIED
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseAOT -XX:+PrintAOT
|
||||
* -XX:AOTLibrary=./libSelfChanged.so
|
||||
* -Xlog:aot+class+fingerprint=trace -Xlog:aot+class+load=trace
|
||||
* compiler.aot.fingerprint.SelfChanged TEST-MODIFIED
|
||||
*/
|
||||
|
||||
package compiler.aot.fingerprint;
|
||||
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.compiler.InMemoryJavaCompiler;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
class Blah {
|
||||
volatile int z;
|
||||
int getX() {
|
||||
for (z = 0; z < 10000; z++) {
|
||||
if (z % 7 == 1) {
|
||||
z += 2;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class SelfChanged {
|
||||
public static void main(String args[]) throws Throwable {
|
||||
Blah f = new Blah();
|
||||
System.out.println("f.getX = " + f.getX());
|
||||
switch (args[0]) {
|
||||
case "WRITE-UNMODIFIED-CLASS":
|
||||
compileClass(false);
|
||||
break;
|
||||
case "WRITE-MODIFIED-CLASS":
|
||||
compileClass(true);
|
||||
break;
|
||||
case "TEST-UNMODIFIED":
|
||||
Asserts.assertTrue(f.getX() == 0, "getX from unmodified Blah class should return 0");
|
||||
break;
|
||||
case "TEST-MODIFIED":
|
||||
Asserts.assertTrue(f.getX() == 1, "getX from modified Blah class should return 1");
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("unexpected option: " + args[0]);
|
||||
}
|
||||
}
|
||||
|
||||
static void compileClass(boolean isModified) throws Throwable {
|
||||
String src =
|
||||
"package compiler.aot.fingerprint;"
|
||||
+ "public class Blah {"
|
||||
+ " volatile int z;"
|
||||
+ " int getX() {"
|
||||
+ " for (z = 0; z < 10000; z++) {"
|
||||
+ " if (z % 7 == 1) {"
|
||||
+ " z += 2;"
|
||||
+ " }"
|
||||
+ " }"
|
||||
+ " return " + ((isModified) ? "1" : "0") + ";"
|
||||
+ " }"
|
||||
+ " int getY() {return 255;}"
|
||||
|
||||
// The following is for the SelfChangedCDS.java test case. We always load an unmodified
|
||||
// version of Blah from the CDS archive. However, we would load an AOT library that
|
||||
// was compiled using a modified version of Blah. The getX method in this AOT library should
|
||||
// not be used.
|
||||
|
||||
+ " public static void main(String args[]) {"
|
||||
+ " Blah b = new Blah();"
|
||||
+ " int n = b.getX();"
|
||||
+ " if (n != 0) {"
|
||||
+ " throw new RuntimeException(args[0] + \" : \" + n);"
|
||||
+ " }"
|
||||
+ " System.out.println(\"PASSED\");"
|
||||
+ " }"
|
||||
+ "}";
|
||||
|
||||
String filename = System.getProperty("test.classes") + "/compiler/aot/fingerprint/Blah.class";
|
||||
FileOutputStream fos = new FileOutputStream(filename);
|
||||
fos.write(InMemoryJavaCompiler.compile("compiler.aot.fingerprint.Blah", src));
|
||||
fos.close();
|
||||
}
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary AOT methods should be swept if a super class has changed (with CDS).
|
||||
* @library /test/lib /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
* @requires vm.aot & vm.cds
|
||||
* @build compiler.aot.fingerprint.SelfChanged
|
||||
* sun.hotspot.WhiteBox
|
||||
*
|
||||
* @run driver compiler.aot.fingerprint.SelfChanged WRITE-UNMODIFIED-CLASS
|
||||
* @run driver compiler.aot.AotCompiler -libname libSelfChanged.so
|
||||
* -class compiler.aot.fingerprint.Blah
|
||||
*
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller -jar SelfChangedCDS.jar compiler.aot.fingerprint.Blah
|
||||
* @run driver compiler.aot.fingerprint.CDSDumper SelfChangedCDS.jar SelfChangedCDS.classlist SelfChangedCDS.jsa -showversion
|
||||
* compiler.aot.fingerprint.Blah
|
||||
*
|
||||
* @run driver compiler.aot.fingerprint.CDSRunner -cp SelfChangedCDS.jar
|
||||
* compiler.aot.fingerprint.Blah TEST-UNMODIFIED
|
||||
* @run driver compiler.aot.fingerprint.CDSRunner -cp SelfChangedCDS.jar
|
||||
* -XX:+UnlockExperimentalVMOptions -XX:+UseAOT -XX:+PrintAOT
|
||||
* -XX:AOTLibrary=./libSelfChanged.so
|
||||
* -XX:SharedArchiveFile=SelfChangedCDS.jsa
|
||||
* -XX:+IgnoreUnrecognizedVMOptions
|
||||
* -Xshare:auto -showversion
|
||||
* -Xlog:cds -Xlog:gc+heap+coops
|
||||
* -Xlog:aot+class+fingerprint=trace -Xlog:aot+class+load=trace
|
||||
* compiler.aot.fingerprint.Blah TEST-UNMODIFIED
|
||||
*
|
||||
* @run driver
|
||||
* compiler.aot.fingerprint.SelfChanged WRITE-MODIFIED-CLASS
|
||||
* @run driver compiler.aot.AotCompiler -libname libSelfChanged.so
|
||||
* -class compiler.aot.fingerprint.Blah
|
||||
*
|
||||
* @run driver compiler.aot.fingerprint.CDSRunner -cp SelfChangedCDS.jar
|
||||
* compiler.aot.fingerprint.Blah TEST-MODIFIED
|
||||
* @run driver compiler.aot.fingerprint.CDSRunner -cp SelfChangedCDS.jar
|
||||
* -XX:+UnlockExperimentalVMOptions -XX:+UseAOT -XX:+PrintAOT
|
||||
* -XX:AOTLibrary=./libSelfChanged.so
|
||||
* -XX:SharedArchiveFile=SelfChangedCDS.jsa
|
||||
* -XX:+IgnoreUnrecognizedVMOptions
|
||||
* -Xshare:auto -showversion
|
||||
* -Xlog:cds -Xlog:gc+heap+coops
|
||||
* -Xlog:aot+class+fingerprint=trace -Xlog:aot+class+load=trace
|
||||
* compiler.aot.fingerprint.Blah TEST-MODIFIED
|
||||
*
|
||||
*
|
||||
* @run driver compiler.aot.AotCompiler -libname libSelfChanged.so
|
||||
* -class compiler.aot.fingerprint.Blah
|
||||
* -extraopt -Xmx512m
|
||||
*
|
||||
* @run driver compiler.aot.fingerprint.CDSDumper SelfChangedCDS.jar SelfChangedCDS.classlist SelfChangedCDS.jsa -Xmx512m
|
||||
* compiler.aot.fingerprint.Blah
|
||||
*
|
||||
* @run driver compiler.aot.fingerprint.CDSRunner -Xmx512m -cp SelfChangedCDS.jar
|
||||
* compiler.aot.fingerprint.Blah TEST-UNMODIFIED
|
||||
* @run driver compiler.aot.fingerprint.CDSRunner -Xmx512m -cp SelfChangedCDS.jar
|
||||
* -XX:+UnlockExperimentalVMOptions -XX:+UseAOT -XX:+PrintAOT
|
||||
* -XX:AOTLibrary=./libSelfChanged.so
|
||||
* -XX:SharedArchiveFile=SelfChangedCDS.jsa
|
||||
* -XX:+IgnoreUnrecognizedVMOptions
|
||||
* -Xshare:auto -showversion
|
||||
* -Xlog:cds -Xlog:gc+heap+coops
|
||||
* -Xlog:aot+class+fingerprint=trace -Xlog:aot+class+load=trace
|
||||
* compiler.aot.fingerprint.Blah TEST-UNMODIFIED
|
||||
*/
|
|
@ -1,113 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2019, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary AOT methods should be swept if a super class has changed.
|
||||
* @library /test/lib /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
* @requires vm.aot
|
||||
* @build compiler.aot.fingerprint.SuperChanged
|
||||
* compiler.aot.AotCompiler
|
||||
*
|
||||
* @run main
|
||||
* compiler.aot.fingerprint.SuperChanged WRITE-UNMODIFIED-CLASS
|
||||
* @run driver compiler.aot.AotCompiler -libname libSuperChanged.so
|
||||
* -class compiler.aot.fingerprint.Foo
|
||||
*
|
||||
* @run main
|
||||
* compiler.aot.fingerprint.SuperChanged TEST-UNMODIFIED
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseAOT -XX:+PrintAOT
|
||||
* -XX:AOTLibrary=./libSuperChanged.so
|
||||
* -Xlog:aot+class+fingerprint=trace -Xlog:aot+class+load=trace
|
||||
* compiler.aot.fingerprint.SuperChanged TEST-UNMODIFIED
|
||||
*
|
||||
* @run main
|
||||
* compiler.aot.fingerprint.SuperChanged WRITE-MODIFIED-CLASS
|
||||
* @run main
|
||||
* compiler.aot.fingerprint.SuperChanged TEST-MODIFIED
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseAOT -XX:+PrintAOT
|
||||
* -XX:AOTLibrary=./libSuperChanged.so
|
||||
* -Xlog:aot+class+fingerprint=trace -Xlog:aot+class+load=trace
|
||||
* compiler.aot.fingerprint.SuperChanged TEST-MODIFIED
|
||||
*/
|
||||
|
||||
package compiler.aot.fingerprint;
|
||||
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.compiler.InMemoryJavaCompiler;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
class Bar {
|
||||
volatile int x = 0;
|
||||
volatile int y = 1;
|
||||
}
|
||||
|
||||
class Foo extends Bar {
|
||||
|
||||
volatile int z;
|
||||
int getX() {
|
||||
for (z = 0; z < 10000; z++) {
|
||||
if (z % 7 == 1) {
|
||||
z += 2;
|
||||
}
|
||||
}
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
public class SuperChanged {
|
||||
public static void main(String args[]) throws Throwable {
|
||||
Foo f = new Foo();
|
||||
System.out.println("f.getX = " + f.getX());
|
||||
switch (args[0]) {
|
||||
case "WRITE-UNMODIFIED-CLASS":
|
||||
compileClass(false);
|
||||
break;
|
||||
case "WRITE-MODIFIED-CLASS":
|
||||
compileClass(true);
|
||||
break;
|
||||
case "TEST-UNMODIFIED":
|
||||
Asserts.assertTrue(f.getX() == 0, "getX from unmodified Foo class should return 0");
|
||||
break;
|
||||
case "TEST-MODIFIED":
|
||||
Asserts.assertTrue(f.getX() == 1, "getX from modified Foo class should return 1");
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("unexpected option: " + args[0]);
|
||||
}
|
||||
}
|
||||
|
||||
static void compileClass(boolean isModified) throws Throwable {
|
||||
String class_src_0 = "package compiler.aot.fingerprint; class Bar {volatile int x = 0; volatile int y = 1;}";
|
||||
String class_src_1 = "package compiler.aot.fingerprint; class Bar {volatile int y = 0; volatile int x = 1;}";
|
||||
String src = (isModified) ? class_src_1 : class_src_0;
|
||||
|
||||
String filename = System.getProperty("test.classes") + "/compiler/aot/fingerprint/Bar.class";
|
||||
FileOutputStream fos = new FileOutputStream(filename);
|
||||
fos.write(InMemoryJavaCompiler.compile("compiler.aot.fingerprint.Bar", src));
|
||||
fos.close();
|
||||
}
|
||||
}
|
|
@ -1,131 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2017, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @modules jdk.aot/jdk.tools.jaotc.utils
|
||||
* @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.tools.jaotc.test.NativeOrderOutputStreamTest
|
||||
*/
|
||||
|
||||
package jdk.tools.jaotc.test;
|
||||
|
||||
import jdk.tools.jaotc.utils.NativeOrderOutputStream;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
public class NativeOrderOutputStreamTest {
|
||||
|
||||
private NativeOrderOutputStream target;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
target = new NativeOrderOutputStream();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldAdd4BytesForInt() {
|
||||
target.putInt(5);
|
||||
Assert.assertEquals(4, target.position());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldAdd8BytesForLong() {
|
||||
target.putLong(8);
|
||||
Assert.assertEquals(8, target.position());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldHaveCorrectSizeBeforePatch() {
|
||||
target.patchableInt();
|
||||
Assert.assertEquals(4, target.position());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldHaveCorrectSizeAfterPatch() {
|
||||
NativeOrderOutputStream.PatchableInt patchableInt = target.patchableInt();
|
||||
patchableInt.set(12);
|
||||
Assert.assertEquals(4, target.position());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldSetCorrectValueInPatch() {
|
||||
NativeOrderOutputStream.PatchableInt patchableInt = target.patchableInt();
|
||||
patchableInt.set(42);
|
||||
Assert.assertEquals(42, getInt(0));
|
||||
}
|
||||
|
||||
private int getInt(int pos) {
|
||||
ByteBuffer buffer = ByteBuffer.wrap(target.array());
|
||||
buffer.order(ByteOrder.nativeOrder());
|
||||
return buffer.getInt(pos);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldPutArrayCorrectly() {
|
||||
target.put(new byte[]{42, 5, 43, 44});
|
||||
Assert.assertEquals(4, target.position());
|
||||
Assert.assertEquals(42, target.array()[0]);
|
||||
Assert.assertEquals(4, target.position());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldOnlyPatchSlot() {
|
||||
NativeOrderOutputStream.PatchableInt patchableInt = target.patchableInt();
|
||||
target.putInt(7);
|
||||
patchableInt.set(39);
|
||||
Assert.assertEquals(39, getInt(0));
|
||||
Assert.assertEquals(7, getInt(4));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldBeAbleToPatchAnywhere() {
|
||||
target.putInt(19);
|
||||
NativeOrderOutputStream.PatchableInt patchableInt = target.patchableInt();
|
||||
patchableInt.set(242);
|
||||
|
||||
Assert.assertEquals(19, getInt(0));
|
||||
Assert.assertEquals(242, getInt(4));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldHavePatchableAtRightOffset() {
|
||||
target.putInt(27);
|
||||
Assert.assertEquals(4, target.position());
|
||||
NativeOrderOutputStream.PatchableInt patchableInt = target.patchableInt();
|
||||
Assert.assertEquals(4, patchableInt.position());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldAlign() {
|
||||
target.putInt(9);
|
||||
target.align(16);
|
||||
target.put(new byte[]{3});
|
||||
target.align(8);
|
||||
Assert.assertEquals(24, target.position());
|
||||
}
|
||||
}
|
|
@ -1,211 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2017, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @modules jdk.aot/jdk.tools.jaotc
|
||||
* jdk.aot/jdk.tools.jaotc.collect
|
||||
* @run junit/othervm jdk.tools.jaotc.test.collect.ClassSearchTest
|
||||
*/
|
||||
|
||||
package jdk.tools.jaotc.test.collect;
|
||||
|
||||
|
||||
import jdk.tools.jaotc.LoadedClass;
|
||||
import jdk.tools.jaotc.collect.*;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
public class ClassSearchTest {
|
||||
@Test(expected = InternalError.class)
|
||||
public void itShouldThrowExceptionIfNoProvidersAvailable() {
|
||||
ClassSearch target = new ClassSearch();
|
||||
SearchPath searchPath = new SearchPath();
|
||||
target.search(list(new SearchFor("foo")), searchPath);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldFindAProviderForEachEntry() {
|
||||
Set<String> searched = new HashSet<>();
|
||||
ClassSearch target = new ClassSearch();
|
||||
target.addProvider(provider("", (name, searchPath) -> {
|
||||
searched.add(name);
|
||||
return new NoopSource();
|
||||
}));
|
||||
target.search(searchForList("foo", "bar", "foobar"), null);
|
||||
Assert.assertEquals(hashset("foo", "bar", "foobar"), searched);
|
||||
}
|
||||
|
||||
private SourceProvider provider(String supports, BiFunction<String, SearchPath, ClassSource> fn) {
|
||||
return new SourceProvider() {
|
||||
@Override
|
||||
public ClassSource findSource(String name, SearchPath searchPath) {
|
||||
return fn.apply(name, searchPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(String type) {
|
||||
return supports.equals(type);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldOnlySearchSupportedProvidersForKnownType() {
|
||||
Set<String> visited = new HashSet<>();
|
||||
ClassSearch target = new ClassSearch();
|
||||
|
||||
target.addProvider(provider("jar", (name, searchPath) -> {
|
||||
visited.add("jar");
|
||||
return null;
|
||||
}));
|
||||
|
||||
target.addProvider(provider("dir", (name, searchPath) -> {
|
||||
visited.add("dir");
|
||||
return null;
|
||||
}));
|
||||
|
||||
try {
|
||||
target.search(list(new SearchFor("some", "dir")), null);
|
||||
} catch (InternalError e) {
|
||||
// throws because no provider gives a source
|
||||
}
|
||||
|
||||
Assert.assertEquals(hashset("dir"), visited);
|
||||
}
|
||||
|
||||
@Test(expected = InternalError.class)
|
||||
public void itShouldThrowErrorIfMultipleSourcesAreAvailable() {
|
||||
ClassSearch target = new ClassSearch();
|
||||
target.addProvider(provider("", (name, searchPath) -> consumer -> Assert.fail()));
|
||||
target.addProvider(provider("", (name, searchPath) -> consumer -> Assert.fail()));
|
||||
|
||||
target.search(searchForList("somethign"), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldSearchAllProvidersForUnknownType() {
|
||||
Set<String> visited = new HashSet<>();
|
||||
ClassSearch target = new ClassSearch();
|
||||
target.addProvider(provider("", (name, searchPath) -> {
|
||||
visited.add("1");
|
||||
return null;
|
||||
}));
|
||||
target.addProvider(provider("", (name, searchPath) -> {
|
||||
visited.add("2");
|
||||
return null;
|
||||
}));
|
||||
|
||||
try {
|
||||
target.search(searchForList("foo"), null);
|
||||
} catch (InternalError e) {
|
||||
// throws because no provider gives a source
|
||||
}
|
||||
|
||||
Assert.assertEquals(hashset("1", "2"), visited);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldTryToLoadSaidClassFromClassLoader() {
|
||||
Set<String> loaded = new HashSet<>();
|
||||
|
||||
ClassSearch target = new ClassSearch();
|
||||
target.addProvider(new SourceProvider() {
|
||||
@Override
|
||||
public boolean supports(String type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassSource findSource(String name, SearchPath searchPath) {
|
||||
return new ClassSource() {
|
||||
@Override
|
||||
public void eachClass(BiConsumer<String, ClassLoader> consumer) {
|
||||
consumer.accept("foo.Bar", new ClassLoader() {
|
||||
@Override
|
||||
public Class<?> loadClass(String name) throws ClassNotFoundException {
|
||||
loaded.add(name);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
java.util.List<LoadedClass> search = target.search(searchForList("/tmp/something"), null);
|
||||
Assert.assertEquals(list(new LoadedClass("foo.Bar", null)), search);
|
||||
}
|
||||
|
||||
@Test(expected = InternalError.class)
|
||||
public void itShouldThrowInternalErrorWhenClassLoaderFails() {
|
||||
ClassLoader classLoader = new ClassLoader() {
|
||||
@Override
|
||||
public Class<?> loadClass(String name1) throws ClassNotFoundException {
|
||||
throw new ClassNotFoundException("failed to find " + name1);
|
||||
}
|
||||
};
|
||||
|
||||
ClassSearch target = new ClassSearch();
|
||||
target.addProvider(provider("", (name, searchPath) -> consumer -> consumer.accept("foo.Bar", classLoader)));
|
||||
target.search(searchForList("foobar"), null);
|
||||
}
|
||||
|
||||
private List<SearchFor> searchForList(String... entries) {
|
||||
List<SearchFor> list = new ArrayList<>();
|
||||
for (String entry : entries) {
|
||||
list.add(new SearchFor(entry));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private <T> List<T> list(T... entries) {
|
||||
List<T> list = new ArrayList<T>();
|
||||
for (T entry : entries) {
|
||||
list.add(entry);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private <T> Set<T> hashset(T... entries) {
|
||||
Set<T> set = new HashSet<T>();
|
||||
for (T entry : entries) {
|
||||
set.add(entry);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
private static class NoopSource implements ClassSource {
|
||||
@Override
|
||||
public void eachClass(BiConsumer<String, ClassLoader> consumer) {
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2017, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @modules jdk.aot/jdk.tools.jaotc
|
||||
* jdk.aot/jdk.tools.jaotc.collect
|
||||
* @build jdk.tools.jaotc.test.collect.Utils
|
||||
* @run junit/othervm jdk.tools.jaotc.test.collect.ClassSourceTest
|
||||
*/
|
||||
|
||||
package jdk.tools.jaotc.test.collect;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import static jdk.tools.jaotc.collect.ClassSource.makeClassName;
|
||||
|
||||
import static jdk.tools.jaotc.test.collect.Utils.getpath;
|
||||
|
||||
public class ClassSourceTest {
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void itShouldThrowExceptionIfPathDoesntEndWithClass() {
|
||||
makeClassName(Paths.get("Bar.clazz"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldReplaceSlashesWithDots() {
|
||||
Assert.assertEquals("foo.Bar", makeClassName(getpath("foo/Bar.class")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldStripLeadingSlash() {
|
||||
Assert.assertEquals("Hello", makeClassName(getpath("/Hello.class")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldReplaceMultipleDots() {
|
||||
Assert.assertEquals("some.foo.bar.FooBar", makeClassName(getpath("/some/foo/bar/FooBar.class")));
|
||||
}
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2017, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.tools.jaotc.test.collect;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.tools.jaotc.collect.FileSupport;
|
||||
|
||||
public class FakeFileSupport extends FileSupport {
|
||||
private final Set<String> exists = new HashSet<>();
|
||||
private final Set<String> directories = new HashSet<>();
|
||||
|
||||
private final Set<String> checkedExists = new HashSet<>();
|
||||
private final Set<String> checkedDirectory = new HashSet<>();
|
||||
private final Set<String> checkedJarFileSystemRoots = new HashSet<>();
|
||||
private final Set<String> classloaderPaths = new HashSet<>();
|
||||
|
||||
private Path jarFileSystemRoot = null;
|
||||
private final ClassLoader classLoader;
|
||||
|
||||
public FakeFileSupport(Set<String> existing, Set<String> directories) {
|
||||
this.exists.addAll(existing);
|
||||
this.directories.addAll(directories);
|
||||
|
||||
classLoader = new ClassLoader() {
|
||||
@Override
|
||||
public Class<?> loadClass(String name) throws ClassNotFoundException {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void setJarFileSystemRoot(Path path) {
|
||||
jarFileSystemRoot = path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists(Path path) {
|
||||
checkedExists.add(path.toString());
|
||||
return exists.contains(path.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDirectory(Path path) {
|
||||
checkedDirectory.add(path.toString());
|
||||
return directories.contains(path.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassLoader createClassLoader(Path path) throws MalformedURLException {
|
||||
classloaderPaths.add(path.toString());
|
||||
return classLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path getJarFileSystemRoot(Path jarFile) {
|
||||
checkedJarFileSystemRoots.add(jarFile.toString());
|
||||
return jarFileSystemRoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAbsolute(Path entry) {
|
||||
return entry.toString().startsWith("/");
|
||||
}
|
||||
|
||||
public void addExist(String name) {
|
||||
exists.add(name);
|
||||
}
|
||||
|
||||
public void addDirectory(String name) {
|
||||
directories.add(name);
|
||||
}
|
||||
|
||||
public Set<String> getCheckedExists() {
|
||||
return checkedExists;
|
||||
}
|
||||
|
||||
public Set<String> getCheckedDirectory() {
|
||||
return checkedDirectory;
|
||||
}
|
||||
|
||||
public Set<String> getCheckedJarFileSystemRoots() {
|
||||
return checkedJarFileSystemRoots;
|
||||
}
|
||||
|
||||
public Set<String> getClassloaderPaths() {
|
||||
return classloaderPaths;
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2017, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.tools.jaotc.test.collect;
|
||||
|
||||
import jdk.tools.jaotc.collect.SearchPath;
|
||||
|
||||
import java.nio.file.FileSystem;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Set;
|
||||
|
||||
import static jdk.tools.jaotc.test.collect.Utils.set;
|
||||
|
||||
public class FakeSearchPath extends SearchPath {
|
||||
private Path path = null;
|
||||
public Set<String> entries = set();
|
||||
|
||||
public FakeSearchPath(String name) {
|
||||
if (name != null) {
|
||||
path = Paths.get(name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path find(FileSystem fileSystem, Path entry, String... defaults) {
|
||||
entries.add(entry.toString());
|
||||
return path;
|
||||
}
|
||||
}
|
|
@ -1,118 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2017, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @modules jdk.aot/jdk.tools.jaotc
|
||||
* jdk.aot/jdk.tools.jaotc.collect
|
||||
*
|
||||
* @build jdk.tools.jaotc.test.collect.Utils
|
||||
* @build jdk.tools.jaotc.test.collect.FakeFileSupport
|
||||
* @run junit/othervm jdk.tools.jaotc.test.collect.SearchPathTest
|
||||
*/
|
||||
|
||||
package jdk.tools.jaotc.test.collect;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.nio.file.FileSystem;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import jdk.tools.jaotc.collect.*;
|
||||
|
||||
import static jdk.tools.jaotc.test.collect.Utils.set;
|
||||
import static jdk.tools.jaotc.test.collect.Utils.mkpath;
|
||||
import static jdk.tools.jaotc.test.collect.Utils.mkpaths;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class SearchPathTest {
|
||||
private FakeFileSupport fileSupport;
|
||||
private FileSystem fs;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
fs = FileSystems.getDefault();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldUsePathIfPathIsAbsoluteAndExisting() {
|
||||
fileSupport = new FakeFileSupport(mkpaths("/foo"), set());
|
||||
SearchPath target = new SearchPath(fileSupport);
|
||||
Path foo = Paths.get(mkpath("/foo"));
|
||||
Path result = target.find(fs, foo);
|
||||
assertSame(result, foo);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldReturnNullIfPathIsAbsoluteAndNonExisting() {
|
||||
fileSupport = new FakeFileSupport(set(), set());
|
||||
SearchPath target = new SearchPath(fileSupport);
|
||||
Path result = target.find(fs, Paths.get(mkpath("/bar")));
|
||||
assertNull(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldUseRelativeExisting() {
|
||||
fileSupport = new FakeFileSupport(mkpaths("hello", "tmp/hello", "search/hello"), set());
|
||||
SearchPath target = new SearchPath(fileSupport);
|
||||
target.add("search");
|
||||
Path hello = Paths.get("hello");
|
||||
Path result = target.find(fs, hello, "tmp");
|
||||
assertSame(result, hello);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldSearchDefaultsBeforeSearchPaths() {
|
||||
fileSupport = new FakeFileSupport(mkpaths("bar/foobar"), set());
|
||||
SearchPath target = new SearchPath(fileSupport);
|
||||
Path result = target.find(fs, Paths.get("foobar"), "default1", "bar");
|
||||
assertEquals(mkpath("bar/foobar"), result.toString());
|
||||
assertEquals(mkpaths("foobar", "default1/foobar", "bar/foobar"), fileSupport.getCheckedExists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldUseSearchPathsIfNotInDefaults() {
|
||||
fileSupport = new FakeFileSupport(mkpaths("bar/tmp/foobar"), set());
|
||||
SearchPath target = new SearchPath(fileSupport);
|
||||
target.add("foo/tmp", "bar/tmp");
|
||||
|
||||
Path result = target.find(fs, Paths.get("foobar"), "foo", "bar");
|
||||
assertEquals(mkpath("bar/tmp/foobar"), result.toString());
|
||||
assertEquals(mkpaths("foobar", "foo/foobar", "bar/foobar", "bar/tmp/foobar", "foo/tmp/foobar"), fileSupport.getCheckedExists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldReturnNullIfNoExistingPathIsFound() {
|
||||
fileSupport = new FakeFileSupport(set(), set());
|
||||
SearchPath target = new SearchPath(fileSupport);
|
||||
target.add("dir1", "dir2");
|
||||
|
||||
Path result = target.find(fs, Paths.get("entry"), "dir3", "dir4");
|
||||
assertNull(result);
|
||||
assertEquals(mkpaths("entry", "dir1/entry", "dir2/entry", "dir3/entry", "dir4/entry"), fileSupport.getCheckedExists());
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2017, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.tools.jaotc.test.collect;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class Utils {
|
||||
public static <T> Set<T> set(T... entries) {
|
||||
Set<T> set = new HashSet<T>();
|
||||
for (T entry : entries) {
|
||||
set.add(entry);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
public static String mkpath(String path) {
|
||||
return getpath(path).toString();
|
||||
}
|
||||
|
||||
public static Set<String> mkpaths(String... paths) {
|
||||
Set<String> set = new HashSet<String>();
|
||||
for (String entry : paths) {
|
||||
set.add(mkpath(entry));
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
public static Path getpath(String path) {
|
||||
if (path.startsWith("/") && System.getProperty("os.name").startsWith("Windows")) {
|
||||
path = new File(path).getAbsolutePath();
|
||||
}
|
||||
return Paths.get(path);
|
||||
}
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2017, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @modules jdk.aot/jdk.tools.jaotc
|
||||
* jdk.aot/jdk.tools.jaotc.collect
|
||||
* jdk.aot/jdk.tools.jaotc.collect.directory
|
||||
* @compile ../Utils.java
|
||||
* @compile ../FakeFileSupport.java
|
||||
* @run junit/othervm jdk.tools.jaotc.test.collect.directory.DirectorySourceProviderTest
|
||||
*/
|
||||
|
||||
package jdk.tools.jaotc.test.collect.directory;
|
||||
|
||||
import jdk.tools.jaotc.collect.ClassSource;
|
||||
import jdk.tools.jaotc.collect.directory.DirectorySourceProvider;
|
||||
import jdk.tools.jaotc.test.collect.FakeFileSupport;
|
||||
import jdk.tools.jaotc.collect.FileSupport;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Set;
|
||||
|
||||
import static jdk.tools.jaotc.test.collect.Utils.set;
|
||||
|
||||
public class DirectorySourceProviderTest {
|
||||
@Test
|
||||
public void itShouldReturnNullForNonExistantPath() {
|
||||
DirectorySourceProvider target = new DirectorySourceProvider(new FakeFileSupport(set(), set()));
|
||||
ClassSource result = target.findSource("hello", null);
|
||||
Assert.assertNull(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldReturnNullForNonDirectory() {
|
||||
DirectorySourceProvider target = new DirectorySourceProvider(new FakeFileSupport(set("foobar"), set()));
|
||||
ClassSource result = target.findSource("foobar", null);
|
||||
Assert.assertNull(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldReturnNullForMalformedURI() {
|
||||
Set<String> visited = set();
|
||||
DirectorySourceProvider target = new DirectorySourceProvider(new FakeFileSupport(set("foobar"), set("foobar")) {
|
||||
@Override
|
||||
public ClassLoader createClassLoader(Path path) throws MalformedURLException {
|
||||
visited.add("1");
|
||||
throw new MalformedURLException("...");
|
||||
}
|
||||
});
|
||||
ClassSource result = target.findSource("foobar", null);
|
||||
Assert.assertNull(result);
|
||||
Assert.assertEquals(set("1"), visited);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldCreateSourceIfNameExistsAndIsADirectory() {
|
||||
FileSupport fileSupport = new FakeFileSupport(set("foo"), set("foo"));
|
||||
DirectorySourceProvider target = new DirectorySourceProvider(fileSupport);
|
||||
ClassSource foo = target.findSource("foo", null);
|
||||
Assert.assertNotNull(foo);
|
||||
Assert.assertEquals("directory:foo", foo.toString());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,128 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2017, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @modules jdk.aot/jdk.tools.jaotc
|
||||
* jdk.aot/jdk.tools.jaotc.collect
|
||||
* jdk.aot/jdk.tools.jaotc.collect.jar
|
||||
* @compile ../Utils.java
|
||||
* @compile ../FakeFileSupport.java
|
||||
* @compile ../FakeSearchPath.java
|
||||
*
|
||||
* @run junit/othervm jdk.tools.jaotc.test.collect.jar.JarSourceProviderTest
|
||||
*/
|
||||
|
||||
package jdk.tools.jaotc.test.collect.jar;
|
||||
|
||||
import jdk.tools.jaotc.collect.ClassSource;
|
||||
import jdk.tools.jaotc.collect.jar.JarSourceProvider;
|
||||
import jdk.tools.jaotc.test.collect.FakeFileSupport;
|
||||
import jdk.tools.jaotc.test.collect.FakeSearchPath;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.ProviderNotFoundException;
|
||||
import java.util.Set;
|
||||
|
||||
import static jdk.tools.jaotc.test.collect.Utils.mkpath;
|
||||
import static jdk.tools.jaotc.test.collect.Utils.set;
|
||||
|
||||
public class JarSourceProviderTest {
|
||||
|
||||
private FakeFileSupport fileSupport;
|
||||
private JarSourceProvider target;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
fileSupport = new FakeFileSupport(set(), set());
|
||||
target = new JarSourceProvider(fileSupport);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldUseSearchPathToFindPath() {
|
||||
Set<String> visited = set();
|
||||
JarSourceProvider target = new JarSourceProvider(fileSupport);
|
||||
FakeSearchPath searchPath = new FakeSearchPath(null);
|
||||
ClassSource source = target.findSource("hello", searchPath);
|
||||
|
||||
Assert.assertEquals(set("hello"), searchPath.entries);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldReturnNullIfPathIsNull() {
|
||||
JarSourceProvider target = new JarSourceProvider(fileSupport);
|
||||
ClassSource source = target.findSource("foobar", new FakeSearchPath(null));
|
||||
Assert.assertNull(source);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldReturnNullIfPathIsDirectory() {
|
||||
fileSupport.addDirectory("hello/foobar");
|
||||
ClassSource source = target.findSource("foobar", new FakeSearchPath("hello/foobar"));
|
||||
|
||||
Assert.assertNull(source);
|
||||
Assert.assertEquals(set(mkpath("hello/foobar")), fileSupport.getCheckedDirectory());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldReturnNullIfUnableToMakeJarFileSystem() {
|
||||
fileSupport.setJarFileSystemRoot(null);
|
||||
ClassSource result = target.findSource("foobar", new FakeSearchPath("foo/bar"));
|
||||
|
||||
Assert.assertEquals(set(mkpath("foo/bar")), fileSupport.getCheckedJarFileSystemRoots());
|
||||
Assert.assertNull(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldReturnNullIfNotValidJarProvider() {
|
||||
fileSupport = new FakeFileSupport(set(), set()) {
|
||||
|
||||
@Override
|
||||
public Path getJarFileSystemRoot(Path jarFile) {
|
||||
super.getJarFileSystemRoot(jarFile);
|
||||
throw new ProviderNotFoundException();
|
||||
}
|
||||
};
|
||||
fileSupport.setJarFileSystemRoot(null);
|
||||
target = new JarSourceProvider(fileSupport);
|
||||
|
||||
ClassSource result = target.findSource("foobar", new FakeSearchPath("foo/bar"));
|
||||
|
||||
Assert.assertEquals(set(mkpath("foo/bar")), fileSupport.getCheckedJarFileSystemRoots());
|
||||
Assert.assertNull(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldReturnSourceWhenAllIsValid() {
|
||||
fileSupport.setJarFileSystemRoot(Paths.get("some/bar"));
|
||||
ClassSource result = target.findSource("foobar", new FakeSearchPath("this/bar"));
|
||||
|
||||
Assert.assertEquals(set(mkpath("this/bar")), fileSupport.getClassloaderPaths());
|
||||
Assert.assertEquals("jar:" + mkpath("this/bar"), result.toString());
|
||||
}
|
||||
}
|
|
@ -1,103 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2017, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @modules jdk.aot/jdk.tools.jaotc
|
||||
* jdk.aot/jdk.tools.jaotc.collect
|
||||
* jdk.aot/jdk.tools.jaotc.collect.module
|
||||
* @compile ../Utils.java
|
||||
* @run junit/othervm jdk.tools.jaotc.test.collect.module.ModuleSourceProviderTest
|
||||
*/
|
||||
|
||||
package jdk.tools.jaotc.test.collect.module;
|
||||
|
||||
import jdk.tools.jaotc.collect.FileSupport;
|
||||
import jdk.tools.jaotc.collect.module.ModuleSource;
|
||||
import jdk.tools.jaotc.collect.module.ModuleSourceProvider;
|
||||
import jdk.tools.jaotc.test.collect.Utils;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileSystem;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import static jdk.tools.jaotc.test.collect.Utils.mkpath;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
|
||||
public class ModuleSourceProviderTest {
|
||||
private ClassLoader classLoader;
|
||||
private ModuleSourceProvider target;
|
||||
private FileSupport fileSupport;
|
||||
private BiFunction<Path, Path, Path> getSubDirectory = null;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
classLoader = new FakeClassLoader();
|
||||
fileSupport = new FileSupport() {
|
||||
|
||||
@Override
|
||||
public boolean isDirectory(Path path) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path getSubDirectory(FileSystem fileSystem, Path root, Path path) throws IOException {
|
||||
if (getSubDirectory == null) {
|
||||
throw new IOException("Nope");
|
||||
}
|
||||
return getSubDirectory.apply(root, path);
|
||||
}
|
||||
};
|
||||
target = new ModuleSourceProvider(FileSystems.getDefault(), classLoader, fileSupport);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void itShouldUseFileSupport() {
|
||||
getSubDirectory = (root, path) -> {
|
||||
if (root.toString().equals("modules") && path.toString().equals("test.module")) {
|
||||
return Paths.get("modules/test.module");
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
ModuleSource source = (ModuleSource) target.findSource("test.module", null);
|
||||
assertEquals(mkpath("modules/test.module"), source.getModulePath().toString());
|
||||
assertEquals("module:" + mkpath("modules/test.module"), source.toString());
|
||||
}
|
||||
|
||||
private static class FakeClassLoader extends ClassLoader {
|
||||
@Override
|
||||
public Class<?> loadClass(String name) throws ClassNotFoundException {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
public class HelloWorld {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello, world!");
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2017, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import jdk.vm.ci.hotspot.*;
|
||||
|
||||
public class InitGraal {
|
||||
public static void main(String[] args) throws Throwable {
|
||||
HotSpotJVMCIRuntime.runtime().getCompiler();
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
Copyright (c) 2017, 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
|
||||
under the terms of the GNU General Public License version 2 only, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
version 2 for more details (a copy is included in the LICENSE file that
|
||||
accompanied this code).
|
||||
|
||||
You should have received a copy of the GNU General Public License version
|
||||
2 along with this work; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
or visit www.oracle.com if you need additional information or have any
|
||||
questions.
|
||||
|
||||
--------------------------------------------
|
||||
This directory contains scripts to test AOT.
|
||||
|
||||
JAVA_HOME should point to local JDK (scripts will install AOT libraries into it) which supports AOT.
|
||||
|
||||
Use 'bash' shell to run scripts.
|
||||
|
||||
Execute build-bootmodules.sh first before running test* scripts.
|
||||
|
||||
Download dacapo-9.12-bach.jar and execute build-jdk.vm-modules.sh before running test-graal.sh
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
# Copyright (c) 2017, 2019, 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
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
|
||||
pushd `dirname $0` > /dev/null
|
||||
DIR=`pwd`
|
||||
popd > /dev/null
|
||||
|
||||
# set env variables
|
||||
. $DIR/test-env.sh
|
||||
|
||||
MODULES="java.base"
|
||||
|
||||
TEST=HelloWorld
|
||||
|
||||
for m in $MODULES; do
|
||||
rm -f $JAVA_HOME/lib/lib$m*.$SO_TYPE
|
||||
done
|
||||
|
||||
$JAVA_HOME/bin/javac -d . $DIR/$TEST.java
|
||||
|
||||
JAOTC_OPTS="-J-ea -J-Xmx4g --compile-for-tiered --info"
|
||||
JAVA_OPTS="-Xmx4g -XX:+UnlockExperimentalVMOptions -XX:+UseAOT -XX:+UnlockDiagnosticVMOptions -XX:+UseAOTStrictLoading"
|
||||
|
||||
# Compile with: +UseCompressedOops +UseG1GC
|
||||
LIBRARIES=""
|
||||
for m in $MODULES; do
|
||||
if [ -f $DIR/$m-list.txt ]; then
|
||||
LIST="--compile-commands $DIR/$m-list.txt"
|
||||
else
|
||||
LIST=""
|
||||
fi
|
||||
$JAVA_HOME/bin/jaotc -J-XX:+UseCompressedOops -J-XX:+UseG1GC $JAOTC_OPTS $LIST --output lib$m-coop.$SO_TYPE --module $m || exit 1
|
||||
LIBRARIES="$LIBRARIES$PWD/lib$m-coop.$SO_TYPE:"
|
||||
done
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS -XX:+UseCompressedOops -XX:+UseG1GC -XX:AOTLibrary=$LIBRARIES $TEST || exit 1
|
||||
|
||||
# Compile with: +UseCompressedOops +UseParallelGC
|
||||
LIBRARIES=""
|
||||
for m in $MODULES; do
|
||||
if [ -f $DIR/$m-list.txt ]; then
|
||||
LIST="--compile-commands $DIR/$m-list.txt"
|
||||
else
|
||||
LIST=""
|
||||
fi
|
||||
$JAVA_HOME/bin/jaotc -J-XX:+UseCompressedOops -J-XX:+UseParallelGC $JAOTC_OPTS $LIST --output lib$m-coop-nong1.$SO_TYPE --module $m || exit 1
|
||||
LIBRARIES="$LIBRARIES$PWD/lib$m-coop-nong1.$SO_TYPE:"
|
||||
done
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS -XX:+UseCompressedOops -XX:+UseParallelGC -XX:AOTLibrary=$LIBRARIES $TEST || exit 1
|
||||
|
||||
# Compile with: -UseCompressedOops +UseG1GC
|
||||
LIBRARIES=""
|
||||
for m in $MODULES; do
|
||||
if [ -f $DIR/$m-list.txt ]; then
|
||||
LIST="--compile-commands $DIR/$m-list.txt"
|
||||
else
|
||||
LIST=""
|
||||
fi
|
||||
$JAVA_HOME/bin/jaotc -J-XX:-UseCompressedOops -J-XX:+UseG1GC $JAOTC_OPTS $LIST --output lib$m.$SO_TYPE --module $m || exit 1
|
||||
LIBRARIES="$LIBRARIES$PWD/lib$m.$SO_TYPE:"
|
||||
done
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS -XX:-UseCompressedOops -XX:+UseG1GC -XX:AOTLibrary=$LIBRARIES $TEST || exit 1
|
||||
|
||||
# Compile with: -UseCompressedOops +UseParallelGC
|
||||
LIBRARIES=""
|
||||
for m in $MODULES; do
|
||||
if [ -f $DIR/$m-list.txt ]; then
|
||||
LIST="--compile-commands $DIR/$m-list.txt"
|
||||
else
|
||||
LIST=""
|
||||
fi
|
||||
$JAVA_HOME/bin/jaotc -J-XX:-UseCompressedOops -J-XX:+UseParallelGC $JAOTC_OPTS $LIST --output lib$m-nong1.$SO_TYPE --module $m || exit 1
|
||||
LIBRARIES="$LIBRARIES$PWD/lib$m-nong1.$SO_TYPE:"
|
||||
done
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS -XX:-UseCompressedOops -XX:+UseParallelGC -XX:AOTLibrary=$LIBRARIES $TEST || exit 1
|
||||
|
||||
echo "Installing shared libraries in: $JAVA_HOME/lib/"
|
||||
for m in $MODULES; do
|
||||
mv -f lib$m*.$SO_TYPE $JAVA_HOME/lib/
|
||||
done
|
||||
|
||||
# Test installed libraries.
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS -XX:-UseCompressedOops -XX:+UseG1GC -XX:+PrintAOT $TEST | grep "aot library" || exit 1
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS -XX:-UseCompressedOops -XX:+UseParallelGC -XX:+PrintAOT $TEST | grep "aot library" || exit 1
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS -XX:+UseCompressedOops -XX:+UseG1GC -XX:+PrintAOT $TEST | grep "aot library" || exit 1
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS -XX:+UseCompressedOops -XX:+UseParallelGC -XX:+PrintAOT $TEST | grep "aot library" || exit 1
|
||||
|
||||
rm -f $TEST.class
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
# Copyright (c) 2017, 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
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
|
||||
pushd `dirname $0` > /dev/null
|
||||
DIR=`pwd`
|
||||
popd > /dev/null
|
||||
|
||||
# set env variables
|
||||
. $DIR/test-env.sh
|
||||
|
||||
MODULES="jdk.internal.vm.ci jdk.internal.vm.compiler"
|
||||
|
||||
TEST=InitGraal
|
||||
|
||||
for m in $MODULES; do
|
||||
rm -f $JAVA_HOME/lib/lib$m*.$SO_TYPE
|
||||
done
|
||||
|
||||
$JAVA_HOME/bin/javac --add-modules jdk.internal.vm.ci --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot=ALL-UNNAMED $DIR/$TEST.java
|
||||
|
||||
# AOT compile non-tiered code version.
|
||||
JAOTC_OPTS="-J-Xmx4g --info"
|
||||
JAVA_OPTS="-Xmx4g -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseAOT -XX:+UnlockDiagnosticVMOptions -XX:+UseAOTStrictLoading --add-modules jdk.internal.vm.ci --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot=ALL-UNNAMED"
|
||||
|
||||
# Compile with: +UseCompressedOops +UseG1GC
|
||||
RT_OPTS="-J-XX:+UseCompressedOops -J-XX:+UseG1GC"
|
||||
LIBRARIES=""
|
||||
for m in $MODULES; do
|
||||
if [ -f $DIR/$m-list.txt ]; then
|
||||
LIST="--compile-commands $DIR/$m-list.txt"
|
||||
else
|
||||
LIST=""
|
||||
fi
|
||||
$JAVA_HOME/bin/jaotc $RT_OPTS $JAOTC_OPTS $LIST --output lib$m-coop.$SO_TYPE --module $m -J-XX:AOTLibrary=$LIBRARIES || exit 1
|
||||
LIBRARIES="$LIBRARIES$PWD/lib$m-coop.$SO_TYPE:"
|
||||
done
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS -XX:+UseCompressedOops -XX:+UseG1GC -XX:+PrintAOT -XX:AOTLibrary=$LIBRARIES $TEST | grep "aot library" || exit 1
|
||||
|
||||
# Compile with: +UseCompressedOops +UseParallelGC
|
||||
RT_OPTS="-J-XX:+UseCompressedOops -J-XX:+UseParallelGC"
|
||||
LIBRARIES=""
|
||||
for m in $MODULES; do
|
||||
if [ -f $DIR/$m-list.txt ]; then
|
||||
LIST="--compile-commands $DIR/$m-list.txt"
|
||||
else
|
||||
LIST=""
|
||||
fi
|
||||
$JAVA_HOME/bin/jaotc $RT_OPTS $JAOTC_OPTS $LIST --output lib$m-coop-nong1.$SO_TYPE --module $m -J-XX:AOTLibrary=$LIBRARIES || exit 1
|
||||
LIBRARIES="$LIBRARIES$PWD/lib$m-coop-nong1.$SO_TYPE:"
|
||||
done
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS -XX:+UseCompressedOops -XX:+UseParallelGC -XX:+PrintAOT -XX:AOTLibrary=$LIBRARIES $TEST | grep "aot library" || exit 1
|
||||
|
||||
# Compile with: -UseCompressedOops +UseG1GC
|
||||
RT_OPTS="-J-XX:-UseCompressedOops -J-XX:+UseG1GC"
|
||||
LIBRARIES=""
|
||||
for m in $MODULES; do
|
||||
if [ -f $DIR/$m-list.txt ]; then
|
||||
LIST="--compile-commands $DIR/$m-list.txt"
|
||||
else
|
||||
LIST=""
|
||||
fi
|
||||
$JAVA_HOME/bin/jaotc $RT_OPTS $JAOTC_OPTS $LIST --output lib$m.$SO_TYPE --module $m -J-XX:AOTLibrary=$LIBRARIES || exit 1
|
||||
LIBRARIES="$LIBRARIES$PWD/lib$m.$SO_TYPE:"
|
||||
done
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS -XX:-UseCompressedOops -XX:+UseG1GC -XX:+PrintAOT -XX:AOTLibrary=$LIBRARIES $TEST | grep "aot library" || exit 1
|
||||
|
||||
# Compile with: -UseCompressedOops +UseParallelGC
|
||||
RT_OPTS="-J-XX:-UseCompressedOops -J-XX:+UseParallelGC"
|
||||
LIBRARIES=""
|
||||
for m in $MODULES; do
|
||||
if [ -f $DIR/$m-list.txt ]; then
|
||||
LIST="--compile-commands $DIR/$m-list.txt"
|
||||
else
|
||||
LIST=""
|
||||
fi
|
||||
$JAVA_HOME/bin/jaotc $RT_OPTS $JAOTC_OPTS $LIST --output lib$m-nong1.$SO_TYPE --module $m -J-XX:AOTLibrary=$LIBRARIES || exit 1
|
||||
LIBRARIES="$LIBRARIES$PWD/lib$m-nong1.$SO_TYPE:"
|
||||
done
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS -XX:-UseCompressedOops -XX:+UseParallelGC -XX:+PrintAOT -XX:AOTLibrary=$LIBRARIES $TEST | grep "aot library" || exit 1
|
||||
|
||||
echo "Installing shared libraries in: $JAVA_HOME/lib/"
|
||||
for m in $MODULES; do
|
||||
mv -f lib$m*.$SO_TYPE $JAVA_HOME/lib/
|
||||
done
|
||||
|
||||
# Test installed libraries.
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS -XX:-UseCompressedOops -XX:+UseG1GC -XX:+PrintAOT $TEST | grep "aot library" || exit 1
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS -XX:-UseCompressedOops -XX:+UseParallelGC -XX:+PrintAOT $TEST | grep "aot library" || exit 1
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS -XX:+UseCompressedOops -XX:+UseG1GC -XX:+PrintAOT $TEST | grep "aot library" || exit 1
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS -XX:+UseCompressedOops -XX:+UseParallelGC -XX:+PrintAOT $TEST | grep "aot library" || exit 1
|
||||
|
||||
rm -f $TEST.class
|
|
@ -1 +0,0 @@
|
|||
i = 0;
|
|
@ -1,20 +0,0 @@
|
|||
# Copyright (c) 2017, 2018, 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
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
|
@ -1,45 +0,0 @@
|
|||
# Copyright (c) 2017, 2018, 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
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
|
||||
#
|
||||
exclude org.graalvm.compiler.hotspot.replacements.arraycopy.ArrayCopyCallNode.*
|
||||
exclude org.graalvm.compiler.hotspot.replacements.AESCryptSubstitutions.*
|
||||
exclude org.graalvm.compiler.hotspot.replacements.CipherBlockChainingSubstitutions.crypt(Ljava/lang/Object;[BII[BILjava/lang/Object;ZZ)V
|
||||
exclude org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.arrayAllocationSize(III)I
|
||||
exclude org.graalvm.compiler.hotspot.replacements.PluginFactory_HotSpotReplacementsUtil\$config.execute(.*).*
|
||||
exclude org.graalvm.compiler.hotspot.replacements.PluginFactory_HotSpotReplacementsUtil\$getWordKind.execute(.*).*
|
||||
exclude org.graalvm.compiler.hotspot.replacements.PluginFactory_HotSpotReplacementsUtil\$getConfig.execute(.*).
|
||||
#
|
||||
exclude org.graalvm.compiler.hotspot.stubs.StubUtil.printf(.*).*
|
||||
exclude org.graalvm.compiler.hotspot.stubs.StubUtil.decipher(J)V
|
||||
exclude org.graalvm.compiler.hotspot.stubs.StubUtil.fatal(.*).*
|
||||
#
|
||||
exclude org.graalvm.compiler.nodes.java.NewArrayNode.newUninitializedArray(Ljava/lang/Class;I)Ljava/lang/Object;
|
||||
exclude org.graalvm.compiler.nodes.java.DynamicNewArrayNode.newArray(Ljava/lang/Class;ILjdk/vm/ci/meta/JavaKind;)Ljava/lang/Object;
|
||||
exclude org.graalvm.compiler.nodes.java.DynamicNewArrayNode.newUninitializedArray(Ljava/lang/Class;ILjdk/vm/ci/meta/JavaKind;)Ljava/lang/Object;
|
||||
exclude org.graalvm.compiler.nodes.PiNode.piCastNonNull(Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;
|
||||
#
|
||||
exclude org.graalvm.compiler.replacements.nodes.ArrayEqualsNode.equals(.*).*
|
||||
exclude org.graalvm.compiler.replacements.Log.print.*
|
||||
exclude org.graalvm.compiler.replacements.ReplacementsUtil.*
|
||||
exclude org.graalvm.compiler.replacements.SnippetCounter.*
|
||||
exclude org.graalvm.compiler.replacements.SnippetCounterNode.*
|
||||
exclude org.graalvm.compiler.replacements.SnippetIntegerHistogram.inc(J)V
|
|
@ -1,42 +0,0 @@
|
|||
# Copyright (c) 2017, 2020, 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
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
|
||||
# set platform-dependent variables
|
||||
OS=`uname -s`
|
||||
case "$OS" in
|
||||
Linux )
|
||||
SO_TYPE=so
|
||||
;;
|
||||
Darwin )
|
||||
SO_TYPE=dylib
|
||||
;;
|
||||
Windows_* )
|
||||
SO_TYPE=dll
|
||||
;;
|
||||
CYGWIN_* )
|
||||
SO_TYPE=dll
|
||||
;;
|
||||
* )
|
||||
echo "Unrecognized system!"
|
||||
exit 1;
|
||||
;;
|
||||
esac
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
# Copyright (c) 2017, 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
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
|
||||
JAR="dacapo-9.12-bach.jar"
|
||||
|
||||
if [ ! -f $JAR ]; then
|
||||
echo "$JAR not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pushd `dirname $0` > /dev/null
|
||||
DIR=`pwd`
|
||||
popd > /dev/null
|
||||
|
||||
APP="-jar $JAR -s small -n 5"
|
||||
|
||||
JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI -XX:-TieredCompilation -Xmx4g -XX:+UseCompressedOops -XX:+UseG1GC"
|
||||
|
||||
MODULE_OPTS="--add-modules jdk.internal.vm.ci --add-exports jdk.internal.vm.ci/jdk.vm.ci.hotspot=ALL-UNNAMED"
|
||||
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS -version || exit 1
|
||||
|
||||
$JAVA_HOME/bin/javac $MODULE_OPTS InitGraal.java || exit 1
|
||||
|
||||
PATTERN="(aot library|DONE:.*HotSpotVMConfig|DONE:.*HotSpotJVMCIRuntime|DONE:.*HotSpotGraalRuntime)"
|
||||
echo "----------"
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS $MODULE_OPTS -XX:+TieredCompilation -XX:-UseAOT -XX:+PrintAOT -Djvmci.InitTimer=true InitGraal | grep -E "$PATTERN" || exit 1
|
||||
echo "----------"
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS $MODULE_OPTS -XX:+TieredCompilation -XX:+PrintAOT -Djvmci.InitTimer=true InitGraal | grep -E "$PATTERN" || exit 1
|
||||
echo "----------"
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS $MODULE_OPTS -XX:+PrintAOT -Djvmci.InitTimer=true InitGraal | grep -E "$PATTERN" || exit 1
|
||||
echo "----------"
|
||||
|
||||
rm -f InitGraal.class
|
||||
|
||||
# eclipse started to fail again with JDK 9.
|
||||
#BENCHMARKS="avrora batik eclipse fop jython h2 luindex lusearch pmd sunflow tradebeans tradesoap xalan"
|
||||
BENCHMARKS="avrora batik fop jython h2 luindex lusearch pmd sunflow xalan"
|
||||
|
||||
for i in $BENCHMARKS; do
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS $APP $i || exit 1
|
||||
rm -rf ./scratch
|
||||
done
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
# Copyright (c) 2017, 2019, 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
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
|
||||
pushd `dirname $0` > /dev/null
|
||||
DIR=`pwd`
|
||||
popd > /dev/null
|
||||
|
||||
# set env variables
|
||||
. $DIR/test-env.sh
|
||||
|
||||
rm -f libHelloWorld*.$SO_TYPE HelloWorld.class
|
||||
|
||||
$JAVA_HOME/bin/javac -d . $DIR/HelloWorld.java
|
||||
|
||||
# Run once with non-compressed oops.
|
||||
OPTS="-J-Xmx4g -J-XX:-UseCompressedOops --info --verbose"
|
||||
$JAVA_HOME/bin/jaotc $OPTS --output libHelloWorld.$SO_TYPE HelloWorld.class || exit 1
|
||||
|
||||
JAVA_OPTS="-Xmx4g -XX:-UseCompressedOops -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseAOTStrictLoading -XX:AOTLibrary=./libHelloWorld.$SO_TYPE"
|
||||
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS -XX:+PrintAOT -version | grep "aot library" || exit 1
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS HelloWorld || exit 1
|
||||
|
||||
TIMEFORMAT="%3R"
|
||||
N=5
|
||||
|
||||
LIBRARY=libHelloWorld-coop.$SO_TYPE
|
||||
|
||||
for gc in UseG1GC UseParallelGC; do
|
||||
# Now with compressed oops.
|
||||
OPTS="-J-XX:+UseCompressedOops -J-XX:+$gc --info --verbose"
|
||||
$JAVA_HOME/bin/jaotc $OPTS --output $LIBRARY HelloWorld.class
|
||||
|
||||
# Dump CDS archive.
|
||||
$JAVA_HOME/bin/java -Xshare:dump -XX:+UnlockExperimentalVMOptions -XX:-UseAOT -XX:+$gc || exit 1
|
||||
|
||||
JAVA_OPTS="-Xmx256m"
|
||||
|
||||
echo "Tiered C1 $gc:"
|
||||
for i in `seq 1 $N`; do
|
||||
OUT=`time $JAVA_HOME/bin/java -XX:+$gc -XX:-UseCompressedOops -XX:+UnlockExperimentalVMOptions -XX:-UseAOT -XX:TieredStopAtLevel=1 $JAVA_OPTS HelloWorld`
|
||||
if [ "$OUT" != "Hello, world!" ]; then
|
||||
echo $OUT
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Tiered C1/C2 $gc:"
|
||||
for i in `seq 1 $N`; do
|
||||
OUT=`time $JAVA_HOME/bin/java -XX:+$gc -XX:-UseCompressedOops -XX:+UnlockExperimentalVMOptions -XX:-UseAOT $JAVA_OPTS HelloWorld`
|
||||
if [ "$OUT" != "Hello, world!" ]; then
|
||||
echo $OUT
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
JAVA_OPTS="-Xmx256m -XX:+UseCompressedOops -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseAOTStrictLoading -XX:AOTLibrary=./$LIBRARY"
|
||||
|
||||
|
||||
echo "AOT $gc:"
|
||||
for i in `seq 1 $N`; do
|
||||
OUT=`time $JAVA_HOME/bin/java -XX:+$gc $JAVA_OPTS HelloWorld`
|
||||
if [ "$OUT" != "Hello, world!" ]; then
|
||||
echo $OUT
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "AOT -Xshare:on $gc:"
|
||||
for i in `seq 1 $N`; do
|
||||
OUT=`time $JAVA_HOME/bin/java -Xshare:on -XX:+$gc $JAVA_OPTS HelloWorld`
|
||||
if [ "$OUT" != "Hello, world!" ]; then
|
||||
echo $OUT
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
rm -f libHelloWorld*.$SO_TYPE HelloWorld.class
|
|
@ -1,43 +0,0 @@
|
|||
# Copyright (c) 2017, 2019, 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
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
|
||||
pushd `dirname $0` > /dev/null
|
||||
DIR=`pwd`
|
||||
popd > /dev/null
|
||||
|
||||
# set env variables
|
||||
. $DIR/test-env.sh
|
||||
|
||||
JAOTC_OPTS="-J-Xmx4g -J-XX:-UseCompressedOops"
|
||||
|
||||
rm -f libjdk.aot.$SO_TYPE
|
||||
|
||||
$JAVA_HOME/bin/jaotc $JAOTC_OPTS --info --module jdk.aot --output libjdk.aot.$SO_TYPE || exit 1
|
||||
|
||||
rm -f libjava.base-aot.$SO_TYPE
|
||||
|
||||
$JAVA_HOME/bin/jaotc $JAOTC_OPTS -J-XX:AOTLibrary=./libjdk.aot.$SO_TYPE --info --compile-commands $DIR/java.base-list.txt --output libjava.base-aot.$SO_TYPE --module java.base || exit 1
|
||||
|
||||
$JAVA_HOME/bin/javac -d . $DIR/HelloWorld.java
|
||||
|
||||
$JAVA_HOME/bin/java -XX:-UseCompressedOops -XX:+UnlockExperimentalVMOptions -XX:AOTLibrary=./libjava.base-aot.$SO_TYPE HelloWorld
|
||||
|
||||
rm -f HelloWorld.class libjdk.aot.$SO_TYPE libjava.base-aot.$SO_TYPE
|
|
@ -1,157 +0,0 @@
|
|||
# Copyright (c) 2017, 2019, 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
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
|
||||
pushd `dirname $0` > /dev/null
|
||||
DIR=`pwd`
|
||||
popd > /dev/null
|
||||
|
||||
AOT_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseAOT"
|
||||
|
||||
$JAVA_HOME/bin/java $AOT_OPTS -XX:+PrintAOT -version | grep "aot library" || exit 1
|
||||
|
||||
# Dump CDS archive.
|
||||
$JAVA_HOME/bin/java $AOT_OPTS -Xshare:dump || exit 1
|
||||
|
||||
FILE="HelloWorld"
|
||||
|
||||
APP="com.sun.tools.javac.Main"
|
||||
|
||||
JAVA_OPTS="-XX:-UseCompressedOops"
|
||||
|
||||
rm -f $FILE.class
|
||||
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS $AOT_OPTS $APP -verbose $FILE.java || exit 1
|
||||
$JAVA_HOME/bin/java $AOT_OPTS $FILE || exit 1
|
||||
|
||||
JAVA_OPTS="-XX:+UseCompressedOops"
|
||||
|
||||
rm -f $FILE.class
|
||||
|
||||
$JAVA_HOME/bin/java $JAVA_OPTS $AOT_OPTS $APP -verbose $FILE.java || exit 1
|
||||
$JAVA_HOME/bin/java $AOT_OPTS $FILE || exit 1
|
||||
|
||||
rm -f $FILE.class
|
||||
|
||||
TIMEFORMAT="%3R"
|
||||
N=5
|
||||
|
||||
#echo "-Xint:"
|
||||
#for i in `seq 1 10`; do
|
||||
# time $JAVA_HOME/bin/java -Xint $JAVA_OPTS $APP $FILE.java
|
||||
# if [ $? -ne 0 ]; then
|
||||
# exit 1
|
||||
# fi
|
||||
# rm -f $FILE.class
|
||||
#done
|
||||
|
||||
echo "Tiered C1:"
|
||||
for i in `seq 1 $N`; do
|
||||
time $JAVA_HOME/bin/java $JAVA_OPTS -XX:+UnlockExperimentalVMOptions -XX:-UseAOT -XX:TieredStopAtLevel=1 $APP $FILE.java
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
rm -f $FILE.class
|
||||
done
|
||||
|
||||
echo "Tiered C1/C2:"
|
||||
for i in `seq 1 $N`; do
|
||||
time $JAVA_HOME/bin/java $JAVA_OPTS -XX:+UnlockExperimentalVMOptions -XX:-UseAOT $APP $FILE.java
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
rm -f $FILE.class
|
||||
done
|
||||
|
||||
echo "Tiered C1/C2 -Xshare:on:"
|
||||
for i in `seq 1 $N`; do
|
||||
time $JAVA_HOME/bin/java $JAVA_OPTS -XX:+UnlockExperimentalVMOptions -XX:-UseAOT -Xshare:on $APP $FILE.java
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
rm -f $FILE.class
|
||||
done
|
||||
|
||||
echo "Tiered AOT:"
|
||||
for i in `seq 1 $N`; do
|
||||
time $JAVA_HOME/bin/java $JAVA_OPTS $AOT_OPTS $APP $FILE.java
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
rm -f $FILE.class
|
||||
done
|
||||
|
||||
echo "Tiered AOT -Xshare:on:"
|
||||
for i in `seq 1 $N`; do
|
||||
time $JAVA_HOME/bin/java $JAVA_OPTS $AOT_OPTS -Xshare:on $APP $FILE.java
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
rm -f $FILE.class
|
||||
done
|
||||
|
||||
NAME="jvmci"
|
||||
DIR="$DIR/../../../../../../src/jdk.internal.vm.ci"
|
||||
FILES=`find $DIR -type f -name '*.java'`
|
||||
COUNT=`find $DIR -type f -name '*.java' | wc -l`
|
||||
|
||||
rm -rf tmp
|
||||
|
||||
echo "Tiered C1 (compiling $NAME: $COUNT classes):"
|
||||
for i in `seq 1 $N`; do
|
||||
mkdir tmp
|
||||
time $JAVA_HOME/bin/javac -J-XX:+UnlockExperimentalVMOptions -J-XX:-UseAOT -J-XX:TieredStopAtLevel=1 -XDignore.symbol.file -d tmp $FILES
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
rm -rf tmp
|
||||
done
|
||||
|
||||
echo "Tiered C1/C2 (compiling $NAME: $COUNT classes):"
|
||||
for i in `seq 1 $N`; do
|
||||
mkdir tmp
|
||||
time $JAVA_HOME/bin/javac -J-XX:+UnlockExperimentalVMOptions -J-XX:-UseAOT -XDignore.symbol.file -cp /java/devtools/share/junit/latest/junit.jar -d tmp $FILES
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
rm -rf tmp
|
||||
done
|
||||
|
||||
echo "Tiered AOT (compiling $NAME: $COUNT classes):"
|
||||
for i in `seq 1 $N`; do
|
||||
mkdir tmp
|
||||
time $JAVA_HOME/bin/javac -J-XX:+UnlockExperimentalVMOptions -J-XX:+UseAOT -XDignore.symbol.file -cp /java/devtools/share/junit/latest/junit.jar -d tmp $FILES
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
rm -rf tmp
|
||||
done
|
||||
|
||||
echo "Tiered AOT -Xshare:on (compiling $NAME: $COUNT classes):"
|
||||
for i in `seq 1 $N`; do
|
||||
mkdir tmp
|
||||
time $JAVA_HOME/bin/javac -J-Xshare:on -J-XX:+UnlockExperimentalVMOptions -J-XX:+UseAOT -XDignore.symbol.file -cp /java/devtools/share/junit/latest/junit.jar -d tmp $FILES
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
rm -rf tmp
|
||||
done
|
||||
|
||||
|
|
@ -1,124 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2019, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.aot.verification.ClassAndLibraryNotMatchTest
|
||||
* @run driver compiler.aot.verification.ClassAndLibraryNotMatchTest
|
||||
* @summary check if class and aot library are properly bound to each other
|
||||
*/
|
||||
|
||||
package compiler.aot.verification;
|
||||
|
||||
import compiler.aot.AotCompiler;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.Arrays;
|
||||
import jdk.test.lib.JDKToolFinder;
|
||||
import jdk.test.lib.Utils;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
public class ClassAndLibraryNotMatchTest {
|
||||
private static final String HELLO_WORLD_CLASS_NAME = "HelloWorld";
|
||||
private static final String LIB_NAME = "lib" + HELLO_WORLD_CLASS_NAME + ".so";
|
||||
private static final String HELLO_WORLD_MSG1 = "HelloWorld1";
|
||||
private static final String HELLO_WORLD_MSG2 = "HelloWorld2";
|
||||
private static final String HELLO_WORLD_FILE = "./" + HELLO_WORLD_CLASS_NAME + ".java";
|
||||
private static final String HELLO_WORLD_PRE = "public class "
|
||||
+ HELLO_WORLD_CLASS_NAME + " {\n"
|
||||
+ " public static void main(String args[]) {\n"
|
||||
+ " System.out.println(\"";
|
||||
private static final String HELLO_WORLD_POST = "\");\n"
|
||||
+ " }\n"
|
||||
+ "}\n";
|
||||
|
||||
public static void main(String args[]) {
|
||||
new ClassAndLibraryNotMatchTest().runTest();
|
||||
}
|
||||
|
||||
private void writeHelloWorld(String message) {
|
||||
String src = HELLO_WORLD_PRE + message + HELLO_WORLD_POST;
|
||||
try{
|
||||
Files.write(Paths.get(HELLO_WORLD_FILE), src.getBytes(), StandardOpenOption.CREATE);
|
||||
} catch (IOException e) {
|
||||
throw new Error("Can't write HelloWorld " + e, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void compileHelloWorld() {
|
||||
String javac = JDKToolFinder.getCompileJDKTool("javac");
|
||||
ProcessBuilder pb = new ProcessBuilder(javac, HELLO_WORLD_FILE);
|
||||
OutputAnalyzer oa;
|
||||
try {
|
||||
oa = ProcessTools.executeProcess(pb);
|
||||
} catch (Exception e) {
|
||||
throw new Error("Can't compile class " + e, e);
|
||||
}
|
||||
oa.shouldHaveExitValue(0);
|
||||
}
|
||||
|
||||
private void compileAotLibrary() {
|
||||
AotCompiler.launchCompiler(LIB_NAME, HELLO_WORLD_CLASS_NAME,
|
||||
Arrays.asList("-classpath", Utils.TEST_CLASS_PATH + File.pathSeparator + "."), null);
|
||||
}
|
||||
|
||||
private void runAndCheckHelloWorld(String checkString) {
|
||||
ProcessBuilder pb;
|
||||
try {
|
||||
pb = ProcessTools.createTestJvm("-cp", ".",
|
||||
"-XX:+UnlockExperimentalVMOptions", "-XX:+UseAOT",
|
||||
"-XX:AOTLibrary=./" + LIB_NAME, HELLO_WORLD_CLASS_NAME);
|
||||
} catch (Exception e) {
|
||||
throw new Error("Can't create ProcessBuilder to run "
|
||||
+ HELLO_WORLD_CLASS_NAME + " " + e, e);
|
||||
}
|
||||
OutputAnalyzer oa;
|
||||
try {
|
||||
oa = ProcessTools.executeProcess(pb);
|
||||
} catch (Exception e) {
|
||||
throw new Error("Can't execute " + HELLO_WORLD_CLASS_NAME + " " + e, e);
|
||||
}
|
||||
oa.shouldHaveExitValue(0);
|
||||
oa.shouldContain(checkString);
|
||||
}
|
||||
|
||||
private void createHelloWorld(String msg) {
|
||||
writeHelloWorld(msg);
|
||||
compileHelloWorld();
|
||||
}
|
||||
|
||||
private void runTest() {
|
||||
createHelloWorld(HELLO_WORLD_MSG1);
|
||||
compileAotLibrary();
|
||||
runAndCheckHelloWorld(HELLO_WORLD_MSG1);
|
||||
createHelloWorld(HELLO_WORLD_MSG2);
|
||||
runAndCheckHelloWorld(HELLO_WORLD_MSG2);
|
||||
}
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2019, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package compiler.aot.verification.vmflags;
|
||||
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.lib.Utils;
|
||||
import compiler.aot.HelloWorldPrinter;
|
||||
import compiler.aot.AotCompiler;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A class with common launch and check logic for testing vm flags change
|
||||
*/
|
||||
public class BasicFlagsChange {
|
||||
private static final boolean CAN_LOAD = true;
|
||||
/**
|
||||
* A main method which parse arguments, expecting vm option name to
|
||||
* be present, launch java process with combinations of provided flag
|
||||
* enabled/disable in aot library and vm flag expecting different flag
|
||||
* values in library and vm to be negative cases
|
||||
* @param args should have true/false treated as "loadAlways" for
|
||||
* tracked/non-tracked options and vm option name
|
||||
*/
|
||||
public static void main(String args[]) {
|
||||
if (args.length != 2) {
|
||||
throw new Error("TESTBUG: Unexpected number of arguments: "
|
||||
+ args.length);
|
||||
}
|
||||
if (!"false".equals(args[0]) && !"true".equals(args[0])) {
|
||||
throw new Error("TESTBUG: unexpected value of 1st parameter: "
|
||||
+ args[0]);
|
||||
}
|
||||
boolean loadAlways = Boolean.parseBoolean(args[0]);
|
||||
String optName = args[1];
|
||||
String optEnabled = "-XX:+" + optName;
|
||||
String optDisabled = "-XX:-" + optName;
|
||||
String enabledLibName = "libEnabled.so";
|
||||
String disabledLibName = "libDisabled.so";
|
||||
// compile libraries
|
||||
compileLibrary(optEnabled, enabledLibName);
|
||||
compileLibrary(optDisabled, disabledLibName);
|
||||
// run 4 combinations
|
||||
runAndCheck(optEnabled, enabledLibName, CAN_LOAD || loadAlways);
|
||||
runAndCheck(optDisabled, enabledLibName, !CAN_LOAD || loadAlways);
|
||||
runAndCheck(optEnabled, disabledLibName, !CAN_LOAD || loadAlways);
|
||||
runAndCheck(optDisabled, disabledLibName, CAN_LOAD || loadAlways);
|
||||
}
|
||||
|
||||
private static void compileLibrary(String option, String libName) {
|
||||
String className = BasicFlagsChange.class.getName();
|
||||
List<String> extraOpts = new ArrayList<>();
|
||||
extraOpts.add(option);
|
||||
extraOpts.add("-classpath");
|
||||
extraOpts.add(Utils.TEST_CLASS_PATH + File.pathSeparator + Utils.TEST_SRC);
|
||||
AotCompiler.launchCompiler(libName, className, extraOpts, null);
|
||||
}
|
||||
|
||||
private static void runAndCheck(String option, String libName,
|
||||
boolean positiveCase) {
|
||||
ProcessBuilder pb;
|
||||
try {
|
||||
/* using +PrintAOT to check if library has been loaded or skipped,
|
||||
so, a message like "skipped $pathTolibrary aot library" or
|
||||
"loaded $pathToLibrary aot library" is present for cases of
|
||||
incompatible or compatible flags respectively */
|
||||
pb = ProcessTools.createTestJvm("-XX:+UnlockExperimentalVMOptions",
|
||||
"-XX:+UseAOT", "-XX:+PrintAOT", "-XX:AOTLibrary=./" + libName, option,
|
||||
HelloWorldPrinter.class.getName());
|
||||
} catch (Exception ex) {
|
||||
throw new Error("Problems creating ProcessBuilder using " + option
|
||||
+ " Caused by: " + ex, ex);
|
||||
}
|
||||
OutputAnalyzer oa;
|
||||
try {
|
||||
oa = ProcessTools.executeProcess(pb);
|
||||
} catch (Exception ex) {
|
||||
throw new Error("Problems execution child process using case "
|
||||
+ option + " Caused by: " + ex, ex);
|
||||
}
|
||||
oa.shouldHaveExitValue(0);
|
||||
oa.shouldContain(HelloWorldPrinter.MESSAGE);
|
||||
if (positiveCase) {
|
||||
oa.shouldContain("loaded ./" + libName + " aot library");
|
||||
} else {
|
||||
oa.shouldContain("skipped ./" + libName + " aot library");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2017, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.aot.verification.vmflags.BasicFlagsChange
|
||||
* @run driver compiler.aot.verification.vmflags.BasicFlagsChange
|
||||
* true PrintCommandLineFlags
|
||||
* @summary check if some not aot-related vm flag change doesn't affect aot library loading
|
||||
*/
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2017, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @requires vm.aot
|
||||
* @library /test/lib /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.aot.verification.vmflags.BasicFlagsChange
|
||||
* @run driver compiler.aot.verification.vmflags.BasicFlagsChange
|
||||
* false UseCompressedOops
|
||||
* @summary check if tracked flag UseCompressedOops is controlled properly
|
||||
*/
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2021, 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
|
||||
|
@ -26,8 +26,6 @@
|
|||
* @key randomness
|
||||
* @bug 8081778
|
||||
* @summary Add C2 x86 intrinsic for BigInteger::mulAdd() method
|
||||
* @comment the test disables intrinsics, so it can't be run w/ AOT'ed java.base
|
||||
* @requires !vm.aot.enabled
|
||||
*
|
||||
* @library /test/lib
|
||||
* @run main/othervm/timeout=600 -XX:-TieredCompilation -Xbatch
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
* @test
|
||||
* @bug 8035968
|
||||
* @summary Verify that MD5 intrinsic is actually used.
|
||||
* @comment the test verifies compilation of java.base methods, so it can't be run w/ AOT'ed java.base
|
||||
* @requires !vm.aot.enabled
|
||||
*
|
||||
* @library /test/lib /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
* @test
|
||||
* @bug 8035968
|
||||
* @summary Verify that MD5 multi block intrinsic is actually used.
|
||||
* @comment the test verifies compilation of java.base methods, so it can't be run w/ AOT'ed java.base
|
||||
* @requires !vm.aot.enabled
|
||||
*
|
||||
* @library /test/lib /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
* @test
|
||||
* @bug 8035968
|
||||
* @summary Verify that SHA-1 intrinsic is actually used.
|
||||
* @comment the test verifies compilation of java.base methods, so it can't be run w/ AOT'ed java.base
|
||||
* @requires !vm.aot.enabled
|
||||
*
|
||||
* @library /test/lib /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
* @test
|
||||
* @bug 8035968
|
||||
* @summary Verify that SHA-1 multi block intrinsic is actually used.
|
||||
* @comment the test verifies compilation of java.base methods, so it can't be run w/ AOT'ed java.base
|
||||
* @requires !vm.aot.enabled
|
||||
*
|
||||
* @library /test/lib /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
* @test
|
||||
* @bug 8035968
|
||||
* @summary Verify that SHA-256 intrinsic is actually used.
|
||||
* @comment the test verifies compilation of java.base methods, so it can't be run w/ AOT'ed java.base
|
||||
* @requires !vm.aot.enabled
|
||||
*
|
||||
* @library /test/lib /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue