summaryrefslogtreecommitdiffstats
path: root/runtime/interpreter
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-04-10 14:57:10 -0700
committerAndreas Gampe <agampe@google.com>2015-04-10 15:34:32 -0700
commite598e0439ab825ea1a42fe8002b54241c6163ce6 (patch)
tree307be41594ff3c804d5dcda890ac055a6a4f7674 /runtime/interpreter
parent1b743777e6b6cec3387b0ee347b6a8a03779c345 (diff)
downloadart-e598e0439ab825ea1a42fe8002b54241c6163ce6.tar.gz
art-e598e0439ab825ea1a42fe8002b54241c6163ce6.tar.bz2
art-e598e0439ab825ea1a42fe8002b54241c6163ce6.zip
ART: Add Array.createObjectArray to unstarted runtime
Necessary for compile-time initialization of android.text.Layout. Bug: 19542228 Change-Id: I4220c65fcc3a8aaa2765b6f07f1f81c330484244
Diffstat (limited to 'runtime/interpreter')
-rw-r--r--runtime/interpreter/unstarted_runtime.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/runtime/interpreter/unstarted_runtime.cc b/runtime/interpreter/unstarted_runtime.cc
index dd8c57b664..4fb634b668 100644
--- a/runtime/interpreter/unstarted_runtime.cc
+++ b/runtime/interpreter/unstarted_runtime.cc
@@ -781,6 +781,31 @@ static void UnstartedJNIArrayCreateMultiArray(Thread* self,
result->SetL(mirror::Array::CreateMultiArray(self, h_class, h_dimensions));
}
+static void UnstartedJNIArrayCreateObjectArray(Thread* self,
+ mirror::ArtMethod* method ATTRIBUTE_UNUSED,
+ mirror::Object* receiver ATTRIBUTE_UNUSED,
+ uint32_t* args,
+ JValue* result)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+ int32_t length = static_cast<int32_t>(args[1]);
+ if (length < 0) {
+ ThrowNegativeArraySizeException(length);
+ return;
+ }
+ mirror::Class* element_class = reinterpret_cast<mirror::Class*>(args[0])->AsClass();
+ Runtime* runtime = Runtime::Current();
+ ClassLinker* class_linker = runtime->GetClassLinker();
+ mirror::Class* array_class = class_linker->FindArrayClass(self, &element_class);
+ if (UNLIKELY(array_class == NULL)) {
+ CHECK(self->IsExceptionPending());
+ return;
+ }
+ DCHECK(array_class->IsObjectArrayClass());
+ mirror::Array* new_array = mirror::ObjectArray<mirror::Object*>::Alloc(
+ self, array_class, length, runtime->GetHeap()->GetCurrentAllocator());
+ result->SetL(new_array);
+}
+
static void UnstartedJNIThrowableNativeFillInStackTrace(Thread* self,
mirror::ArtMethod* method ATTRIBUTE_UNUSED,
mirror::Object* receiver ATTRIBUTE_UNUSED,
@@ -975,6 +1000,8 @@ static void UnstartedRuntimeInitializeJNIHandlers() {
&UnstartedJNIStringFastIndexOf },
{ "java.lang.Object java.lang.reflect.Array.createMultiArray(java.lang.Class, int[])",
&UnstartedJNIArrayCreateMultiArray },
+ { "java.lang.Object java.lang.reflect.Array.createObjectArray(java.lang.Class, int)",
+ &UnstartedJNIArrayCreateObjectArray },
{ "java.lang.Object java.lang.Throwable.nativeFillInStackTrace()",
&UnstartedJNIThrowableNativeFillInStackTrace },
{ "int java.lang.System.identityHashCode(java.lang.Object)",