8305509: C1 fails "assert(k != nullptr) failed: illegal use of unloaded klass"
Reviewed-by: dcubed
This commit is contained in:
parent
7baccd9ee2
commit
2ee4245105
@ -508,9 +508,16 @@ ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass,
|
||||
return unloaded_klass;
|
||||
}
|
||||
|
||||
Klass* found_klass = SystemDictionary::find_constrained_or_local_klass(current, sym,
|
||||
(accessing_klass == nullptr) ? nullptr : accessing_klass->get_Klass(),
|
||||
require_local);
|
||||
Handle loader;
|
||||
Handle domain;
|
||||
if (accessing_klass != nullptr) {
|
||||
loader = Handle(current, accessing_klass->loader());
|
||||
domain = Handle(current, accessing_klass->protection_domain());
|
||||
}
|
||||
|
||||
Klass* found_klass = require_local ?
|
||||
SystemDictionary::find_instance_or_array_klass(current, sym, loader, domain) :
|
||||
SystemDictionary::find_constrained_instance_or_array_klass(current, sym, loader);
|
||||
|
||||
// If we fail to find an array klass, look again for its element type.
|
||||
// The element type may be available either locally or via constraints.
|
||||
|
@ -1732,22 +1732,6 @@ Klass* SystemDictionary::find_constrained_instance_or_array_klass(
|
||||
return klass;
|
||||
}
|
||||
|
||||
// Called by the compiler to find a loaded class directly or referenced in the loader constraint table.
|
||||
Klass* SystemDictionary::find_constrained_or_local_klass(Thread* current, Symbol* sym,
|
||||
Klass* accessing_klass,
|
||||
bool require_local) {
|
||||
HandleMark hm(current);
|
||||
Handle loader;
|
||||
Handle domain;
|
||||
if (accessing_klass != nullptr) {
|
||||
loader = Handle(current, accessing_klass->class_loader());
|
||||
domain = Handle(current, accessing_klass->protection_domain());
|
||||
}
|
||||
|
||||
return require_local ? find_instance_or_array_klass(current, sym, loader, domain) :
|
||||
find_constrained_instance_or_array_klass(current, sym, loader);
|
||||
}
|
||||
|
||||
bool SystemDictionary::add_loader_constraint(Symbol* class_name,
|
||||
Klass* klass_being_linked,
|
||||
Handle class_loader1,
|
||||
|
@ -150,7 +150,6 @@ class SystemDictionary : AllStatic {
|
||||
Handle class_loader,
|
||||
Handle protection_domain);
|
||||
|
||||
private:
|
||||
// Lookup an instance or array class that has already been loaded
|
||||
// either into the given class loader, or else into another class
|
||||
// loader that is constrained (via loader constraints) to produce
|
||||
@ -176,13 +175,6 @@ class SystemDictionary : AllStatic {
|
||||
Symbol* class_name,
|
||||
Handle class_loader);
|
||||
|
||||
public:
|
||||
// Called by the compiler to find a loaded class directly or referenced in the
|
||||
// loader constraint table.
|
||||
static Klass* find_constrained_or_local_klass(Thread* current, Symbol* sym,
|
||||
Klass* accessing_klass,
|
||||
bool require_local);
|
||||
|
||||
static void classes_do(MetaspaceClosure* it);
|
||||
// Iterate over all methods in all klasses
|
||||
|
||||
|
@ -1664,8 +1664,16 @@ Klass* JVMCIRuntime::get_klass_by_name_impl(Klass*& accessing_klass,
|
||||
return get_klass_by_name_impl(accessing_klass, cpool, strippedsym, require_local);
|
||||
}
|
||||
|
||||
Klass* found_klass = SystemDictionary::find_constrained_or_local_klass(THREAD, sym,
|
||||
accessing_klass, require_local);
|
||||
Handle loader;
|
||||
Handle domain;
|
||||
if (accessing_klass != nullptr) {
|
||||
loader = Handle(THREAD, accessing_klass->class_loader());
|
||||
domain = Handle(THREAD, accessing_klass->protection_domain());
|
||||
}
|
||||
|
||||
Klass* found_klass = require_local ?
|
||||
SystemDictionary::find_instance_or_array_klass(THREAD, sym, loader, domain) :
|
||||
SystemDictionary::find_constrained_instance_or_array_klass(THREAD, sym, loader);
|
||||
|
||||
// If we fail to find an array klass, look again for its element type.
|
||||
// The element type may be available either locally or via constraints.
|
||||
|
Loading…
Reference in New Issue
Block a user