diff options
| -rw-r--r-- | runtime/class_linker.cc | 12 | ||||
| -rw-r--r-- | runtime/utils/dex_cache_arrays_layout-inl.h | 8 |
2 files changed, 4 insertions, 16 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index cea8377c58..f055e961f7 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -1180,8 +1180,7 @@ class FixupArtMethodArrayVisitor : public ArtMethodVisitor { << resolved_types << " is not in image starting at " << reinterpret_cast<void*>(header_.GetImageBegin()); if (!is_copied || in_image_space) { - // Go through the array so that we don't need to do a slow map lookup. - method->SetDexCacheResolvedTypes(*reinterpret_cast<GcRoot<mirror::Class>**>(resolved_types), + method->SetDexCacheResolvedTypes(method->GetDexCache()->GetResolvedTypes(), kRuntimePointerSize); } } @@ -1197,8 +1196,7 @@ class FixupArtMethodArrayVisitor : public ArtMethodVisitor { << resolved_methods << " is not in image starting at " << reinterpret_cast<void*>(header_.GetImageBegin()); if (!is_copied || in_image_space) { - // Go through the array so that we don't need to do a slow map lookup. - method->SetDexCacheResolvedMethods(*reinterpret_cast<ArtMethod***>(resolved_methods), + method->SetDexCacheResolvedMethods(method->GetDexCache()->GetResolvedMethods(), kRuntimePointerSize); } } @@ -1333,10 +1331,6 @@ bool ClassLinker::UpdateAppImageClassLoadersAndDexCaches( DCHECK(types[j].IsNull()); } std::copy_n(image_resolved_types, num_types, types); - // Store a pointer to the new location for fast ArtMethod patching without requiring map. - // This leaves random garbage at the start of the dex cache array, but nobody should ever - // read from it again. - *reinterpret_cast<GcRoot<mirror::Class>**>(image_resolved_types) = types; dex_cache->SetResolvedTypes(types); } if (num_methods != 0u) { @@ -1347,8 +1341,6 @@ bool ClassLinker::UpdateAppImageClassLoadersAndDexCaches( DCHECK(methods[j] == nullptr); } std::copy_n(image_resolved_methods, num_methods, methods); - // Store a pointer to the new location for fast ArtMethod patching without requiring map. - *reinterpret_cast<ArtMethod***>(image_resolved_methods) = methods; dex_cache->SetResolvedMethods(methods); } if (num_fields != 0u) { diff --git a/runtime/utils/dex_cache_arrays_layout-inl.h b/runtime/utils/dex_cache_arrays_layout-inl.h index 5ca7684565..c7875b56ec 100644 --- a/runtime/utils/dex_cache_arrays_layout-inl.h +++ b/runtime/utils/dex_cache_arrays_layout-inl.h @@ -70,10 +70,7 @@ inline size_t DexCacheArraysLayout::TypeOffset(uint32_t type_idx) const { } inline size_t DexCacheArraysLayout::TypesSize(size_t num_elements) const { - // App image patching relies on having enough room for a forwarding pointer in the types array. - // See FixupArtMethodArrayVisitor and ClassLinker::AddImageSpace. - return std::max(ArraySize(GcRootAsPointerSize<mirror::Class>(), num_elements), - static_cast<size_t>(pointer_size_)); + return ArraySize(GcRootAsPointerSize<mirror::Class>(), num_elements); } inline size_t DexCacheArraysLayout::TypesAlignment() const { @@ -85,8 +82,7 @@ inline size_t DexCacheArraysLayout::MethodOffset(uint32_t method_idx) const { } inline size_t DexCacheArraysLayout::MethodsSize(size_t num_elements) const { - // App image patching relies on having enough room for a forwarding pointer in the methods array. - return std::max(ArraySize(pointer_size_, num_elements), static_cast<size_t>(pointer_size_)); + return ArraySize(pointer_size_, num_elements); } inline size_t DexCacheArraysLayout::MethodsAlignment() const { |