summaryrefslogtreecommitdiff
path: root/runtime/mirror/class.cc
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2016-11-17 15:21:22 -0800
committer Andreas Gampe <agampe@google.com> 2016-11-21 10:57:00 -0800
commita5b09a67034e57a6e10231dd4bd92f4cb50b824c (patch)
tree304be738f4fa528b7ad2676103eecc84c79eaeeb /runtime/mirror/class.cc
parentdac7ad17c78387d15d7aefae0f852dddf5f37e34 (diff)
ART: Add dex::TypeIndex
Add abstraction for uint16_t type index. Test: m test-art-host Change-Id: I47708741c7c579cbbe59ab723c1e31c5fe71f83a
Diffstat (limited to 'runtime/mirror/class.cc')
-rw-r--r--runtime/mirror/class.cc13
1 files changed, 8 insertions, 5 deletions
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> 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<Class> 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 <PointerSize kPointerSize, bool kTransactionActive>