8193434: [GRAAL] Graal classes are not loaded with -Xshare:dump
Allow loading of non-boot classes during CDS dumping but only add boot classes to the archive Reviewed-by: kvn, iklam, jiangli
This commit is contained in:
parent
8f1e5bc574
commit
efcc8d2558
@ -1056,15 +1056,6 @@ InstanceKlass* SystemDictionary::resolve_from_stream(Symbol* class_name,
|
||||
Handle protection_domain,
|
||||
ClassFileStream* st,
|
||||
TRAPS) {
|
||||
#if INCLUDE_CDS
|
||||
ResourceMark rm(THREAD);
|
||||
if (DumpSharedSpaces && !class_loader.is_null() &&
|
||||
!UseAppCDS && strcmp(class_name->as_C_string(), "Unnamed") != 0) {
|
||||
// If AppCDS is not enabled, don't define the class at dump time (except for the "Unnamed"
|
||||
// class, which is used by MethodHandles).
|
||||
THROW_MSG_NULL(vmSymbols::java_lang_ClassNotFoundException(), class_name->as_C_string());
|
||||
}
|
||||
#endif
|
||||
|
||||
HandleMark hm(THREAD);
|
||||
|
||||
@ -3079,13 +3070,17 @@ class CombineDictionariesClosure : public CLDClosure {
|
||||
}
|
||||
};
|
||||
|
||||
// Combining platform and system loader dictionaries into boot loader dictionaries.
|
||||
// Combining platform and system loader dictionaries into boot loader dictionary.
|
||||
// During run time, we only have one shared dictionary.
|
||||
void SystemDictionary::combine_shared_dictionaries() {
|
||||
assert(DumpSharedSpaces, "dump time only");
|
||||
Dictionary* master_dictionary = ClassLoaderData::the_null_class_loader_data()->dictionary();
|
||||
CombineDictionariesClosure cdc(master_dictionary);
|
||||
ClassLoaderDataGraph::cld_do(&cdc);
|
||||
// If AppCDS isn't enabled, we only dump the classes in the boot loader dictionary
|
||||
// into the shared archive.
|
||||
if (UseAppCDS) {
|
||||
Dictionary* master_dictionary = ClassLoaderData::the_null_class_loader_data()->dictionary();
|
||||
CombineDictionariesClosure cdc(master_dictionary);
|
||||
ClassLoaderDataGraph::cld_do(&cdc);
|
||||
}
|
||||
|
||||
// These tables are no longer valid or necessary. Keeping them around will
|
||||
// cause SystemDictionary::verify() to fail. Let's empty them.
|
||||
|
@ -450,6 +450,11 @@ static void collect_array_classes(Klass* k) {
|
||||
|
||||
class CollectClassesClosure : public KlassClosure {
|
||||
void do_klass(Klass* k) {
|
||||
if (!UseAppCDS && !k->class_loader_data()->is_the_null_class_loader_data()) {
|
||||
// AppCDS is not enabled. Let's omit non-boot classes.
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(k->is_instance_klass() && InstanceKlass::cast(k)->is_in_error_state())) {
|
||||
if (k->is_instance_klass() && InstanceKlass::cast(k)->signers() != NULL) {
|
||||
// Mark any class with signers and don't add to the _global_klass_objects
|
||||
|
@ -87,8 +87,11 @@ public class UseAppCDS {
|
||||
// Next tests rely on the classlist we just dumped
|
||||
|
||||
// Test 3: No AppCDS - "test" classes in classlist ignored when dumping
|
||||
// Although AppCDS isn't used, all classes will be found during dumping
|
||||
// after the fix for JDK-8193434. Classes which are not in the boot
|
||||
// loader dictionary will not be saved into the archive.
|
||||
dumpArchive(false, new String[] { BOOTCLASS },
|
||||
new String[] { TESTNAME});
|
||||
new String[0]);
|
||||
|
||||
// Test 4: AppCDS - "test" classes in classlist are dumped
|
||||
dumpArchive(true, new String[] { BOOTCLASS, TESTNAME },
|
||||
|
Loading…
Reference in New Issue
Block a user