From 942fd3130254d8276cbfe8e6201825e9c49e9b2c Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Mon, 16 Jan 2017 20:52:19 +0000 Subject: 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 --- compiler/driver/compiler_driver.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'compiler/driver/compiler_driver.cc') diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index 5da59f3b3d..faf8b41be1 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -1060,13 +1060,13 @@ class ResolveCatchBlockExceptionsClassVisitor : public ClassVisitor { virtual bool operator()(ObjPtr 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 @@ class ResolveCatchBlockExceptionsClassVisitor : public ClassVisitor { 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()); } -- cgit v1.2.3-59-g8ed1b