ART: Fix ResolveType with ArtMethod
ArtMethods may be obsolete. In that case, the dex cache of the
declaring class is not correct. Refactor the code to avoid
issues.
Partially reverts commit 09c5ca40635faee00f40f6ca0581dd475efd545e.
Bug: 119830111
Test: m test-art-host
Change-Id: Ibf89af48e6384569c2abd6d5846cf05c929679d0
diff --git a/runtime/class_linker-inl.h b/runtime/class_linker-inl.h
index 7e01137..6703205 100644
--- a/runtime/class_linker-inl.h
+++ b/runtime/class_linker-inl.h
@@ -135,7 +135,7 @@
ObjPtr<mirror::Class> resolved_type =
referrer->GetDexCache<kWithoutReadBarrier>()->GetResolvedType(type_idx);
if (UNLIKELY(resolved_type == nullptr)) {
- resolved_type = DoResolveType(type_idx, referrer->GetDeclaringClass());
+ resolved_type = DoResolveType(type_idx, referrer);
}
return resolved_type;
}
@@ -149,7 +149,7 @@
ObjPtr<mirror::Class> resolved_type =
referrer->GetDexCache<kWithoutReadBarrier>()->GetResolvedType(type_idx);
if (UNLIKELY(resolved_type == nullptr)) {
- resolved_type = DoResolveType(type_idx, referrer->GetDeclaringClass());
+ resolved_type = DoResolveType(type_idx, referrer);
}
return resolved_type;
}