DCHECK(strings[j].IsNull());
}
std::copy_n(image_resolved_strings, num_strings, strings);
- *reinterpret_cast<GcRoot<mirror::String>**>(image_resolved_strings) = strings;
dex_cache->SetStrings(strings);
}
if (num_types != 0u) {
if (forward_strings_) {
GcRoot<mirror::String>* strings = klass->GetDexCacheStrings();
if (strings != nullptr) {
- DCHECK(space_->GetImageHeader().GetImageSection(ImageHeader::kSectionDexCacheArrays).Contains(
- reinterpret_cast<uint8_t*>(strings) - space_->Begin()))
+ DCHECK(
+ space_->GetImageHeader().GetImageSection(ImageHeader::kSectionDexCacheArrays).Contains(
+ reinterpret_cast<uint8_t*>(strings) - space_->Begin()))
<< "String dex cache array for " << PrettyClass(klass) << " is not in app image";
- GcRoot<mirror::String>* new_strings = *reinterpret_cast<GcRoot<mirror::String>**>(strings);
+ // Dex caches have already been updated, so take the strings pointer from there.
+ GcRoot<mirror::String>* new_strings = klass->GetDexCache()->GetStrings();
DCHECK_NE(strings, new_strings);
klass->SetDexCacheStrings(new_strings);
}
}
inline size_t DexCacheArraysLayout::StringsSize(size_t num_elements) const {
- // App image patching relies on having enough room for a forwarding pointer in the types array.
- return std::max(ArraySize(sizeof(GcRoot<mirror::String>), num_elements), pointer_size_);
+ return ArraySize(sizeof(GcRoot<mirror::String>), num_elements);
}
inline size_t DexCacheArraysLayout::StringsAlignment() const {
- // App image patching relies on having enough room for a forwarding pointer in the strings array.
- return pointer_size_;
+ return alignof(GcRoot<mirror::String>);
}
inline size_t DexCacheArraysLayout::FieldOffset(uint32_t field_idx) const {