Remove PrimitiveArray<T>::array_class_.
And ObjPtr<>-ify jni_internal.cc while we're touching it.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 31113334
Change-Id: I15a8ade772e3e4337371c6f3c472f9efea9f4636
diff --git a/runtime/mirror/array.cc b/runtime/mirror/array.cc
index ea202e7..06ce0bb 100644
--- a/runtime/mirror/array.cc
+++ b/runtime/mirror/array.cc
@@ -20,6 +20,7 @@
#include "class-inl.h"
#include "class.h"
#include "class_linker-inl.h"
+#include "class_root.h"
#include "common_throws.h"
#include "dex/dex_file-inl.h"
#include "gc/accounting/card_table-inl.h"
@@ -118,6 +119,16 @@
return new_array.Ptr();
}
+template<typename T>
+PrimitiveArray<T>* PrimitiveArray<T>::Alloc(Thread* self, size_t length) {
+ Array* raw_array = Array::Alloc<true>(self,
+ GetClassRoot<PrimitiveArray<T>>(),
+ length,
+ ComponentSizeShiftWidth(sizeof(T)),
+ Runtime::Current()->GetHeap()->GetCurrentAllocator());
+ return down_cast<PrimitiveArray<T>*>(raw_array);
+}
+
void Array::ThrowArrayIndexOutOfBoundsException(int32_t index) {
art::ThrowArrayIndexOutOfBoundsException(index, GetLength());
}
@@ -146,9 +157,6 @@
return new_array.Ptr();
}
-
-template <typename T> GcRoot<Class> PrimitiveArray<T>::array_class_;
-
// Explicitly instantiate all the primitive array types.
template class PrimitiveArray<uint8_t>; // BooleanArray
template class PrimitiveArray<int8_t>; // ByteArray