8264126: Remove TRAPS/THREAD parameter for class loading functions

Reviewed-by: ccheung, iklam, dholmes
This commit is contained in:
Coleen Phillimore 2021-03-26 13:11:34 +00:00
parent f3eed05236
commit 507b690f88
11 changed files with 54 additions and 58 deletions

View file

@ -1823,7 +1823,7 @@ void SystemDictionaryShared::check_verification_constraints(InstanceKlass* klass
// InstanceKlass::link_class(), so that these can be checked quickly
// at runtime without laying out the vtable/itables.
void SystemDictionaryShared::record_linking_constraint(Symbol* name, InstanceKlass* klass,
Handle loader1, Handle loader2, TRAPS) {
Handle loader1, Handle loader2) {
// A linking constraint check is executed when:
// - klass extends or implements type S
// - klass overrides method S.M(...) with X.M
@ -1861,13 +1861,14 @@ void SystemDictionaryShared::record_linking_constraint(Symbol* name, InstanceKla
return;
}
if (THREAD->is_VM_thread()) {
assert(DynamicDumpSharedSpaces, "must be");
if (DynamicDumpSharedSpaces && Thread::current()->is_VM_thread()) {
// We are re-laying out the vtable/itables of the *copy* of
// a class during the final stage of dynamic dumping. The
// linking constraints for this class has already been recorded.
return;
}
assert(!Thread::current()->is_VM_thread(), "must be");
Arguments::assert_is_dumping_archive();
DumpTimeSharedClassInfo* info = find_or_allocate_info_for(klass);
if (info != NULL) {
@ -1877,7 +1878,7 @@ void SystemDictionaryShared::record_linking_constraint(Symbol* name, InstanceKla
// returns true IFF there's no need to re-initialize the i/v-tables for klass for
// the purpose of checking class loader constraints.
bool SystemDictionaryShared::check_linking_constraints(InstanceKlass* klass, TRAPS) {
bool SystemDictionaryShared::check_linking_constraints(Thread* current, InstanceKlass* klass) {
assert(!DumpSharedSpaces && UseSharedSpaces, "called at run time with CDS enabled only");
LogTarget(Info, class, loader, constraints) log;
if (klass->is_shared_boot_class()) {
@ -1888,20 +1889,20 @@ bool SystemDictionaryShared::check_linking_constraints(InstanceKlass* klass, TRA
RunTimeSharedClassInfo* info = RunTimeSharedClassInfo::get_for(klass);
assert(info != NULL, "Sanity");
if (info->_num_loader_constraints > 0) {
HandleMark hm(THREAD);
HandleMark hm(current);
for (int i = 0; i < info->_num_loader_constraints; i++) {
RunTimeSharedClassInfo::RTLoaderConstraint* lc = info->loader_constraint_at(i);
Symbol* name = lc->constraint_name();
Handle loader1(THREAD, get_class_loader_by(lc->_loader_type1));
Handle loader2(THREAD, get_class_loader_by(lc->_loader_type2));
Handle loader1(current, get_class_loader_by(lc->_loader_type1));
Handle loader2(current, get_class_loader_by(lc->_loader_type2));
if (log.is_enabled()) {
ResourceMark rm(THREAD);
ResourceMark rm(current);
log.print("[CDS add loader constraint for class %s symbol %s loader[0] %s loader[1] %s",
klass->external_name(), name->as_C_string(),
ClassLoaderData::class_loader_data(loader1())->loader_name_and_id(),
ClassLoaderData::class_loader_data(loader2())->loader_name_and_id());
}
if (!SystemDictionary::add_loader_constraint(name, klass, loader1, loader2, THREAD)) {
if (!SystemDictionary::add_loader_constraint(name, klass, loader1, loader2)) {
// Loader constraint violation has been found. The caller
// will re-layout the vtable/itables to produce the correct
// exception.
@ -1918,7 +1919,7 @@ bool SystemDictionaryShared::check_linking_constraints(InstanceKlass* klass, TRA
}
}
if (log.is_enabled()) {
ResourceMark rm(THREAD);
ResourceMark rm(current);
log.print("[CDS has not recorded loader constraint for class %s]", klass->external_name());
}
return false;