Implement the "unreasonable array allocation" OutOfMemoryError.
This doesn't fix test 061 because we still need AllocWithGrowth, but at least
it gets us far enough to need that.
Change-Id: Ia7b4a1f91a31e25d439f36b17280ce21c9ed8933
diff --git a/src/object_test.cc b/src/object_test.cc
index 1451929..167c770 100644
--- a/src/object_test.cc
+++ b/src/object_test.cc
@@ -172,27 +172,27 @@
EXPECT_TRUE(string->IsString());
}
-extern "C" Array* artArrayAllocFromCode(uint32_t type_idx, Method* method, int32_t component_count);
-TEST_F(ObjectTest, ArrayAllocFromCode) {
+extern "C" Array* artAllocArrayFromCode(uint32_t type_idx, Method* method, int32_t component_count);
+TEST_F(ObjectTest, AllocArrayFromCode) {
// pretend we are trying to call 'new char[3]' from String.toCharArray
Class* java_lang_String = class_linker_->FindSystemClass("Ljava/lang/String;");
Method* toCharArray = java_lang_String->FindVirtualMethod("toCharArray", "()[C");
uint32_t type_idx = FindTypeIdxByDescriptor(*java_lang_dex_file_.get(), "[C");
- Object* array = artArrayAllocFromCode(type_idx, toCharArray, 3);
+ Object* array = artAllocArrayFromCode(type_idx, toCharArray, 3);
EXPECT_TRUE(array->IsArrayInstance());
EXPECT_EQ(3, array->AsArray()->GetLength());
EXPECT_TRUE(array->GetClass()->IsArrayClass());
EXPECT_TRUE(array->GetClass()->GetComponentType()->IsPrimitive());
}
-extern "C" Array* artCheckAndArrayAllocFromCode(uint32_t type_idx, Method* method,
+extern "C" Array* artCheckAndAllocArrayFromCode(uint32_t type_idx, Method* method,
int32_t component_count);
-TEST_F(ObjectTest, CheckAndArrayAllocFromCode) {
+TEST_F(ObjectTest, CheckAndAllocArrayFromCode) {
// pretend we are trying to call 'new char[3]' from String.toCharArray
Class* java_util_Arrays = class_linker_->FindSystemClass("Ljava/util/Arrays;");
Method* sort = java_util_Arrays->FindDirectMethod("sort", "([I)V");
uint32_t type_idx = FindTypeIdxByDescriptor(*java_lang_dex_file_.get(), "[I");
- Object* array = artCheckAndArrayAllocFromCode(type_idx, sort, 3);
+ Object* array = artCheckAndAllocArrayFromCode(type_idx, sort, 3);
EXPECT_TRUE(array->IsArrayInstance());
EXPECT_EQ(3, array->AsArray()->GetLength());
EXPECT_TRUE(array->GetClass()->IsArrayClass());