summaryrefslogtreecommitdiff
path: root/runtime/imtable-inl.h
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/imtable-inl.h')
-rw-r--r--runtime/imtable-inl.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/runtime/imtable-inl.h b/runtime/imtable-inl.h
index 21e3eb1f23..71ece99a21 100644
--- a/runtime/imtable-inl.h
+++ b/runtime/imtable-inl.h
@@ -83,6 +83,12 @@ inline void ImTable::GetImtHashComponents(ArtMethod* method,
}
inline uint32_t ImTable::GetImtIndex(ArtMethod* method) {
+ if (!method->IsAbstract()) {
+ // For default methods, where we cannot store the imt_index, we use the
+ // method_index instead. We mask it with the closest power of two to
+ // simplify the interpreter.
+ return method->GetMethodIndex() & (ImTable::kSizeTruncToPowerOfTwo - 1);
+ }
uint32_t class_hash, name_hash, signature_hash;
GetImtHashComponents(method, &class_hash, &name_hash, &signature_hash);