8191927: Enable AppCDS for custom loaders on all 64-bit Linux and AIX
Added "@requires vm.cds.custom.loaders" to mark tests related to custom loaders Reviewed-by: simonis, mseledtsov
This commit is contained in:
parent
66c00b4184
commit
7617012f55
@ -272,9 +272,11 @@ void ClassListParser::error(const char *msg, ...) {
|
||||
// This function is used for loading classes for customized class loaders
|
||||
// during archive dumping.
|
||||
InstanceKlass* ClassListParser::load_class_from_source(Symbol* class_name, TRAPS) {
|
||||
#if !((defined(LINUX) && defined(X86) && defined(_LP64)) || \
|
||||
(defined(SOLARIS) && defined(_LP64)))
|
||||
// The only supported platforms are: (1) Linux/AMD64; (2) Solaris/64-bit
|
||||
#if !(defined(_LP64) && (defined(LINUX)|| defined(SOLARIS) || defined(AIX)))
|
||||
// The only supported platforms are: (1) Linux/64-bit; (2) Solaris/64-bit; (3) AIX/64-bit
|
||||
//
|
||||
// This #if condition should be in sync with the areCustomLoadersSupportedForCDS
|
||||
// method in test/lib/jdk/test/lib/Platform.java.
|
||||
error("AppCDS custom class loaders not supported on this platform");
|
||||
#endif
|
||||
|
||||
|
@ -53,6 +53,7 @@ requires.properties= \
|
||||
vm.rtm.os \
|
||||
vm.aot \
|
||||
vm.cds \
|
||||
vm.cds.custom.loaders \
|
||||
vm.graal.enabled \
|
||||
docker.support
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
* @summary AppCDS handling of prohibited package.
|
||||
* AppCDS does not support uncompressed oops
|
||||
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
|
||||
* @requires vm.cds
|
||||
* @library /test/lib
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
@ -45,10 +46,8 @@ public class ProhibitedPackage {
|
||||
|
||||
String appJar = TestCommon.getTestJar("prohibited_pkg.jar");
|
||||
|
||||
// AppCDS for custom loader is only supported on linux-x64 and
|
||||
// Solaris 64-bit platforms.
|
||||
if ((Platform.isLinux() || Platform.isSolaris()) &&
|
||||
Platform.is64bit()) {
|
||||
// Test support for customer loaders
|
||||
if (Platform.areCustomLoadersSupportedForCDS()) {
|
||||
String classlist[] = new String[] {
|
||||
"java/lang/Object id: 1",
|
||||
"java/lang/Prohibited id: 2 super: 1 source: " + appJar
|
||||
|
@ -321,19 +321,4 @@ public class TestCommon extends CDSTestUtils {
|
||||
}
|
||||
return dirFile.getPath();
|
||||
}
|
||||
|
||||
|
||||
// Returns true if custom loader is supported, based on a platform.
|
||||
// Custom loader AppCDS is only supported for Linux-x64 and Solaris.
|
||||
public static boolean isCustomLoaderSupported() {
|
||||
boolean isLinux = Platform.isLinux();
|
||||
boolean isX64 = Platform.isX64();
|
||||
boolean isSolaris = Platform.isSolaris();
|
||||
|
||||
System.out.println("isCustomLoaderSupported: isX64 = " + isX64);
|
||||
System.out.println("isCustomLoaderSupported: isLinux = " + isLinux);
|
||||
System.out.println("isCustomLoaderSupported: isSolaris = " + isSolaris);
|
||||
|
||||
return ((isX64 && isLinux) || isSolaris);
|
||||
}
|
||||
}
|
||||
|
@ -26,8 +26,7 @@
|
||||
* @test
|
||||
* @summary Test resolved_references
|
||||
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
|
||||
* @requires (sun.arch.data.model == "64")
|
||||
* @requires ((os.family == "linux") & (os.arch=="amd64")) | (os.family == "solaris")
|
||||
* @requires vm.cds.custom.loaders
|
||||
* @requires (vm.gc=="null")
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @modules java.base/jdk.internal.misc
|
||||
@ -53,9 +52,9 @@ public class CheckCachedResolvedReferences {
|
||||
String helloJarPath = ClassFileInstaller.getJarPath("hello.jar");
|
||||
|
||||
String classlist[] = new String[] {
|
||||
"CheckCachedResolvedReferencesApp",
|
||||
"java/lang/Object id: 1",
|
||||
"Hello id: 2 super: 1 source: " + helloJarPath
|
||||
"CheckCachedResolvedReferencesApp", // built-in app loader
|
||||
"java/lang/Object id: 1", // boot loader
|
||||
"Hello id: 2 super: 1 source: " + helloJarPath // custom loader
|
||||
};
|
||||
|
||||
TestCommon.testDump(appJar, classlist, use_whitebox_jar);
|
||||
|
@ -28,8 +28,7 @@
|
||||
*
|
||||
* (NOTE: AppCDS does not support uncompressed oops)
|
||||
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
|
||||
* @requires (sun.arch.data.model == "64")
|
||||
* @requires ((os.family == "linux") & (os.arch=="amd64")) | (os.family == "solaris")
|
||||
* @requires vm.cds.custom.loaders
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
|
@ -28,8 +28,7 @@
|
||||
*
|
||||
* (NOTE: AppCDS does not support uncompressed oops)
|
||||
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
|
||||
* @requires (sun.arch.data.model == "64")
|
||||
* @requires ((os.family == "linux") & (os.arch=="amd64")) | (os.family == "solaris")
|
||||
* @requires vm.cds.custom.loaders
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
|
@ -28,8 +28,7 @@
|
||||
*
|
||||
* (NOTE: AppCDS does not support uncompressed oops)
|
||||
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
|
||||
* @requires (sun.arch.data.model == "64")
|
||||
* @requires ((os.family == "linux") & (os.arch=="amd64")) | (os.family == "solaris")
|
||||
* @requires vm.cds.custom.loaders
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
|
@ -28,8 +28,7 @@
|
||||
*
|
||||
* (NOTE: AppCDS does not support uncompressed oops)
|
||||
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
|
||||
* @requires (sun.arch.data.model == "64")
|
||||
* @requires ((os.family == "linux") & (os.arch=="amd64")) | (os.family == "solaris")
|
||||
* @requires vm.cds.custom.loaders
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
|
@ -28,8 +28,7 @@
|
||||
*
|
||||
* (NOTE: AppCDS does not support uncompressed oops)
|
||||
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
|
||||
* @requires (sun.arch.data.model == "64")
|
||||
* @requires ((os.family == "linux") & (os.arch=="amd64")) | (os.family == "solaris")
|
||||
* @requires vm.cds.custom.loaders
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
|
@ -27,8 +27,7 @@
|
||||
* @summary Hello World test for AppCDS custom loader support
|
||||
* (NOTE: AppCDS does not support uncompressed oops)
|
||||
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
|
||||
* @requires (sun.arch.data.model == "64")
|
||||
* @requires ((os.family == "linux") & (os.arch=="amd64")) | (os.family == "solaris")
|
||||
* @requires vm.cds.custom.loaders
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
|
@ -28,8 +28,7 @@
|
||||
* custom loader classes.
|
||||
* (NOTE: AppCDS does not support uncompressed oops)
|
||||
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
|
||||
* @requires (sun.arch.data.model == "64")
|
||||
* @requires ((os.family == "linux") & (os.arch=="amd64")) | (os.family == "solaris")
|
||||
* @requires vm.cds.custom.loaders
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
|
@ -27,8 +27,7 @@
|
||||
* @summary Load classes from CDS archive into multiple custom loader using parallel threads
|
||||
* (NOTE: AppCDS does not support uncompressed oops)
|
||||
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
|
||||
* @requires (sun.arch.data.model == "64")
|
||||
* @requires ((os.family == "linux") & (os.arch=="amd64")) | (os.family == "solaris")
|
||||
* @requires vm.cds.custom.loaders
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
|
@ -27,8 +27,7 @@
|
||||
* @summary Load classes from CDS archive into a single custom loader using parallel threads (finger print)
|
||||
* (NOTE: AppCDS does not support uncompressed oops)
|
||||
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
|
||||
* @requires (sun.arch.data.model == "64")
|
||||
* @requires ((os.family == "linux") & (os.arch=="amd64")) | (os.family == "solaris")
|
||||
* @requires vm.cds.custom.loaders
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
|
@ -27,8 +27,7 @@
|
||||
* @summary Make sure prohibited packages cannot be stored into archive for custom loaders.
|
||||
* (NOTE: AppCDS does not support uncompressed oops)
|
||||
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
|
||||
* @requires (sun.arch.data.model == "64")
|
||||
* @requires ((os.family == "linux") & (os.arch=="amd64")) | (os.family == "solaris")
|
||||
* @requires vm.cds.custom.loaders
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
|
@ -28,8 +28,7 @@
|
||||
*
|
||||
* AppCDS does not support uncompressed oops
|
||||
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
|
||||
* @requires (sun.arch.data.model == "64")
|
||||
* @requires ((os.family == "linux") & (os.arch=="amd64")) | (os.family == "solaris")
|
||||
* @requires vm.cds.custom.loaders
|
||||
*
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @modules java.base/jdk.internal.misc
|
||||
|
@ -28,8 +28,7 @@
|
||||
*
|
||||
* (NOTE: AppCDS does not support uncompressed oops)
|
||||
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
|
||||
* @requires (sun.arch.data.model == "64")
|
||||
* @requires ((os.family == "linux") & (os.arch=="amd64")) | (os.family == "solaris")
|
||||
* @requires vm.cds.custom.loaders
|
||||
*
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @modules java.base/jdk.internal.misc
|
||||
|
@ -27,8 +27,7 @@
|
||||
* @summary Make sure classes intended for custom loaders cannot be loaded by BOOT/EXT/APP loaders
|
||||
* (NOTE: AppCDS does not support uncompressed oops)
|
||||
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
|
||||
* @requires (sun.arch.data.model == "64")
|
||||
* @requires ((os.family == "linux") & (os.arch=="amd64")) | (os.family == "solaris")
|
||||
* @requires vm.cds.custom.loaders
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
|
@ -28,8 +28,7 @@
|
||||
* unloaded.
|
||||
* (NOTE: AppCDS does not support uncompressed oops)
|
||||
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
|
||||
* @requires (sun.arch.data.model == "64")
|
||||
* @requires ((os.family == "linux") & (os.arch=="amd64")) | (os.family == "solaris")
|
||||
* @requires vm.cds.custom.loaders
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/testlibrary
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
|
@ -25,9 +25,9 @@
|
||||
/*
|
||||
* @test
|
||||
* @summary Ensure that support for AppCDS custom class loaders are not enabled on unsupported platforms.
|
||||
* The only supported platforms are Linux/AMD64 and 64-bit Solaris.
|
||||
* (NOTE: AppCDS does not support uncompressed oops)
|
||||
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
|
||||
* @requires vm.cds
|
||||
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
@ -55,8 +55,7 @@ public class UnsupportedPlatforms {
|
||||
|
||||
OutputAnalyzer out = TestCommon.dump(appJar, classlist);
|
||||
|
||||
if ((Platform.isSolaris() && Platform.is64bit()) ||
|
||||
(Platform.isLinux() && Platform.isX64())) {
|
||||
if (Platform.areCustomLoadersSupportedForCDS()) {
|
||||
out.shouldNotContain(PLATFORM_NOT_SUPPORTED_WARNING);
|
||||
out.shouldHaveExitValue(0);
|
||||
} else {
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import jdk.test.lib.Platform;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
// This class is intended to test 2 parent-child relationships:
|
||||
@ -148,7 +149,7 @@ public class TransformRelatedClassesAppCDS extends TransformRelatedClasses {
|
||||
|
||||
|
||||
private void runWithCustomLoader(ArrayList<TestEntry> testTable) throws Exception {
|
||||
if (!TestCommon.isCustomLoaderSupported()) {
|
||||
if (!Platform.areCustomLoadersSupportedForCDS()) {
|
||||
log("custom loader not supported for this platform" +
|
||||
" - skipping test case for custom loader");
|
||||
return;
|
||||
|
@ -74,6 +74,7 @@ public class VMProps implements Callable<Map<String, String>> {
|
||||
map.put("vm.aot", vmAOT());
|
||||
// vm.cds is true if the VM is compiled with cds support.
|
||||
map.put("vm.cds", vmCDS());
|
||||
map.put("vm.cds.custom.loaders", vmCDSForCustomLoaders());
|
||||
// vm.graal.enabled is true if Graal is used as JIT
|
||||
map.put("vm.graal.enabled", isGraalEnabled());
|
||||
map.put("docker.support", dockerSupport());
|
||||
@ -296,6 +297,19 @@ public class VMProps implements Callable<Map<String, String>> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for CDS support for custom loaders.
|
||||
*
|
||||
* @return true if CDS is supported for customer loader by the VM to be tested.
|
||||
*/
|
||||
protected String vmCDSForCustomLoaders() {
|
||||
if (vmCDS().equals("true") && Platform.areCustomLoadersSupportedForCDS()) {
|
||||
return "true";
|
||||
} else {
|
||||
return "false";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Graal is used as JIT compiler.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 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
|
||||
@ -288,4 +288,16 @@ public class Platform {
|
||||
return "so";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This should match the #if condition in ClassListParser::load_class_from_source().
|
||||
*/
|
||||
public static boolean areCustomLoadersSupportedForCDS() {
|
||||
boolean isLinux = Platform.isLinux();
|
||||
boolean is64 = Platform.is64bit();
|
||||
boolean isSolaris = Platform.isSolaris();
|
||||
boolean isAix = Platform.isAix();
|
||||
|
||||
return (is64 && (isLinux || isSolaris || isAix));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user