Skip to content
Permalink
Browse files
8271420: Extend CDS custom loader support to Windows platform
Reviewed-by: iklam, ccheung
  • Loading branch information
yminqi committed Nov 3, 2021
1 parent ce8c767 commit 603bba282a089928fd23f8da23a7c1b2d52944ef
Showing 4 changed files with 5 additions and 6 deletions.
@@ -446,9 +446,9 @@ 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(_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
// (3) MacOSX/64-bit
// (3) MacOSX/64-bit and (4) Windowss/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");
@@ -51,7 +51,6 @@
import com.sun.net.httpserver.HttpHandler;
import jdk.test.lib.Asserts;
import jdk.test.lib.helpers.ClassFileInstaller;
import jdk.test.lib.Platform;

public class LoaderConstraintsTest {
static String mainClass = LoaderConstraintsApp.class.getName();
@@ -40,7 +40,7 @@ public class CustomAppLoader {
// args[2...] = arguments for the main class
public static void main(String args[]) throws Throwable {
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());
Class k = Class.forName(args[1], true, loader);
Class parameterTypes[] = new Class[] {String[].class};
@@ -52,4 +52,4 @@ public static void main(String args[]) throws Throwable {
}
mainMethod.invoke(null, invokeArgs);
}
}
}
@@ -387,6 +387,6 @@ public static boolean isDefaultCDSArchiveSupported() {
* This should match the #if condition in ClassListParser::load_class_from_source().
*/
public static boolean areCustomLoadersSupportedForCDS() {
return (is64bit() && (isLinux() || isOSX()));
return (is64bit() && (isLinux() || isOSX() || isWindows()));
}
}

1 comment on commit 603bba2

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 603bba2 Nov 3, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.