summaryrefslogtreecommitdiff
path: root/runtime/class_linker.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2016-06-29 08:39:47 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2016-06-29 08:39:47 +0000
commitd4ceecc85a5aab2ec23ea1bd010692ba8c8aaa0c (patch)
tree982948a67a88a1f9a734c935f919f8d307969f48 /runtime/class_linker.cc
parent50706437d8216e41f0fea1e413cda7891324d397 (diff)
Revert "Refactor GetIMTIndex"
I need to revert this to get https://android-review.googlesource.com/#/c/244190/ to cleanly revert. Matthew, do you mind rewriting it? This reverts commit 50706437d8216e41f0fea1e413cda7891324d397. Change-Id: I5c1435f5dffb46dbb5b613b22adb88c7770304f2
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r--runtime/class_linker.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 4259aea187..4406c0aee4 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -6167,6 +6167,11 @@ void ClassLinker::FillIMTAndConflictTables(mirror::Class* klass) {
}
}
+static inline uint32_t GetIMTIndex(ArtMethod* interface_method)
+ SHARED_REQUIRES(Locks::mutator_lock_) {
+ return interface_method->GetDexMethodIndex() % ImTable::kSize;
+}
+
ImtConflictTable* ClassLinker::CreateImtConflictTable(size_t count,
LinearAlloc* linear_alloc,
size_t image_pointer_size) {
@@ -6218,7 +6223,7 @@ void ClassLinker::FillIMTFromIfTable(mirror::IfTable* if_table,
// or interface methods in the IMT here they will not create extra conflicts since we compare
// names and signatures in SetIMTRef.
ArtMethod* interface_method = interface->GetVirtualMethod(j, image_pointer_size_);
- const uint32_t imt_index = interface_method->GetImtIndex();
+ const uint32_t imt_index = GetIMTIndex(interface_method);
// There is only any conflicts if all of the interface methods for an IMT slot don't have
// the same implementation method, keep track of this to avoid creating a conflict table in
@@ -6272,7 +6277,7 @@ void ClassLinker::FillIMTFromIfTable(mirror::IfTable* if_table,
}
DCHECK(implementation_method != nullptr);
ArtMethod* interface_method = interface->GetVirtualMethod(j, image_pointer_size_);
- const uint32_t imt_index = interface_method->GetImtIndex();
+ const uint32_t imt_index = GetIMTIndex(interface_method);
if (!imt[imt_index]->IsRuntimeMethod() ||
imt[imt_index] == unimplemented_method ||
imt[imt_index] == imt_conflict_method) {
@@ -6678,7 +6683,7 @@ bool ClassLinker::LinkInterfaceMethods(
auto* interface_method = iftable->GetInterface(i)->GetVirtualMethod(j, image_pointer_size_);
MethodNameAndSignatureComparator interface_name_comparator(
interface_method->GetInterfaceMethodIfProxy(image_pointer_size_));
- uint32_t imt_index = interface_method->GetImtIndex();
+ uint32_t imt_index = GetIMTIndex(interface_method);
ArtMethod** imt_ptr = &out_imt[imt_index];
// For each method listed in the interface's method list, find the
// matching method in our class's method list. We want to favor the