From a5b09a67034e57a6e10231dd4bd92f4cb50b824c Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Thu, 17 Nov 2016 15:21:22 -0800 Subject: ART: Add dex::TypeIndex Add abstraction for uint16_t type index. Test: m test-art-host Change-Id: I47708741c7c579cbbe59ab723c1e31c5fe71f83a --- runtime/mirror/class.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'runtime/mirror/class.cc') diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc index db46027bc8..0cfe29bed9 100644 --- a/runtime/mirror/class.cc +++ b/runtime/mirror/class.cc @@ -923,7 +923,7 @@ const DexFile::ClassDef* Class::GetClassDef() { return &GetDexFile().GetClassDef(class_def_idx); } -uint16_t Class::GetDirectInterfaceTypeIdx(uint32_t idx) { +dex::TypeIndex Class::GetDirectInterfaceTypeIdx(uint32_t idx) { DCHECK(!IsPrimitive()); DCHECK(!IsArrayClass()); return GetInterfaceTypeList()->GetTypeItem(idx).type_idx_; @@ -947,10 +947,11 @@ ObjPtr Class::GetDirectInterface(Thread* self, DCHECK(interfaces != nullptr); return interfaces->Get(idx); } else { - uint16_t type_idx = klass->GetDirectInterfaceTypeIdx(idx); + dex::TypeIndex type_idx = klass->GetDirectInterfaceTypeIdx(idx); ObjPtr interface = klass->GetDexCache()->GetResolvedType(type_idx); if (interface == nullptr) { - interface = Runtime::Current()->GetClassLinker()->ResolveType(klass->GetDexFile(), type_idx, + interface = Runtime::Current()->GetClassLinker()->ResolveType(klass->GetDexFile(), + type_idx, klass.Get()); CHECK(interface != nullptr || self->IsExceptionPending()); } @@ -1130,10 +1131,12 @@ uint32_t Class::Depth() { return depth; } -uint32_t Class::FindTypeIndexInOtherDexFile(const DexFile& dex_file) { +dex::TypeIndex Class::FindTypeIndexInOtherDexFile(const DexFile& dex_file) { std::string temp; const DexFile::TypeId* type_id = dex_file.FindTypeId(GetDescriptor(&temp)); - return (type_id == nullptr) ? DexFile::kDexNoIndex : dex_file.GetIndexForTypeId(*type_id); + return (type_id == nullptr) + ? dex::TypeIndex(DexFile::kDexNoIndex) + : dex_file.GetIndexForTypeId(*type_id); } template -- cgit v1.2.3-59-g8ed1b