summaryrefslogtreecommitdiff
path: root/runtime/entrypoints/entrypoint_utils.cc
diff options
context:
space:
mode:
author Ian Rogers <irogers@google.com> 2014-10-08 15:35:22 -0700
committer Ian Rogers <irogers@google.com> 2014-10-08 16:00:31 -0700
commit832336b3c9eb892045a8de1bb12c9361112ca3c5 (patch)
tree0e8696869a28ee0dee34d130b586b1bf6f072d6e /runtime/entrypoints/entrypoint_utils.cc
parentf1f05d303988a5c071c87b760056be8358276c94 (diff)
Don't copy fill array data to quick literal pool.
Currently quick copies the fill array data from the dex file to the literal pool. It then has to go through hoops to pass this PC relative address down to out-of-line code. Instead, pass the offset of the table to the out-of-line code and use the CodeItem data associated with the ArtMethod. This reduces the size of oat code while greatly simplifying it. Unify the FillArrayData implementation in quick, portable and the interpreters. Change-Id: I9c6971cf46285fbf197856627368c0185fdc98ca
Diffstat (limited to 'runtime/entrypoints/entrypoint_utils.cc')
-rw-r--r--runtime/entrypoints/entrypoint_utils.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/runtime/entrypoints/entrypoint_utils.cc b/runtime/entrypoints/entrypoint_utils.cc
index 835d6e2b7e..7b90339b68 100644
--- a/runtime/entrypoints/entrypoint_utils.cc
+++ b/runtime/entrypoints/entrypoint_utils.cc
@@ -344,4 +344,28 @@ JValue InvokeProxyInvocationHandler(ScopedObjectAccessAlreadyRunnable& soa, cons
return zero;
}
}
+
+bool FillArrayData(mirror::Object* obj, const Instruction::ArrayDataPayload* payload) {
+ DCHECK_EQ(payload->ident, static_cast<uint16_t>(Instruction::kArrayDataSignature));
+ if (UNLIKELY(obj == nullptr)) {
+ ThrowNullPointerException(nullptr, "null array in FILL_ARRAY_DATA");
+ return false;
+ }
+ mirror::Array* array = obj->AsArray();
+ DCHECK(!array->IsObjectArray());
+ if (UNLIKELY(static_cast<int32_t>(payload->element_count) > array->GetLength())) {
+ Thread* self = Thread::Current();
+ ThrowLocation throw_location = self->GetCurrentLocationForThrow();
+ self->ThrowNewExceptionF(throw_location,
+ "Ljava/lang/ArrayIndexOutOfBoundsException;",
+ "failed FILL_ARRAY_DATA; length=%d, index=%d",
+ array->GetLength(), payload->element_count);
+ return false;
+ }
+ // Copy data from dex file to memory assuming both are little endian.
+ uint32_t size_in_bytes = payload->element_count * payload->element_width;
+ memcpy(array->GetRawData(payload->element_width, 0), payload->data, size_in_bytes);
+ return true;
+}
+
} // namespace art