8232881: Remove unnecessary InstanceKlass::casts

Reviewed-by: coleenp
This commit is contained in:
Claes Redestad 2019-10-23 18:34:25 +02:00
parent bbc4e0d999
commit 36ac846d35
6 changed files with 14 additions and 14 deletions

View File

@ -229,17 +229,17 @@ void ClassListParser::print_specified_interfaces() {
jio_fprintf(defaultStream::error_stream(), "}\n");
}
void ClassListParser::print_actual_interfaces(InstanceKlass *ik) {
void ClassListParser::print_actual_interfaces(InstanceKlass* ik) {
int n = ik->local_interfaces()->length();
jio_fprintf(defaultStream::error_stream(), "Actual interfaces[%d] = {\n", n);
for (int i = 0; i < n; i++) {
InstanceKlass* e = InstanceKlass::cast(ik->local_interfaces()->at(i));
InstanceKlass* e = ik->local_interfaces()->at(i);
jio_fprintf(defaultStream::error_stream(), " %s\n", e->name()->as_klass_external_name());
}
jio_fprintf(defaultStream::error_stream(), "}\n");
}
void ClassListParser::error(const char *msg, ...) {
void ClassListParser::error(const char* msg, ...) {
va_list ap;
va_start(ap, msg);
int error_index = _token - _line;
@ -328,7 +328,7 @@ InstanceKlass* ClassListParser::load_class_from_source(Symbol* class_name, TRAPS
Klass* ClassListParser::load_current_class(TRAPS) {
TempNewSymbol class_name_symbol = SymbolTable::new_symbol(_class_name);
Klass *klass = NULL;
Klass* klass = NULL;
if (!is_loading_from_source()) {
// Load classes for the boot/platform/app loaders only.
if (is_super_specified()) {

View File

@ -146,7 +146,7 @@ class HierarchyVisitor : StackObj {
return interface_index() >= number_of_interfaces();
}
InstanceKlass* interface_at(int index) {
return InstanceKlass::cast(_class->local_interfaces()->at(index));
return _class->local_interfaces()->at(index);
}
InstanceKlass* next_super() { return _class->java_super(); }
InstanceKlass* next_interface() {

View File

@ -1989,14 +1989,14 @@ void SystemDictionary::resolve_well_known_classes(TRAPS) {
resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Reference_klass), scan, CHECK);
// Preload ref klasses and set reference types
InstanceKlass::cast(WK_KLASS(Reference_klass))->set_reference_type(REF_OTHER);
WK_KLASS(Reference_klass)->set_reference_type(REF_OTHER);
InstanceRefKlass::update_nonstatic_oop_maps(WK_KLASS(Reference_klass));
resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(PhantomReference_klass), scan, CHECK);
InstanceKlass::cast(WK_KLASS(SoftReference_klass))->set_reference_type(REF_SOFT);
InstanceKlass::cast(WK_KLASS(WeakReference_klass))->set_reference_type(REF_WEAK);
InstanceKlass::cast(WK_KLASS(FinalReference_klass))->set_reference_type(REF_FINAL);
InstanceKlass::cast(WK_KLASS(PhantomReference_klass))->set_reference_type(REF_PHANTOM);
WK_KLASS(SoftReference_klass)->set_reference_type(REF_SOFT);
WK_KLASS(WeakReference_klass)->set_reference_type(REF_WEAK);
WK_KLASS(FinalReference_klass)->set_reference_type(REF_FINAL);
WK_KLASS(PhantomReference_klass)->set_reference_type(REF_PHANTOM);
// JSR 292 classes
WKID jsr292_group_start = WK_KLASS_ENUM_NAME(MethodHandle_klass);

View File

@ -71,7 +71,7 @@ bool VerificationType::resolve_and_check_assignability(InstanceKlass* klass, Sym
if (log_is_enabled(Debug, class, resolve)) {
Verifier::trace_class_resolution(from_class, klass);
}
return InstanceKlass::cast(from_class)->is_subclass_of(this_class);
return from_class->is_subclass_of(this_class);
}
return false;

View File

@ -1271,7 +1271,7 @@ InstanceKlass* JVMCIRuntime::get_instance_klass_for_declared_method_holder(Klass
if (method_holder->is_instance_klass()) {
return InstanceKlass::cast(method_holder);
} else if (method_holder->is_array_klass()) {
return InstanceKlass::cast(SystemDictionary::Object_klass());
return SystemDictionary::Object_klass();
} else {
ShouldNotReachHere();
}

View File

@ -266,7 +266,7 @@ checkStaticFieldID(JavaThread* thr, jfieldID fid, jclass cls, int ftype)
/* check for proper subclass hierarchy */
JNIid* id = jfieldIDWorkaround::from_static_jfieldID(fid);
Klass* f_oop = id->holder();
if (!InstanceKlass::cast(k_oop)->is_subtype_of(f_oop))
if (!k_oop->is_subtype_of(f_oop))
ReportJNIFatalError(thr, fatal_wrong_static_field);
/* check for proper field type */
@ -513,7 +513,7 @@ void jniCheck::validate_throwable_klass(JavaThread* thr, Klass* klass) {
assert(klass != NULL, "klass argument must have a value");
if (!klass->is_instance_klass() ||
!InstanceKlass::cast(klass)->is_subclass_of(SystemDictionary::Throwable_klass())) {
!klass->is_subclass_of(SystemDictionary::Throwable_klass())) {
ReportJNIFatalError(thr, fatal_class_not_a_throwable_class);
}
}