Update IMT for stale miranda methods
Fixes occasional crash in dex2oat.
(cherry picked from commit 519fd543625da68ef93f0cd5539c949e5e74e04e)
Bug: 19264997
Change-Id: Icb1a323d8c44fa40309486e17aec56d2c2588e67
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 4266c4a..431ef27 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -5027,6 +5027,13 @@
}
}
}
+ // Fix up IMT in case it has any miranda methods in it.
+ for (size_t i = 0; i < mirror::Class::kImtSize; ++i) {
+ auto it = move_table.find(out_imt[i]);
+ if (it != move_table.end()) {
+ out_imt[i] = it->second;
+ }
+ }
// Check that there are no stale methods are in the dex cache array.
if (kIsDebugBuild) {
auto* resolved_methods = klass->GetDexCache()->GetResolvedMethods();