diff options
author | Ian Rogers <irogers@google.com> | 2012-10-03 21:09:42 -0700 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2012-10-04 09:27:04 -0700 |
commit | 1f5393447b9f45be7918042d9ee7b521376de866 (patch) | |
tree | 1793cb0ae00b38a63f8cfd3a25b6cb0ee4edca16 /src/native | |
parent | 870ea4772199f8d4cbd9a269f9093620ee50a59c (diff) | |
download | art-1f5393447b9f45be7918042d9ee7b521376de866.zip art-1f5393447b9f45be7918042d9ee7b521376de866.tar.gz art-1f5393447b9f45be7918042d9ee7b521376de866.tar.bz2 |
Make PopSirt inlinable, pass self to SirtRef.
Change-Id: Ieb91526b1cb1f8644ceb3c5b99649f658f43bbc1
Diffstat (limited to 'src/native')
-rw-r--r-- | src/native/java_lang_reflect_Array.cc | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/native/java_lang_reflect_Array.cc b/src/native/java_lang_reflect_Array.cc index 49a4694..d3a57bf 100644 --- a/src/native/java_lang_reflect_Array.cc +++ b/src/native/java_lang_reflect_Array.cc @@ -19,17 +19,19 @@ #include "object.h" #include "object_utils.h" #include "scoped_thread_state_change.h" +#include "sirt_ref.h" namespace art { // Recursively create an array with multiple dimensions. Elements may be // Objects or primitive types. -static Array* CreateMultiArray(Class* array_class, int current_dimension, IntArray* dimensions) +static Array* CreateMultiArray(Thread* self, Class* array_class, int current_dimension, + IntArray* dimensions) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { int32_t array_length = dimensions->Get(current_dimension++); - SirtRef<Array> new_array(Array::Alloc(array_class, array_length)); + SirtRef<Array> new_array(self, Array::Alloc(array_class, array_length)); if (new_array.get() == NULL) { - CHECK(Thread::Current()->IsExceptionPending()); + CHECK(self->IsExceptionPending()); return NULL; } if (current_dimension == dimensions->GetLength()) { @@ -46,16 +48,17 @@ static Array* CreateMultiArray(Class* array_class, int current_dimension, IntArr Class* sub_array_class = class_linker->FindClass(sub_array_descriptor.c_str(), array_class->GetClassLoader()); if (sub_array_class == NULL) { - CHECK(Thread::Current()->IsExceptionPending()); + CHECK(self->IsExceptionPending()); return NULL; } DCHECK(sub_array_class->IsArrayClass()); // Create a new sub-array in every element of the array. - SirtRef<ObjectArray<Array> > object_array(new_array->AsObjectArray<Array>()); + SirtRef<ObjectArray<Array> > object_array(self, new_array->AsObjectArray<Array>()); for (int32_t i = 0; i < array_length; i++) { - SirtRef<Array> sub_array(CreateMultiArray(sub_array_class, current_dimension, dimensions)); + SirtRef<Array> sub_array(self, CreateMultiArray(self, sub_array_class, current_dimension, + dimensions)); if (sub_array.get() == NULL) { - CHECK(Thread::Current()->IsExceptionPending()); + CHECK(self->IsExceptionPending()); return NULL; } object_array->Set(i, sub_array.get()); @@ -105,13 +108,13 @@ static jobject Array_createMultiArray(JNIEnv* env, jclass, jclass javaElementCla ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); Class* array_class = class_linker->FindClass(descriptor.c_str(), element_class->GetClassLoader()); if (array_class == NULL) { - CHECK(Thread::Current()->IsExceptionPending()); + CHECK(soa.Self()->IsExceptionPending()); return NULL; } // create the array - Array* new_array = CreateMultiArray(array_class, 0, dimensions_array); + Array* new_array = CreateMultiArray(soa.Self(), array_class, 0, dimensions_array); if (new_array == NULL) { - CHECK(Thread::Current()->IsExceptionPending()); + CHECK(soa.Self()->IsExceptionPending()); return NULL; } return soa.AddLocalReference<jobject>(new_array); |