< prev index next >
src/hotspot/share/classfile/systemDictionaryShared.cpp
Print this page
*** 358,370 ****
}
bool SystemDictionaryShared::is_sharing_possible(ClassLoaderData* loader_data) {
oop class_loader = loader_data->class_loader();
return (class_loader == NULL ||
! (UseAppCDS && (SystemDictionary::is_system_class_loader(class_loader) ||
! SystemDictionary::is_platform_class_loader(class_loader)))
! );
}
// Currently AppCDS only archives classes from the run-time image, the
// -Xbootclasspath/a path, the class path, and the module path.
//
--- 358,369 ----
}
bool SystemDictionaryShared::is_sharing_possible(ClassLoaderData* loader_data) {
oop class_loader = loader_data->class_loader();
return (class_loader == NULL ||
! SystemDictionary::is_system_class_loader(class_loader) ||
! SystemDictionary::is_platform_class_loader(class_loader));
}
// Currently AppCDS only archives classes from the run-time image, the
// -Xbootclasspath/a path, the class path, and the module path.
//
*** 506,524 ****
//
// An alternative is to modify the Java code of AppClassLoader.loadClass().
//
InstanceKlass* SystemDictionaryShared::find_or_load_shared_class(
Symbol* name, Handle class_loader, TRAPS) {
! if (DumpSharedSpaces) {
return NULL;
}
- InstanceKlass* k = NULL;
if (shared_dictionary() != NULL &&
! UseAppCDS && (SystemDictionary::is_system_class_loader(class_loader()) ||
SystemDictionary::is_platform_class_loader(class_loader()))) {
-
// Fix for 4474172; see evaluation for more details
class_loader = Handle(
THREAD, java_lang_ClassLoader::non_reflection_class_loader(class_loader()));
ClassLoaderData *loader_data = register_loader(class_loader);
Dictionary* dictionary = loader_data->dictionary();
--- 505,524 ----
//
// An alternative is to modify the Java code of AppClassLoader.loadClass().
//
InstanceKlass* SystemDictionaryShared::find_or_load_shared_class(
Symbol* name, Handle class_loader, TRAPS) {
! InstanceKlass* k = NULL;
! if (UseSharedSpaces) {
! FileMapHeaderExt* header = (FileMapHeaderExt*)FileMapInfo::current_info()->header();
! if (!header->has_platform_or_app_classes()) {
return NULL;
}
if (shared_dictionary() != NULL &&
! (SystemDictionary::is_system_class_loader(class_loader()) ||
SystemDictionary::is_platform_class_loader(class_loader()))) {
// Fix for 4474172; see evaluation for more details
class_loader = Handle(
THREAD, java_lang_ClassLoader::non_reflection_class_loader(class_loader()));
ClassLoaderData *loader_data = register_loader(class_loader);
Dictionary* dictionary = loader_data->dictionary();
*** 550,566 ****
k = load_shared_class_for_builtin_loader(name, class_loader, THREAD);
if (k != NULL) {
define_instance_class(k, CHECK_NULL);
}
}
!
return k;
}
InstanceKlass* SystemDictionaryShared::load_shared_class_for_builtin_loader(
Symbol* class_name, Handle class_loader, TRAPS) {
! assert(UseAppCDS && shared_dictionary() != NULL, "already checked");
Klass* k = shared_dictionary()->find_class_for_builtin_loader(class_name);
if (k != NULL) {
InstanceKlass* ik = InstanceKlass::cast(k);
if ((ik->is_shared_app_class() &&
--- 550,567 ----
k = load_shared_class_for_builtin_loader(name, class_loader, THREAD);
if (k != NULL) {
define_instance_class(k, CHECK_NULL);
}
}
! }
return k;
}
InstanceKlass* SystemDictionaryShared::load_shared_class_for_builtin_loader(
Symbol* class_name, Handle class_loader, TRAPS) {
! assert(UseSharedSpaces, "must be");
! assert(shared_dictionary() != NULL, "already checked");
Klass* k = shared_dictionary()->find_class_for_builtin_loader(class_name);
if (k != NULL) {
InstanceKlass* ik = InstanceKlass::cast(k);
if ((ik->is_shared_app_class() &&
*** 607,632 ****
allocate_shared_protection_domain_array(size, CHECK);
allocate_shared_jar_url_array(size, CHECK);
allocate_shared_jar_manifest_array(size, CHECK);
}
!
InstanceKlass* SystemDictionaryShared::lookup_from_stream(const Symbol* class_name,
Handle class_loader,
Handle protection_domain,
const ClassFileStream* cfs,
TRAPS) {
! if (!UseAppCDS || shared_dictionary() == NULL) {
return NULL;
}
if (class_name == NULL) { // don't do this for anonymous classes
return NULL;
}
if (class_loader.is_null() ||
SystemDictionary::is_system_class_loader(class_loader()) ||
SystemDictionary::is_platform_class_loader(class_loader())) {
- // This function is called for loading only UNREGISTERED classes.
// Do nothing for the BUILTIN loaders.
return NULL;
}
ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(class_loader());
--- 608,632 ----
allocate_shared_protection_domain_array(size, CHECK);
allocate_shared_jar_url_array(size, CHECK);
allocate_shared_jar_manifest_array(size, CHECK);
}
! // This function is called for loading only UNREGISTERED classes
InstanceKlass* SystemDictionaryShared::lookup_from_stream(const Symbol* class_name,
Handle class_loader,
Handle protection_domain,
const ClassFileStream* cfs,
TRAPS) {
! if (shared_dictionary() == NULL) {
return NULL;
}
if (class_name == NULL) { // don't do this for anonymous classes
return NULL;
}
if (class_loader.is_null() ||
SystemDictionary::is_system_class_loader(class_loader()) ||
SystemDictionary::is_platform_class_loader(class_loader())) {
// Do nothing for the BUILTIN loaders.
return NULL;
}
ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(class_loader());
*** 684,698 ****
}
return shared_klass;
}
! bool SystemDictionaryShared::add_non_builtin_klass(Symbol* name, ClassLoaderData* loader_data,
InstanceKlass* k,
TRAPS) {
assert(DumpSharedSpaces, "only when dumping");
! assert(UseAppCDS && boot_loader_dictionary() != NULL, "must be");
if (boot_loader_dictionary()->add_non_builtin_klass(name, loader_data, k)) {
MutexLocker mu_r(Compile_lock, THREAD); // not really necessary, but add_to_hierarchy asserts this.
add_to_hierarchy(k, CHECK_0);
return true;
--- 684,699 ----
}
return shared_klass;
}
! bool SystemDictionaryShared::add_non_builtin_klass(Symbol* name,
! ClassLoaderData* loader_data,
InstanceKlass* k,
TRAPS) {
assert(DumpSharedSpaces, "only when dumping");
! assert(boot_loader_dictionary() != NULL, "must be");
if (boot_loader_dictionary()->add_non_builtin_klass(name, loader_data, k)) {
MutexLocker mu_r(Compile_lock, THREAD); // not really necessary, but add_to_hierarchy asserts this.
add_to_hierarchy(k, CHECK_0);
return true;
< prev index next >