Skip to content

Commit 603bba2

Browse files
committedNov 3, 2021
8271420: Extend CDS custom loader support to Windows platform
Reviewed-by: iklam, ccheung
1 parent ce8c767 commit 603bba2

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed
 

‎src/hotspot/share/cds/classListParser.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,9 @@ void ClassListParser::error(const char* msg, ...) {
446446
// This function is used for loading classes for customized class loaders
447447
// during archive dumping.
448448
InstanceKlass* ClassListParser::load_class_from_source(Symbol* class_name, TRAPS) {
449-
#if !(defined(_LP64) && (defined(LINUX) || defined(__APPLE__)))
449+
#if !(defined(_LP64) && (defined(LINUX) || defined(__APPLE__) || defined(_WINDOWS)))
450450
// The only supported platforms are: (1) Linux/64-bit and (2) Solaris/64-bit and
451-
// (3) MacOSX/64-bit
451+
// (3) MacOSX/64-bit and (4) Windowss/64-bit
452452
// This #if condition should be in sync with the areCustomLoadersSupportedForCDS
453453
// method in test/lib/jdk/test/lib/Platform.java.
454454
error("AppCDS custom class loaders not supported on this platform");

‎test/hotspot/jtreg/runtime/cds/appcds/loaderConstraints/LoaderConstraintsTest.java

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
import com.sun.net.httpserver.HttpHandler;
5252
import jdk.test.lib.Asserts;
5353
import jdk.test.lib.helpers.ClassFileInstaller;
54-
import jdk.test.lib.Platform;
5554

5655
public class LoaderConstraintsTest {
5756
static String mainClass = LoaderConstraintsApp.class.getName();

‎test/hotspot/jtreg/runtime/cds/appcds/test-classes/CustomAppLoader.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class CustomAppLoader {
4040
// args[2...] = arguments for the main class
4141
public static void main(String args[]) throws Throwable {
4242
File f = new File(args[0]);
43-
URL[] classLoaderUrls = new URL[] {new URL("file://" + f.getCanonicalPath())};
43+
URL[] classLoaderUrls = new URL[] {f.getAbsoluteFile().toURI().toURL()};
4444
URLClassLoader loader = new URLClassLoader(classLoaderUrls, CustomAppLoader.class.getClassLoader());
4545
Class k = Class.forName(args[1], true, loader);
4646
Class parameterTypes[] = new Class[] {String[].class};
@@ -52,4 +52,4 @@ public static void main(String args[]) throws Throwable {
5252
}
5353
mainMethod.invoke(null, invokeArgs);
5454
}
55-
}
55+
}

‎test/lib/jdk/test/lib/Platform.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,6 @@ public static boolean isDefaultCDSArchiveSupported() {
387387
* This should match the #if condition in ClassListParser::load_class_from_source().
388388
*/
389389
public static boolean areCustomLoadersSupportedForCDS() {
390-
return (is64bit() && (isLinux() || isOSX()));
390+
return (is64bit() && (isLinux() || isOSX() || isWindows()));
391391
}
392392
}

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Nov 3, 2021

@openjdk-notifier[bot]
Please sign in to comment.