Reduce using ArtMethod's dex_cache_resolved_types_.
Avoid using the ArtMethod's dex cache type array shortcut
in runtime, preparing for its removal. We do not completely
remove the shortcut yet because it is still used by array
allocation entrypoints.
Fix ArgArray::BuildArgArrayFromObjectArray in reflection.cc
to not ask for the parameter type to be resolved. It should
have been previously resolved when retrieving the Method.
Also partially revert
https://android-review.googlesource.com/310717
because it relied on the removed AIOOBE check in the removed
ArtMethod::GetDexCacheResolvedType(). The removed check was
simply defensive but it could not be triggered without some
memory corruption.
Test: m test-art-host
Bug: 30627598
Change-Id: Ic45a5ff8c66b79429e440cbc08d67bf22a083682
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 5da59f3..faf8b41 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -1060,13 +1060,13 @@
virtual bool operator()(ObjPtr<mirror::Class> c) OVERRIDE REQUIRES_SHARED(Locks::mutator_lock_) {
const auto pointer_size = Runtime::Current()->GetClassLinker()->GetImagePointerSize();
for (auto& m : c->GetMethods(pointer_size)) {
- ResolveExceptionsForMethod(&m, pointer_size);
+ ResolveExceptionsForMethod(&m);
}
return true;
}
private:
- void ResolveExceptionsForMethod(ArtMethod* method_handle, PointerSize pointer_size)
+ void ResolveExceptionsForMethod(ArtMethod* method_handle)
REQUIRES_SHARED(Locks::mutator_lock_) {
const DexFile::CodeItem* code_item = method_handle->GetCodeItem();
if (code_item == nullptr) {
@@ -1088,8 +1088,7 @@
dex::TypeIndex encoded_catch_handler_handlers_type_idx =
dex::TypeIndex(DecodeUnsignedLeb128(&encoded_catch_handler_list));
// Add to set of types to resolve if not already in the dex cache resolved types
- if (!method_handle->IsResolvedTypeIdx(encoded_catch_handler_handlers_type_idx,
- pointer_size)) {
+ if (!method_handle->IsResolvedTypeIdx(encoded_catch_handler_handlers_type_idx)) {
exceptions_to_resolve_.emplace(encoded_catch_handler_handlers_type_idx,
method_handle->GetDexFile());
}