Skip to content

Commit dc7683a

Browse files
committed
8308073: ClassLoaderExt::append_boot_classpath should handle dynamic archive
Reviewed-by: iklam, matsaave
1 parent 4870234 commit dc7683a

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/hotspot/share/classfile/classLoaderExt.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#include "precompiled.hpp"
2626
#include "cds/cds_globals.hpp"
27+
#include "cds/dynamicArchive.hpp"
2728
#include "cds/filemap.hpp"
2829
#include "cds/heapShared.hpp"
2930
#include "classfile/classFileParser.hpp"
@@ -60,6 +61,9 @@ void ClassLoaderExt::append_boot_classpath(ClassPathEntry* new_entry) {
6061
if (UseSharedSpaces) {
6162
warning("Sharing is only supported for boot loader classes because bootstrap classpath has been appended");
6263
FileMapInfo::current_info()->set_has_platform_or_app_classes(false);
64+
if (DynamicArchive::is_mapped()) {
65+
FileMapInfo::dynamic_info()->set_has_platform_or_app_classes(false);
66+
}
6367
}
6468
ClassLoader::add_to_boot_append_entries(new_entry);
6569
}

test/hotspot/jtreg/runtime/cds/appcds/JvmtiAddPath.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -81,9 +81,7 @@ public static void main(String[] args) throws Exception {
8181
run(check_appcds_enabled, appJar, "-Xlog:class+load", "JvmtiApp", "noadd"); // appcds should be enabled
8282

8383
System.out.println("Test case 2: add to boot classpath only - should find Hello.class in boot loader");
84-
String[] toCheck = (TestCommon.isDynamicArchive()) ? check_appcds_enabled
85-
: check_appcds_disabled;
86-
run(toCheck, appJar, "-Xlog:class+load", "JvmtiApp", "bootonly", addbootJar); // appcds should be disabled
84+
run(check_appcds_disabled, appJar, "-Xlog:class+load", "JvmtiApp", "bootonly", addbootJar); // appcds should be disabled
8785

8886
System.out.println("Test case 3: add to app classpath only - should find Hello.class in app loader");
8987
run(appJar, "JvmtiApp", "apponly", addappJar);

test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/JvmtiAddPath.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -119,9 +119,7 @@ public static void main(String[] args) throws Exception {
119119
"-Xlog:class+load", "JvmtiApp", "noadd", MAIN_CLASS); // appcds should be enabled
120120

121121
System.out.println("Test case 2: add to boot classpath only - should find Hello.class in boot loader");
122-
String[] toCheck = TestCommon.isDynamicArchive() ? check_appcds_enabled :
123-
check_appcds_disabled;
124-
run(toCheck, appJar,
122+
run(check_appcds_disabled, appJar,
125123
"-Xlog:class+load=trace",
126124
modulePath,
127125
"JvmtiApp", "bootonly", addbootJar, MAIN_CLASS); // appcds should be disabled

0 commit comments

Comments
 (0)