Skip to content

Commit 363327e

Browse files
author
Matias Saavedra Silva
committed
8341452: Test runtime/cds/appcds/DumpRuntimeClassesTest.java from JDK-8324259 is failing
Reviewed-by: dholmes, iklam
1 parent d6f8b46 commit 363327e

File tree

6 files changed

+30
-25
lines changed

6 files changed

+30
-25
lines changed

src/hotspot/share/cds/cdsProtectionDomain.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -199,24 +199,27 @@ Handle CDSProtectionDomain::get_shared_jar_manifest(int shared_path_index, TRAPS
199199
Handle CDSProtectionDomain::get_shared_jar_url(int shared_path_index, TRAPS) {
200200
Handle url_h;
201201
if (shared_jar_url(shared_path_index) == nullptr) {
202-
JavaValue result(T_OBJECT);
203202
const char* path = FileMapInfo::shared_path_name(shared_path_index);
204-
Handle path_string = java_lang_String::create_from_str(path, CHECK_(url_h));
205-
Klass* classLoaders_klass =
206-
vmClasses::jdk_internal_loader_ClassLoaders_klass();
207-
JavaCalls::call_static(&result, classLoaders_klass,
208-
vmSymbols::toFileURL_name(),
209-
vmSymbols::toFileURL_signature(),
210-
path_string, CHECK_(url_h));
211-
212-
atomic_set_shared_jar_url(shared_path_index, result.get_oop());
203+
oop result_oop = to_file_URL(path, url_h, CHECK_(url_h));
204+
atomic_set_shared_jar_url(shared_path_index, result_oop);
213205
}
214206

215207
url_h = Handle(THREAD, shared_jar_url(shared_path_index));
216208
assert(url_h.not_null(), "sanity");
217209
return url_h;
218210
}
219211

212+
oop CDSProtectionDomain::to_file_URL(const char* path, Handle url_h, TRAPS) {
213+
JavaValue result(T_OBJECT);
214+
Handle path_string = java_lang_String::create_from_str(path, CHECK_NULL);
215+
JavaCalls::call_static(&result,
216+
vmClasses::jdk_internal_loader_ClassLoaders_klass(),
217+
vmSymbols::toFileURL_name(),
218+
vmSymbols::toFileURL_signature(),
219+
path_string, CHECK_NULL);
220+
return result.get_oop();
221+
}
222+
220223
// Get the ProtectionDomain associated with the CodeSource from the classloader.
221224
Handle CDSProtectionDomain::get_protection_domain_from_classloader(Handle class_loader,
222225
Handle url, TRAPS) {

src/hotspot/share/cds/cdsProtectionDomain.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class CDSProtectionDomain : AllStatic {
8080
static Handle create_jar_manifest(const char* man, size_t size, TRAPS);
8181
static Handle get_shared_jar_manifest(int shared_path_index, TRAPS);
8282
static Handle get_shared_jar_url(int shared_path_index, TRAPS);
83+
static oop to_file_URL(const char* path, Handle url_h, TRAPS);
8384
static Handle get_protection_domain_from_classloader(Handle class_loader,
8485
Handle url, TRAPS);
8586
static Handle get_shared_protection_domain(Handle class_loader,

src/hotspot/share/cds/metaspaceShared.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -751,12 +751,21 @@ void MetaspaceShared::preload_classes(TRAPS) {
751751
}
752752
}
753753

754-
// Exercise the manifest processing code to ensure classes used by CDS at runtime
755-
// are always archived
754+
// Some classes are used at CDS runtime but are not loaded, and therefore archived, at
755+
// dumptime. We can perform dummmy calls to these classes at dumptime to ensure they
756+
// are archived.
757+
exercise_runtime_cds_code(CHECK);
758+
759+
log_info(cds)("Loading classes to share: done.");
760+
}
761+
762+
void MetaspaceShared::exercise_runtime_cds_code(TRAPS) {
763+
// Exercise the manifest processing code
756764
const char* dummy = "Manifest-Version: 1.0\n";
757765
CDSProtectionDomain::create_jar_manifest(dummy, strlen(dummy), CHECK);
758766

759-
log_info(cds)("Loading classes to share: done.");
767+
// Exercise FileSystem and URL code
768+
CDSProtectionDomain::to_file_URL("dummy.jar", Handle(), CHECK);
760769
}
761770

762771
void MetaspaceShared::preload_and_dump_impl(StaticArchiveBuilder& builder, TRAPS) {
@@ -799,16 +808,6 @@ void MetaspaceShared::preload_and_dump_impl(StaticArchiveBuilder& builder, TRAPS
799808
}
800809
#endif
801810

802-
// Dummy call to load classes used at CDS runtime
803-
JavaValue result(T_OBJECT);
804-
Handle path_string = java_lang_String::create_from_str("dummy.jar", CHECK);
805-
JavaCalls::call_static(&result,
806-
vmClasses::jdk_internal_loader_ClassLoaders_klass(),
807-
vmSymbols::toFileURL_name(),
808-
vmSymbols::toFileURL_signature(),
809-
path_string,
810-
CHECK);
811-
812811
VM_PopulateDumpSharedSpace op(builder);
813812
VMThread::execute(&op);
814813

src/hotspot/share/cds/metaspaceShared.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class MetaspaceShared : AllStatic {
7575
#endif
7676

7777
private:
78+
static void exercise_runtime_cds_code(TRAPS) NOT_CDS_RETURN;
7879
static void preload_and_dump_impl(StaticArchiveBuilder& builder, TRAPS) NOT_CDS_RETURN;
7980
static void preload_classes(TRAPS) NOT_CDS_RETURN;
8081

test/hotspot/jtreg/ProblemList-Xcomp.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,4 @@ compiler/cha/TypeProfileFinalMethod.java 8341039 generic-all
5656

5757
gc/arguments/TestNewSizeFlags.java 8299116 macosx-aarch64
5858

59-
runtime/cds/appcds/DumpRuntimeClassesTest.java 8341452 generic-all
60-
6159
runtime/condy/escapeAnalysis/TestEscapeCondy.java 8339694 generic-all

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
* @summary Classes used by CDS at runtime should be in the archived
2828
* @bug 8324259
2929
* @requires vm.cds
30+
* @requires vm.compMode != "Xcomp"
31+
* @comment Running this test with -Xcomp may load other classes which
32+
* are not used in other modes
3033
* @library /test/lib
3134
* @compile test-classes/Hello.java
3235
* @run driver DumpRuntimeClassesTest

0 commit comments

Comments
 (0)