8341452: Test runtime/cds/appcds/DumpRuntimeClassesTest.java from JDK-8324259 is failing
Reviewed-by: dholmes, iklam
This commit is contained in:
parent
d6f8b465e4
commit
363327e686
@ -199,17 +199,9 @@ Handle CDSProtectionDomain::get_shared_jar_manifest(int shared_path_index, TRAPS
|
||||
Handle CDSProtectionDomain::get_shared_jar_url(int shared_path_index, TRAPS) {
|
||||
Handle url_h;
|
||||
if (shared_jar_url(shared_path_index) == nullptr) {
|
||||
JavaValue result(T_OBJECT);
|
||||
const char* path = FileMapInfo::shared_path_name(shared_path_index);
|
||||
Handle path_string = java_lang_String::create_from_str(path, CHECK_(url_h));
|
||||
Klass* classLoaders_klass =
|
||||
vmClasses::jdk_internal_loader_ClassLoaders_klass();
|
||||
JavaCalls::call_static(&result, classLoaders_klass,
|
||||
vmSymbols::toFileURL_name(),
|
||||
vmSymbols::toFileURL_signature(),
|
||||
path_string, CHECK_(url_h));
|
||||
|
||||
atomic_set_shared_jar_url(shared_path_index, result.get_oop());
|
||||
oop result_oop = to_file_URL(path, url_h, CHECK_(url_h));
|
||||
atomic_set_shared_jar_url(shared_path_index, result_oop);
|
||||
}
|
||||
|
||||
url_h = Handle(THREAD, shared_jar_url(shared_path_index));
|
||||
@ -217,6 +209,17 @@ Handle CDSProtectionDomain::get_shared_jar_url(int shared_path_index, TRAPS) {
|
||||
return url_h;
|
||||
}
|
||||
|
||||
oop CDSProtectionDomain::to_file_URL(const char* path, Handle url_h, TRAPS) {
|
||||
JavaValue result(T_OBJECT);
|
||||
Handle path_string = java_lang_String::create_from_str(path, CHECK_NULL);
|
||||
JavaCalls::call_static(&result,
|
||||
vmClasses::jdk_internal_loader_ClassLoaders_klass(),
|
||||
vmSymbols::toFileURL_name(),
|
||||
vmSymbols::toFileURL_signature(),
|
||||
path_string, CHECK_NULL);
|
||||
return result.get_oop();
|
||||
}
|
||||
|
||||
// Get the ProtectionDomain associated with the CodeSource from the classloader.
|
||||
Handle CDSProtectionDomain::get_protection_domain_from_classloader(Handle class_loader,
|
||||
Handle url, TRAPS) {
|
||||
|
@ -80,6 +80,7 @@ public:
|
||||
static Handle create_jar_manifest(const char* man, size_t size, TRAPS);
|
||||
static Handle get_shared_jar_manifest(int shared_path_index, TRAPS);
|
||||
static Handle get_shared_jar_url(int shared_path_index, TRAPS);
|
||||
static oop to_file_URL(const char* path, Handle url_h, TRAPS);
|
||||
static Handle get_protection_domain_from_classloader(Handle class_loader,
|
||||
Handle url, TRAPS);
|
||||
static Handle get_shared_protection_domain(Handle class_loader,
|
||||
|
@ -751,12 +751,21 @@ void MetaspaceShared::preload_classes(TRAPS) {
|
||||
}
|
||||
}
|
||||
|
||||
// Exercise the manifest processing code to ensure classes used by CDS at runtime
|
||||
// are always archived
|
||||
// Some classes are used at CDS runtime but are not loaded, and therefore archived, at
|
||||
// dumptime. We can perform dummmy calls to these classes at dumptime to ensure they
|
||||
// are archived.
|
||||
exercise_runtime_cds_code(CHECK);
|
||||
|
||||
log_info(cds)("Loading classes to share: done.");
|
||||
}
|
||||
|
||||
void MetaspaceShared::exercise_runtime_cds_code(TRAPS) {
|
||||
// Exercise the manifest processing code
|
||||
const char* dummy = "Manifest-Version: 1.0\n";
|
||||
CDSProtectionDomain::create_jar_manifest(dummy, strlen(dummy), CHECK);
|
||||
|
||||
log_info(cds)("Loading classes to share: done.");
|
||||
// Exercise FileSystem and URL code
|
||||
CDSProtectionDomain::to_file_URL("dummy.jar", Handle(), CHECK);
|
||||
}
|
||||
|
||||
void MetaspaceShared::preload_and_dump_impl(StaticArchiveBuilder& builder, TRAPS) {
|
||||
@ -799,16 +808,6 @@ void MetaspaceShared::preload_and_dump_impl(StaticArchiveBuilder& builder, TRAPS
|
||||
}
|
||||
#endif
|
||||
|
||||
// Dummy call to load classes used at CDS runtime
|
||||
JavaValue result(T_OBJECT);
|
||||
Handle path_string = java_lang_String::create_from_str("dummy.jar", CHECK);
|
||||
JavaCalls::call_static(&result,
|
||||
vmClasses::jdk_internal_loader_ClassLoaders_klass(),
|
||||
vmSymbols::toFileURL_name(),
|
||||
vmSymbols::toFileURL_signature(),
|
||||
path_string,
|
||||
CHECK);
|
||||
|
||||
VM_PopulateDumpSharedSpace op(builder);
|
||||
VMThread::execute(&op);
|
||||
|
||||
|
@ -75,6 +75,7 @@ class MetaspaceShared : AllStatic {
|
||||
#endif
|
||||
|
||||
private:
|
||||
static void exercise_runtime_cds_code(TRAPS) NOT_CDS_RETURN;
|
||||
static void preload_and_dump_impl(StaticArchiveBuilder& builder, TRAPS) NOT_CDS_RETURN;
|
||||
static void preload_classes(TRAPS) NOT_CDS_RETURN;
|
||||
|
||||
|
@ -56,6 +56,4 @@ compiler/cha/TypeProfileFinalMethod.java 8341039 generic-all
|
||||
|
||||
gc/arguments/TestNewSizeFlags.java 8299116 macosx-aarch64
|
||||
|
||||
runtime/cds/appcds/DumpRuntimeClassesTest.java 8341452 generic-all
|
||||
|
||||
runtime/condy/escapeAnalysis/TestEscapeCondy.java 8339694 generic-all
|
||||
|
@ -27,6 +27,9 @@
|
||||
* @summary Classes used by CDS at runtime should be in the archived
|
||||
* @bug 8324259
|
||||
* @requires vm.cds
|
||||
* @requires vm.compMode != "Xcomp"
|
||||
* @comment Running this test with -Xcomp may load other classes which
|
||||
* are not used in other modes
|
||||
* @library /test/lib
|
||||
* @compile test-classes/Hello.java
|
||||
* @run driver DumpRuntimeClassesTest
|
||||
|
Loading…
Reference in New Issue
Block a user