Skip to content

Commit bc91596

Browse files
committed
8264051: Remove unused TRAPS parameters from runtime functions
Reviewed-by: iklam, dholmes
1 parent 5d7e93c commit bc91596

16 files changed

+35
-52
lines changed

src/hotspot/share/classfile/classFileParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5422,7 +5422,7 @@ void ClassFileParser::fill_instance_klass(InstanceKlass* ik,
54225422

54235423
// can only set dynamic nest-host after static nest information is set
54245424
if (cl_inst_info.dynamic_nest_host() != NULL) {
5425-
ik->set_nest_host(cl_inst_info.dynamic_nest_host(), THREAD);
5425+
ik->set_nest_host(cl_inst_info.dynamic_nest_host());
54265426
}
54275427

54285428
// note that is not safe to use the fields in the parser from this point on

src/hotspot/share/classfile/javaClasses.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ void java_lang_Class::create_mirror(Klass* k, Handle class_loader,
10271027
// to support Class.getModifiers(). Instance classes recalculate
10281028
// the cached flags after the class file is parsed, but before the
10291029
// class is put into the system dictionary.
1030-
int computed_modifiers = k->compute_modifier_flags(CHECK);
1030+
int computed_modifiers = k->compute_modifier_flags();
10311031
k->set_modifier_flags(computed_modifiers);
10321032
// Class_klass has to be loaded because it is used to allocate
10331033
// the mirror.

src/hotspot/share/classfile/systemDictionary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,7 @@ InstanceKlass* SystemDictionary::load_shared_lambda_proxy_class(InstanceKlass* i
12091209
// as verified in SystemDictionaryShared::add_lambda_proxy_class()
12101210
assert(shared_nest_host->class_loader() == class_loader(), "mismatched class loader");
12111211
assert(shared_nest_host->class_loader_data() == ClassLoaderData::class_loader_data(class_loader()), "mismatched class loader data");
1212-
ik->set_nest_host(shared_nest_host, THREAD);
1212+
ik->set_nest_host(shared_nest_host);
12131213

12141214
InstanceKlass* loaded_ik = load_shared_class(ik, class_loader, protection_domain, NULL, pkg_entry, CHECK_NULL);
12151215

src/hotspot/share/interpreter/linkResolver.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ Method* LinkResolver::lookup_method_in_klasses(const LinkInfo& link_info,
382382
Method* LinkResolver::lookup_instance_method_in_klasses(Klass* klass,
383383
Symbol* name,
384384
Symbol* signature,
385-
Klass::PrivateLookupMode private_mode, TRAPS) {
385+
Klass::PrivateLookupMode private_mode) {
386386
Method* result = klass->uncached_lookup_method(name, signature, Klass::OverpassLookupMode::find, private_mode);
387387

388388
while (result != NULL && result->is_static() && result->method_holder()->super() != NULL) {
@@ -543,13 +543,13 @@ Method* LinkResolver::lookup_polymorphic_method(const LinkInfo& link_info,
543543
return NULL;
544544
}
545545

546-
static void print_nest_host_error_on(stringStream* ss, Klass* ref_klass, Klass* sel_klass, TRAPS) {
546+
static void print_nest_host_error_on(stringStream* ss, Klass* ref_klass, Klass* sel_klass) {
547547
assert(ref_klass->is_instance_klass(), "must be");
548548
assert(sel_klass->is_instance_klass(), "must be");
549549
InstanceKlass* ref_ik = InstanceKlass::cast(ref_klass);
550550
InstanceKlass* sel_ik = InstanceKlass::cast(sel_klass);
551-
const char* nest_host_error_1 = ref_ik->nest_host_error(THREAD);
552-
const char* nest_host_error_2 = sel_ik->nest_host_error(THREAD);
551+
const char* nest_host_error_1 = ref_ik->nest_host_error();
552+
const char* nest_host_error_2 = sel_ik->nest_host_error();
553553
if (nest_host_error_1 != NULL || nest_host_error_2 != NULL) {
554554
ss->print(", (%s%s%s)",
555555
(nest_host_error_1 != NULL) ? nest_host_error_1 : "",
@@ -610,7 +610,7 @@ void LinkResolver::check_method_accessability(Klass* ref_klass,
610610
// For private access see if there was a problem with nest host
611611
// resolution, and if so report that as part of the message.
612612
if (sel_method->is_private()) {
613-
print_nest_host_error_on(&ss, ref_klass, sel_klass, THREAD);
613+
print_nest_host_error_on(&ss, ref_klass, sel_klass);
614614
}
615615

616616
Exceptions::fthrow(THREAD_AND_LOCATION,
@@ -955,7 +955,7 @@ void LinkResolver::check_field_accessability(Klass* ref_klass,
955955
// For private access see if there was a problem with nest host
956956
// resolution, and if so report that as part of the message.
957957
if (fd.is_private()) {
958-
print_nest_host_error_on(&ss, ref_klass, sel_klass, THREAD);
958+
print_nest_host_error_on(&ss, ref_klass, sel_klass);
959959
}
960960
Exceptions::fthrow(THREAD_AND_LOCATION,
961961
vmSymbols::java_lang_IllegalAccessError(),
@@ -1247,7 +1247,7 @@ void LinkResolver::runtime_resolve_special_method(CallInfo& result,
12471247
Method* instance_method = lookup_instance_method_in_klasses(super_klass,
12481248
resolved_method->name(),
12491249
resolved_method->signature(),
1250-
Klass::PrivateLookupMode::find, CHECK);
1250+
Klass::PrivateLookupMode::find);
12511251
sel_method = methodHandle(THREAD, instance_method);
12521252

12531253
// check if found
@@ -1489,7 +1489,7 @@ void LinkResolver::runtime_resolve_interface_method(CallInfo& result,
14891489
Method* method = lookup_instance_method_in_klasses(recv_klass,
14901490
resolved_method->name(),
14911491
resolved_method->signature(),
1492-
Klass::PrivateLookupMode::skip, CHECK);
1492+
Klass::PrivateLookupMode::skip);
14931493
selected_method = methodHandle(THREAD, method);
14941494

14951495
if (selected_method.is_null() && !check_null_and_abstract) {

src/hotspot/share/interpreter/linkResolver.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -211,7 +211,7 @@ class LinkResolver: AllStatic {
211211
JVMCI_ONLY(public:) // Needed for CompilerToVM.resolveMethod()
212212
// Not Linktime so doesn't take LinkInfo
213213
static Method* lookup_instance_method_in_klasses (Klass* klass, Symbol* name, Symbol* signature,
214-
Klass::PrivateLookupMode private_mode, TRAPS);
214+
Klass::PrivateLookupMode private_mode);
215215
JVMCI_ONLY(private:)
216216

217217
// Similar loader constraint checking functions that throw

src/hotspot/share/oops/arrayKlass.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,7 @@ void ArrayKlass::array_klasses_do(void f(Klass* k)) {
153153
}
154154
}
155155

156-
// JVM support
157-
158-
jint ArrayKlass::compute_modifier_flags(TRAPS) const {
156+
jint ArrayKlass::compute_modifier_flags() const {
159157
return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC;
160158
}
161159

src/hotspot/share/oops/arrayKlass.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class ArrayKlass: public Klass {
113113

114114

115115
// jvm support
116-
jint compute_modifier_flags(TRAPS) const;
116+
jint compute_modifier_flags() const;
117117

118118
// JVMTI support
119119
jint jvmti_class_status() const;

src/hotspot/share/oops/instanceKlass.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -389,19 +389,19 @@ InstanceKlass* InstanceKlass::nest_host(TRAPS) {
389389
// If it has an explicit _nest_host_index or _nest_members, these will be ignored.
390390
// We also know the "host" is a valid nest-host in the same package so we can
391391
// assert some of those facts.
392-
void InstanceKlass::set_nest_host(InstanceKlass* host, TRAPS) {
392+
void InstanceKlass::set_nest_host(InstanceKlass* host) {
393393
assert(is_hidden(), "must be a hidden class");
394394
assert(host != NULL, "NULL nest host specified");
395395
assert(_nest_host == NULL, "current class has resolved nest-host");
396-
assert(nest_host_error(THREAD) == NULL, "unexpected nest host resolution error exists: %s",
397-
nest_host_error(THREAD));
396+
assert(nest_host_error() == NULL, "unexpected nest host resolution error exists: %s",
397+
nest_host_error());
398398
assert((host->_nest_host == NULL && host->_nest_host_index == 0) ||
399399
(host->_nest_host == host), "proposed host is not a valid nest-host");
400400
// Can't assert this as package is not set yet:
401401
// assert(is_same_class_package(host), "proposed host is in wrong package");
402402

403403
if (log_is_enabled(Trace, class, nestmates)) {
404-
ResourceMark rm(THREAD);
404+
ResourceMark rm;
405405
const char* msg = "";
406406
// a hidden class does not expect a statically defined nest-host
407407
if (_nest_host_index > 0) {
@@ -452,11 +452,11 @@ bool InstanceKlass::has_nestmate_access_to(InstanceKlass* k, TRAPS) {
452452
return access;
453453
}
454454

455-
const char* InstanceKlass::nest_host_error(TRAPS) {
455+
const char* InstanceKlass::nest_host_error() {
456456
if (_nest_host_index == 0) {
457457
return NULL;
458458
} else {
459-
constantPoolHandle cph(THREAD, constants());
459+
constantPoolHandle cph(Thread::current(), constants());
460460
return SystemDictionary::find_nest_host_error(cph, (int)_nest_host_index);
461461
}
462462
}
@@ -3109,7 +3109,7 @@ InstanceKlass* InstanceKlass::compute_enclosing_class(bool* inner_is_member, TRA
31093109
return outer_klass;
31103110
}
31113111

3112-
jint InstanceKlass::compute_modifier_flags(TRAPS) const {
3112+
jint InstanceKlass::compute_modifier_flags() const {
31133113
jint access = access_flags().as_int();
31143114

31153115
// But check if it happens to be member class.

src/hotspot/share/oops/instanceKlass.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ class InstanceKlass: public Klass {
465465
jushort nest_host_index() const { return _nest_host_index; }
466466
void set_nest_host_index(u2 i) { _nest_host_index = i; }
467467
// dynamic nest member support
468-
void set_nest_host(InstanceKlass* host, TRAPS);
468+
void set_nest_host(InstanceKlass* host);
469469

470470
// record components
471471
Array<RecordComponent*>* record_components() const { return _record_components; }
@@ -486,7 +486,7 @@ class InstanceKlass: public Klass {
486486
// Used to construct informative IllegalAccessError messages at a higher level,
487487
// if there was an issue resolving or validating the nest host.
488488
// Returns NULL if there was no error.
489-
const char* nest_host_error(TRAPS);
489+
const char* nest_host_error();
490490
// Returns nest-host class, resolving and validating it if needed.
491491
// Returns NULL if resolution is not possible from the calling context.
492492
InstanceKlass* nest_host(TRAPS);
@@ -1267,8 +1267,7 @@ class InstanceKlass: public Klass {
12671267
void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, PackageEntry* pkg_entry, TRAPS);
12681268
void init_shared_package_entry();
12691269

1270-
// jvm support
1271-
jint compute_modifier_flags(TRAPS) const;
1270+
jint compute_modifier_flags() const;
12721271

12731272
public:
12741273
// JVMTI support

src/hotspot/share/oops/klass.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -751,11 +751,6 @@ const char* Klass::external_kind() const {
751751
return "class";
752752
}
753753

754-
// Unless overridden, modifier_flags is 0.
755-
jint Klass::compute_modifier_flags(TRAPS) const {
756-
return 0;
757-
}
758-
759754
int Klass::atomic_incr_biased_lock_revocation_count() {
760755
return (int) Atomic::add(&_biased_lock_revocation_count, 1);
761756
}

src/hotspot/share/oops/klass.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,8 +690,7 @@ class Klass : public Metadata {
690690
virtual void release_C_heap_structures();
691691

692692
public:
693-
// jvm support
694-
virtual jint compute_modifier_flags(TRAPS) const;
693+
virtual jint compute_modifier_flags() const = 0;
695694

696695
// JVMTI support
697696
virtual jint jvmti_class_status() const;

src/hotspot/share/oops/klassVtable.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -1245,7 +1245,7 @@ void klassItable::initialize_itable_for_interface(int method_table_offset, Insta
12451245
// Invokespecial does not perform selection based on the receiver, so it does not use
12461246
// the cached itable.
12471247
target = LinkResolver::lookup_instance_method_in_klasses(_klass, m->name(), m->signature(),
1248-
Klass::PrivateLookupMode::skip, CHECK);
1248+
Klass::PrivateLookupMode::skip);
12491249
}
12501250
if (target == NULL || !target->is_public() || target->is_abstract() || target->is_overpass()) {
12511251
assert(target == NULL || !target->is_overpass() || target->is_public(),

src/hotspot/share/oops/objArrayKlass.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,16 +396,14 @@ void ObjArrayKlass::metaspace_pointers_do(MetaspaceClosure* it) {
396396
it->push(&_bottom_klass);
397397
}
398398

399-
// JVM support
400-
401-
jint ObjArrayKlass::compute_modifier_flags(TRAPS) const {
399+
jint ObjArrayKlass::compute_modifier_flags() const {
402400
// The modifier for an objectArray is the same as its element
403401
if (element_klass() == NULL) {
404402
assert(Universe::is_bootstrapping(), "partial objArray only at startup");
405403
return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC;
406404
}
407405
// Return the flags of the bottom element type.
408-
jint element_flags = bottom_klass()->compute_modifier_flags(CHECK_0);
406+
jint element_flags = bottom_klass()->compute_modifier_flags();
409407

410408
return (element_flags & (JVM_ACC_PUBLIC | JVM_ACC_PRIVATE | JVM_ACC_PROTECTED))
411409
| (JVM_ACC_ABSTRACT | JVM_ACC_FINAL);

src/hotspot/share/oops/objArrayKlass.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ class ObjArrayKlass : public ArrayKlass {
154154
inline void oop_oop_iterate_elements_bounded(objArrayOop a, OopClosureType* closure, MemRegion mr);
155155

156156
public:
157-
// JVM support
158-
jint compute_modifier_flags(TRAPS) const;
157+
jint compute_modifier_flags() const;
159158

160159
public:
161160
// Printing

src/hotspot/share/prims/jvm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,7 @@ JVM_ENTRY(jint, JVM_GetClassModifiers(JNIEnv *env, jclass cls))
13501350
}
13511351

13521352
Klass* k = java_lang_Class::as_Klass(mirror);
1353-
debug_only(int computed_modifiers = k->compute_modifier_flags(CHECK_0));
1353+
debug_only(int computed_modifiers = k->compute_modifier_flags());
13541354
assert(k->modifier_flags() == computed_modifiers, "modifiers cache is OK");
13551355
return k->modifier_flags();
13561356
JVM_END

src/hotspot/share/prims/jvmtiEnv.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2366,15 +2366,10 @@ JvmtiEnv::GetClassModifiers(oop k_mirror, jint* modifiers_ptr) {
23662366
if (!java_lang_Class::is_primitive(k_mirror)) {
23672367
Klass* k = java_lang_Class::as_Klass(k_mirror);
23682368
NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS);
2369-
result = k->compute_modifier_flags(current_thread);
2370-
JavaThread* THREAD = current_thread; // pass to macros
2371-
if (HAS_PENDING_EXCEPTION) {
2372-
CLEAR_PENDING_EXCEPTION;
2373-
return JVMTI_ERROR_INTERNAL;
2374-
};
2369+
result = k->compute_modifier_flags();
23752370

2376-
// Reset the deleted ACC_SUPER bit ( deleted in compute_modifier_flags()).
2377-
if(k->is_super()) {
2371+
// Reset the deleted ACC_SUPER bit (deleted in compute_modifier_flags()).
2372+
if (k->is_super()) {
23782373
result |= JVM_ACC_SUPER;
23792374
}
23802375
} else {

0 commit comments

Comments
 (0)