8214728: Unnecessary InstanceKlass::cast at few places
Reviewed-by: lfoltan, jiangli, coleenp
--- a/src/hotspot/share/classfile/verifier.cpp Tue Dec 04 11:10:14 2018 -0800
+++ b/src/hotspot/share/classfile/verifier.cpp Tue Dec 04 11:54:09 2018 -0800
@@ -2017,8 +2017,7 @@
if (kls != NULL) {
current_class()->class_loader_data()->record_dependency(kls);
if (log_is_enabled(Debug, class, resolve)) {
- InstanceKlass* cur_class = InstanceKlass::cast(current_class());
- Verifier::trace_class_resolution(kls, cur_class);
+ Verifier::trace_class_resolution(kls, current_class());
}
}
return kls;
--- a/src/hotspot/share/interpreter/interpreterRuntime.cpp Tue Dec 04 11:10:14 2018 -0800
+++ b/src/hotspot/share/interpreter/interpreterRuntime.cpp Tue Dec 04 11:54:09 2018 -0800
@@ -728,7 +728,7 @@
// class is initialized. This is required so that access to the static
// field will call the initialization function every time until the class
// is completely initialized ala. in 2.17.5 in JVM Specification.
- InstanceKlass* klass = InstanceKlass::cast(info.field_holder());
+ InstanceKlass* klass = info.field_holder();
bool uninitialized_static = is_static && !klass->is_initialized();
bool has_initialized_final_update = info.field_holder()->major_version() >= 53 &&
info.has_initialized_final_update();
--- a/src/hotspot/share/interpreter/linkResolver.cpp Tue Dec 04 11:10:14 2018 -0800
+++ b/src/hotspot/share/interpreter/linkResolver.cpp Tue Dec 04 11:54:09 2018 -0800
@@ -1151,7 +1151,7 @@
InstanceKlass* ck = InstanceKlass::cast(current_klass);
InstanceKlass *klass_to_check = !ck->is_unsafe_anonymous() ?
ck :
- InstanceKlass::cast(ck->unsafe_anonymous_host());
+ ck->unsafe_anonymous_host();
// Disable verification for the dynamically-generated reflection bytecodes.
bool is_reflect = klass_to_check->is_subclass_of(
SystemDictionary::reflect_MagicAccessorImpl_klass());