8241934: Simplify parse_stream() and remove has_class_mirror_holder_cld()
Added paramter to register_loader() which allowed removing of has_class_mirror_holder_cld() Reviewed-by: coleenp, lfoltan
This commit is contained in:
parent
3887904c16
commit
39670b0e57
src/hotspot/share/classfile
@ -877,12 +877,6 @@ void ClassLoaderData::free_deallocate_list_C_heap_structures() {
|
||||
}
|
||||
}
|
||||
|
||||
// These CLDs are to contain non-strong hidden classes or unsafe anonymous classes used for JSR292
|
||||
ClassLoaderData* ClassLoaderData::has_class_mirror_holder_cld(Handle loader) {
|
||||
// Add a new class loader data to the graph.
|
||||
return ClassLoaderDataGraph::add(loader, true);
|
||||
}
|
||||
|
||||
// Caller needs ResourceMark
|
||||
// If the class loader's _name has not been explicitly set, the class loader's
|
||||
// qualified class name is returned.
|
||||
|
@ -316,7 +316,6 @@ class ClassLoaderData : public CHeapObj<mtClass> {
|
||||
|
||||
static ClassLoaderData* class_loader_data(oop loader);
|
||||
static ClassLoaderData* class_loader_data_or_null(oop loader);
|
||||
static ClassLoaderData* has_class_mirror_holder_cld(Handle loader);
|
||||
|
||||
// Returns Klass* of associated class loader, or NULL if associated loader is 'bootstrap'.
|
||||
// Also works if unloading.
|
||||
|
@ -57,10 +57,10 @@ class ClassLoaderDataGraph : public AllStatic {
|
||||
static volatile size_t _num_array_classes;
|
||||
|
||||
static ClassLoaderData* add_to_graph(Handle class_loader, bool has_class_mirror_holder);
|
||||
static ClassLoaderData* add(Handle class_loader, bool has_class_mirror_holder);
|
||||
|
||||
public:
|
||||
static ClassLoaderData* find_or_create(Handle class_loader);
|
||||
static ClassLoaderData* add(Handle class_loader, bool has_class_mirror_holder);
|
||||
static void clean_module_and_package_info();
|
||||
static void purge();
|
||||
static void clear_claimed_marks();
|
||||
|
@ -182,9 +182,14 @@ void SystemDictionary::compute_java_loaders(TRAPS) {
|
||||
_java_platform_loader = (oop)result.get_jobject();
|
||||
}
|
||||
|
||||
ClassLoaderData* SystemDictionary::register_loader(Handle class_loader) {
|
||||
if (class_loader.is_null()) return ClassLoaderData::the_null_class_loader_data();
|
||||
return ClassLoaderDataGraph::find_or_create(class_loader);
|
||||
ClassLoaderData* SystemDictionary::register_loader(Handle class_loader, bool create_mirror_cld) {
|
||||
if (create_mirror_cld) {
|
||||
// Add a new class loader data to the graph.
|
||||
return ClassLoaderDataGraph::add(class_loader, true);
|
||||
} else {
|
||||
return (class_loader() == NULL) ? ClassLoaderData::the_null_class_loader_data() :
|
||||
ClassLoaderDataGraph::find_or_create(class_loader);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1031,27 +1036,19 @@ InstanceKlass* SystemDictionary::parse_stream(Symbol* class_name,
|
||||
TRAPS) {
|
||||
|
||||
EventClassLoad class_load_start_event;
|
||||
|
||||
ClassLoaderData* loader_data;
|
||||
|
||||
bool is_unsafe_anon_class = cl_info.unsafe_anonymous_host() != NULL;
|
||||
|
||||
if (is_unsafe_anon_class) {
|
||||
// - for unsafe anonymous class: create a new CLD whith a class holder that uses
|
||||
// the same class loader as the unsafe_anonymous_host.
|
||||
guarantee(cl_info.unsafe_anonymous_host()->class_loader() == class_loader(),
|
||||
"should be the same");
|
||||
loader_data = ClassLoaderData::has_class_mirror_holder_cld(class_loader);
|
||||
} else if (cl_info.is_hidden()) {
|
||||
// - for hidden classes that are not strong: create a new CLD that has a class holder and
|
||||
// whose loader is the Lookup class' loader.
|
||||
// - for hidden class: add the class to the Lookup class' loader's CLD.
|
||||
if (!cl_info.is_strong_hidden()) {
|
||||
loader_data = ClassLoaderData::has_class_mirror_holder_cld(class_loader);
|
||||
} else {
|
||||
// This hidden class goes into the regular CLD pool for this loader.
|
||||
loader_data = register_loader(class_loader);
|
||||
}
|
||||
// - for unsafe anonymous class: create a new CLD whith a class holder that uses
|
||||
// the same class loader as the unsafe_anonymous_host.
|
||||
// - for hidden classes that are not strong: create a new CLD that has a class holder and
|
||||
// whose loader is the Lookup class's loader.
|
||||
// - for hidden class: add the class to the Lookup class's loader's CLD.
|
||||
if (is_unsafe_anon_class || cl_info.is_hidden()) {
|
||||
guarantee(!is_unsafe_anon_class || cl_info.unsafe_anonymous_host()->class_loader() == class_loader(),
|
||||
"should be NULL or the same");
|
||||
bool create_mirror_cld = is_unsafe_anon_class || !cl_info.is_strong_hidden();
|
||||
loader_data = register_loader(class_loader, create_mirror_cld);
|
||||
} else {
|
||||
loader_data = ClassLoaderData::class_loader_data(class_loader());
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ public:
|
||||
static void compute_java_loaders(TRAPS);
|
||||
|
||||
// Register a new class loader
|
||||
static ClassLoaderData* register_loader(Handle class_loader);
|
||||
static ClassLoaderData* register_loader(Handle class_loader, bool create_mirror_cld = false);
|
||||
protected:
|
||||
// Mirrors for primitive classes (created eagerly)
|
||||
static oop check_mirror(oop m) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user