8271420: Extend CDS custom loader support to Windows platform
Reviewed-by: iklam, ccheung
This commit is contained in:
parent
ce8c76700b
commit
603bba282a
@ -446,9 +446,9 @@ void ClassListParser::error(const char* msg, ...) {
|
|||||||
// This function is used for loading classes for customized class loaders
|
// This function is used for loading classes for customized class loaders
|
||||||
// during archive dumping.
|
// during archive dumping.
|
||||||
InstanceKlass* ClassListParser::load_class_from_source(Symbol* class_name, TRAPS) {
|
InstanceKlass* ClassListParser::load_class_from_source(Symbol* class_name, TRAPS) {
|
||||||
#if !(defined(_LP64) && (defined(LINUX) || defined(__APPLE__)))
|
#if !(defined(_LP64) && (defined(LINUX) || defined(__APPLE__) || defined(_WINDOWS)))
|
||||||
// The only supported platforms are: (1) Linux/64-bit and (2) Solaris/64-bit and
|
// The only supported platforms are: (1) Linux/64-bit and (2) Solaris/64-bit and
|
||||||
// (3) MacOSX/64-bit
|
// (3) MacOSX/64-bit and (4) Windowss/64-bit
|
||||||
// This #if condition should be in sync with the areCustomLoadersSupportedForCDS
|
// This #if condition should be in sync with the areCustomLoadersSupportedForCDS
|
||||||
// method in test/lib/jdk/test/lib/Platform.java.
|
// method in test/lib/jdk/test/lib/Platform.java.
|
||||||
error("AppCDS custom class loaders not supported on this platform");
|
error("AppCDS custom class loaders not supported on this platform");
|
||||||
|
@ -51,7 +51,6 @@ import com.sun.net.httpserver.HttpExchange;
|
|||||||
import com.sun.net.httpserver.HttpHandler;
|
import com.sun.net.httpserver.HttpHandler;
|
||||||
import jdk.test.lib.Asserts;
|
import jdk.test.lib.Asserts;
|
||||||
import jdk.test.lib.helpers.ClassFileInstaller;
|
import jdk.test.lib.helpers.ClassFileInstaller;
|
||||||
import jdk.test.lib.Platform;
|
|
||||||
|
|
||||||
public class LoaderConstraintsTest {
|
public class LoaderConstraintsTest {
|
||||||
static String mainClass = LoaderConstraintsApp.class.getName();
|
static String mainClass = LoaderConstraintsApp.class.getName();
|
||||||
|
@ -40,7 +40,7 @@ public class CustomAppLoader {
|
|||||||
// args[2...] = arguments for the main class
|
// args[2...] = arguments for the main class
|
||||||
public static void main(String args[]) throws Throwable {
|
public static void main(String args[]) throws Throwable {
|
||||||
File f = new File(args[0]);
|
File f = new File(args[0]);
|
||||||
URL[] classLoaderUrls = new URL[] {new URL("file://" + f.getCanonicalPath())};
|
URL[] classLoaderUrls = new URL[] {f.getAbsoluteFile().toURI().toURL()};
|
||||||
URLClassLoader loader = new URLClassLoader(classLoaderUrls, CustomAppLoader.class.getClassLoader());
|
URLClassLoader loader = new URLClassLoader(classLoaderUrls, CustomAppLoader.class.getClassLoader());
|
||||||
Class k = Class.forName(args[1], true, loader);
|
Class k = Class.forName(args[1], true, loader);
|
||||||
Class parameterTypes[] = new Class[] {String[].class};
|
Class parameterTypes[] = new Class[] {String[].class};
|
||||||
@ -52,4 +52,4 @@ public class CustomAppLoader {
|
|||||||
}
|
}
|
||||||
mainMethod.invoke(null, invokeArgs);
|
mainMethod.invoke(null, invokeArgs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -387,6 +387,6 @@ public class Platform {
|
|||||||
* This should match the #if condition in ClassListParser::load_class_from_source().
|
* This should match the #if condition in ClassListParser::load_class_from_source().
|
||||||
*/
|
*/
|
||||||
public static boolean areCustomLoadersSupportedForCDS() {
|
public static boolean areCustomLoadersSupportedForCDS() {
|
||||||
return (is64bit() && (isLinux() || isOSX()));
|
return (is64bit() && (isLinux() || isOSX() || isWindows()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user