In the unfortunate event an ArtMethod gets allocated at the
same location as an old (deleted) ArtMethod, the osr_code_map_
lookup will succeed and return garbage. So we need to delete
entries in the osr_code_map_ when an ArtMethod gets deleted.
This should finally fix:
dalvik.system.DexClassLoaderTest#test_twoJar_diff_getResourceAsStream
Change-Id: I7c8b775c3376a6cfcb907f09b783e393967ad82d
}
}
}
+ for (auto it = osr_code_map_.begin(); it != osr_code_map_.end();) {
+ if (alloc.ContainsUnsafe(it->first)) {
+ // Note that the code has already been removed in the loop above.
+ it = osr_code_map_.erase(it);
+ } else {
+ ++it;
+ }
+ }
for (auto it = profiling_infos_.begin(); it != profiling_infos_.end();) {
ProfilingInfo* info = *it;
if (alloc.ContainsUnsafe(info->GetMethod())) {