Refactor image writer
Aim to have common functions for copying references and pointers.
Required for adding support for faster image fixups.
Test: test-art-host -j32
Bug: 34927277
Bug: 34928633
Change-Id: Ia654efc483b332eea3535570496bfeccd7c635ee
diff --git a/runtime/mirror/array.h b/runtime/mirror/array.h
index 16cf30f..51d9d24 100644
--- a/runtime/mirror/array.h
+++ b/runtime/mirror/array.h
@@ -198,6 +198,13 @@
T GetElementPtrSize(uint32_t idx, PointerSize ptr_size)
REQUIRES_SHARED(Locks::mutator_lock_);
+ void** ElementAddress(size_t index, PointerSize ptr_size) REQUIRES_SHARED(Locks::mutator_lock_) {
+ DCHECK_LT(index, static_cast<size_t>(GetLength()));
+ return reinterpret_cast<void**>(reinterpret_cast<uint8_t*>(this) +
+ Array::DataOffset(static_cast<size_t>(ptr_size)).Uint32Value() +
+ static_cast<size_t>(ptr_size) * index);
+ }
+
template<bool kTransactionActive = false, bool kUnchecked = false>
void SetElementPtrSize(uint32_t idx, uint64_t element, PointerSize ptr_size)
REQUIRES_SHARED(Locks::mutator_lock_);