summaryrefslogtreecommitdiff
path: root/runtime/mirror/array.h
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2017-03-06 12:35:10 -0800
committer Mathieu Chartier <mathieuc@google.com> 2017-03-29 16:51:26 -0700
commit8c19d2431f45861ca11cf5ebc4fdaf10200f2458 (patch)
tree2d376ce322be680898d55fde929e67032d4c711c /runtime/mirror/array.h
parent4e03442619834c56dbf79a3493eb8a2d91b93e7f (diff)
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
Diffstat (limited to 'runtime/mirror/array.h')
-rw-r--r--runtime/mirror/array.h7
1 files changed, 7 insertions, 0 deletions
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<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_);