Fix handling of dex cache arrays for method types.
- Add support for relocating method type dex cache arrays.
- Add missing call to MethodTypeDexCachePair::Initialize in the
class_linker.
- Fix alignment calculation for method_types in
DexCacheArraysLayout.
- Removed unused MethodTypeOffset(uint32_t) method.
Fixes tests with --pic.
Test: make test-art-host
Bug: 30550796
Change-Id: I2bba7228762b9e9834e7659fe62090be78afdfa8
diff --git a/runtime/mirror/dex_cache-inl.h b/runtime/mirror/dex_cache-inl.h
index b388f65..cf45748 100644
--- a/runtime/mirror/dex_cache-inl.h
+++ b/runtime/mirror/dex_cache-inl.h
@@ -207,6 +207,19 @@
}
}
+template <ReadBarrierOption kReadBarrierOption, typename Visitor>
+inline void DexCache::FixupResolvedMethodTypes(mirror::MethodTypeDexCacheType* dest,
+ const Visitor& visitor) {
+ mirror::MethodTypeDexCacheType* src = GetResolvedMethodTypes();
+ for (size_t i = 0, count = NumResolvedMethodTypes(); i < count; ++i) {
+ MethodTypeDexCachePair source = src[i].load(std::memory_order_relaxed);
+ mirror::MethodType* ptr = source.object.Read<kReadBarrierOption>();
+ mirror::MethodType* new_source = visitor(ptr);
+ source.object = GcRoot<MethodType>(new_source);
+ dest[i].store(source, std::memory_order_relaxed);
+ }
+}
+
} // namespace mirror
} // namespace art