From 8c19d2431f45861ca11cf5ebc4fdaf10200f2458 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Mon, 6 Mar 2017 12:35:10 -0800 Subject: 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 --- runtime/mirror/array.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'runtime/mirror/array.h') diff --git a/runtime/mirror/array.h b/runtime/mirror/array.h index 16cf30f1e2..51d9d24619 100644 --- a/runtime/mirror/array.h +++ b/runtime/mirror/array.h @@ -198,6 +198,13 @@ class PointerArray : public Array { 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(GetLength())); + return reinterpret_cast(reinterpret_cast(this) + + Array::DataOffset(static_cast(ptr_size)).Uint32Value() + + static_cast(ptr_size) * index); + } + template void SetElementPtrSize(uint32_t idx, uint64_t element, PointerSize ptr_size) REQUIRES_SHARED(Locks::mutator_lock_); -- cgit v1.2.3-59-g8ed1b