ART: Add array-alloc-inl.h

In an effort to reduce the (transitive) proliferation of heap-inl
add a specific inline header for array allocation.

Bug: 118385392
Test: mmma art
Test: m test-art-host
Change-Id: Id3378f40c52fa7ef4297af08cb7509e0c04b94d1
diff --git a/openjdkjvmti/ti_class.cc b/openjdkjvmti/ti_class.cc
index e469270..0c07f56 100644
--- a/openjdkjvmti/ti_class.cc
+++ b/openjdkjvmti/ti_class.cc
@@ -56,6 +56,7 @@
 #include "handle.h"
 #include "jni/jni_env_ext-inl.h"
 #include "jni/jni_internal.h"
+#include "mirror/array-alloc-inl.h"
 #include "mirror/array-inl.h"
 #include "mirror/class-inl.h"
 #include "mirror/class_ext.h"
diff --git a/openjdkjvmti/ti_class_loader.cc b/openjdkjvmti/ti_class_loader.cc
index 9a32849..348a1ff 100644
--- a/openjdkjvmti/ti_class_loader.cc
+++ b/openjdkjvmti/ti_class_loader.cc
@@ -48,6 +48,8 @@
 #include "jit/jit_code_cache.h"
 #include "jni/jni_env_ext-inl.h"
 #include "jvmti_allocator.h"
+#include "mirror/array-alloc-inl.h"
+#include "mirror/array-inl.h"
 #include "mirror/class.h"
 #include "mirror/class_ext.h"
 #include "mirror/object.h"
diff --git a/openjdkjvmti/ti_redefine.cc b/openjdkjvmti/ti_redefine.cc
index 7525c02..5adfe42 100644
--- a/openjdkjvmti/ti_redefine.cc
+++ b/openjdkjvmti/ti_redefine.cc
@@ -63,6 +63,7 @@
 #include "jni/jni_env_ext-inl.h"
 #include "jvmti_allocator.h"
 #include "linear_alloc.h"
+#include "mirror/array-alloc-inl.h"
 #include "mirror/class-inl.h"
 #include "mirror/class_ext.h"
 #include "mirror/object.h"
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index c18abab..afd2b6c 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -87,6 +87,8 @@
 #include "jni/java_vm_ext.h"
 #include "jni/jni_internal.h"
 #include "linear_alloc.h"
+#include "mirror/array-alloc-inl.h"
+#include "mirror/array-inl.h"
 #include "mirror/call_site.h"
 #include "mirror/class-inl.h"
 #include "mirror/class.h"
diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc
index 27ac90b..af71727 100644
--- a/runtime/class_linker_test.cc
+++ b/runtime/class_linker_test.cc
@@ -33,6 +33,7 @@
 #include "experimental_flags.h"
 #include "gc/heap.h"
 #include "handle_scope-inl.h"
+#include "mirror/array-alloc-inl.h"
 #include "mirror/accessible_object.h"
 #include "mirror/call_site.h"
 #include "mirror/class-inl.h"
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 099cadc..fcc5ce6 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -53,6 +53,7 @@
 #include "jdwp/object_registry.h"
 #include "jni/jni_internal.h"
 #include "jvalue-inl.h"
+#include "mirror/array-alloc-inl.h"
 #include "mirror/class-inl.h"
 #include "mirror/class.h"
 #include "mirror/class_loader.h"
diff --git a/runtime/dex/dex_file_annotations.cc b/runtime/dex/dex_file_annotations.cc
index fb63c82..246cbca 100644
--- a/runtime/dex/dex_file_annotations.cc
+++ b/runtime/dex/dex_file_annotations.cc
@@ -27,8 +27,10 @@
 #include "dex/dex_file-inl.h"
 #include "jni/jni_internal.h"
 #include "jvalue-inl.h"
+#include "mirror/array-alloc-inl.h"
 #include "mirror/field.h"
 #include "mirror/method.h"
+#include "mirror/object_array-inl.h"
 #include "oat_file.h"
 #include "obj_ptr-inl.h"
 #include "reflection.h"
diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h
index 120a0e9..b45bb59 100644
--- a/runtime/entrypoints/entrypoint_utils-inl.h
+++ b/runtime/entrypoints/entrypoint_utils-inl.h
@@ -32,7 +32,7 @@
 #include "imtable-inl.h"
 #include "indirect_reference_table.h"
 #include "jni/jni_internal.h"
-#include "mirror/array.h"
+#include "mirror/array-alloc-inl.h"
 #include "mirror/class-inl.h"
 #include "mirror/object-inl.h"
 #include "mirror/throwable.h"
diff --git a/runtime/gc/accounting/mod_union_table_test.cc b/runtime/gc/accounting/mod_union_table_test.cc
index 2a382d7..a617789 100644
--- a/runtime/gc/accounting/mod_union_table_test.cc
+++ b/runtime/gc/accounting/mod_union_table_test.cc
@@ -20,6 +20,7 @@
 #include "class_root.h"
 #include "common_runtime_test.h"
 #include "gc/space/space-inl.h"
+#include "mirror/array-alloc-inl.h"
 #include "mirror/array-inl.h"
 #include "space_bitmap-inl.h"
 #include "thread-current-inl.h"
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc
index 72a1330..9857249 100644
--- a/runtime/interpreter/interpreter_common.cc
+++ b/runtime/interpreter/interpreter_common.cc
@@ -29,6 +29,7 @@
 #include "jvalue-inl.h"
 #include "method_handles-inl.h"
 #include "method_handles.h"
+#include "mirror/array-alloc-inl.h"
 #include "mirror/array-inl.h"
 #include "mirror/class.h"
 #include "mirror/emulated_stack_frame.h"
diff --git a/runtime/interpreter/unstarted_runtime.cc b/runtime/interpreter/unstarted_runtime.cc
index 07afba4..eae3fbc 100644
--- a/runtime/interpreter/unstarted_runtime.cc
+++ b/runtime/interpreter/unstarted_runtime.cc
@@ -44,6 +44,7 @@
 #include "hidden_api.h"
 #include "interpreter/interpreter_common.h"
 #include "jvalue-inl.h"
+#include "mirror/array-alloc-inl.h"
 #include "mirror/array-inl.h"
 #include "mirror/class.h"
 #include "mirror/field-inl.h"
diff --git a/runtime/interpreter/unstarted_runtime_test.cc b/runtime/interpreter/unstarted_runtime_test.cc
index 3fafc31..727c5f3 100644
--- a/runtime/interpreter/unstarted_runtime_test.cc
+++ b/runtime/interpreter/unstarted_runtime_test.cc
@@ -30,6 +30,7 @@
 #include "handle.h"
 #include "handle_scope-inl.h"
 #include "interpreter/interpreter_common.h"
+#include "mirror/array-alloc-inl.h"
 #include "mirror/class_loader.h"
 #include "mirror/object-inl.h"
 #include "mirror/object_array-inl.h"
diff --git a/runtime/mirror/array-alloc-inl.h b/runtime/mirror/array-alloc-inl.h
new file mode 100644
index 0000000..4250ff8
--- /dev/null
+++ b/runtime/mirror/array-alloc-inl.h
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ART_RUNTIME_MIRROR_ARRAY_ALLOC_INL_H_
+#define ART_RUNTIME_MIRROR_ARRAY_ALLOC_INL_H_
+
+#include "array-inl.h"
+
+#include <android-base/logging.h>
+#include <android-base/stringprintf.h>
+
+#include "base/bit_utils.h"
+#include "base/casts.h"
+#include "class.h"
+#include "gc/heap-inl.h"
+#include "obj_ptr-inl.h"
+#include "runtime.h"
+
+namespace art {
+namespace mirror {
+
+static inline size_t ComputeArraySize(int32_t component_count, size_t component_size_shift) {
+  DCHECK_GE(component_count, 0);
+
+  size_t component_size = 1U << component_size_shift;
+  size_t header_size = Array::DataOffset(component_size).SizeValue();
+  size_t data_size = static_cast<size_t>(component_count) << component_size_shift;
+  size_t size = header_size + data_size;
+
+  // Check for size_t overflow if this was an unreasonable request
+  // but let the caller throw OutOfMemoryError.
+#ifdef __LP64__
+  // 64-bit. No overflow as component_count is 32-bit and the maximum
+  // component size is 8.
+  DCHECK_LE((1U << component_size_shift), 8U);
+#else
+  // 32-bit.
+  DCHECK_NE(header_size, 0U);
+  DCHECK_EQ(RoundUp(header_size, component_size), header_size);
+  // The array length limit (exclusive).
+  const size_t length_limit = (0U - header_size) >> component_size_shift;
+  if (UNLIKELY(length_limit <= static_cast<size_t>(component_count))) {
+    return 0;  // failure
+  }
+#endif
+  return size;
+}
+
+// Used for setting the array length in the allocation code path to ensure it is guarded by a
+// StoreStore fence.
+class SetLengthVisitor {
+ public:
+  explicit SetLengthVisitor(int32_t length) : length_(length) {
+  }
+
+  void operator()(ObjPtr<Object> obj, size_t usable_size ATTRIBUTE_UNUSED) const
+      REQUIRES_SHARED(Locks::mutator_lock_) {
+    // Avoid AsArray as object is not yet in live bitmap or allocation stack.
+    ObjPtr<Array> array = ObjPtr<Array>::DownCast(obj);
+    // DCHECK(array->IsArrayInstance());
+    array->SetLength(length_);
+  }
+
+ private:
+  const int32_t length_;
+
+  DISALLOW_COPY_AND_ASSIGN(SetLengthVisitor);
+};
+
+// Similar to SetLengthVisitor, used for setting the array length to fill the usable size of an
+// array.
+class SetLengthToUsableSizeVisitor {
+ public:
+  SetLengthToUsableSizeVisitor(int32_t min_length, size_t header_size,
+                               size_t component_size_shift) :
+      minimum_length_(min_length), header_size_(header_size),
+      component_size_shift_(component_size_shift) {
+  }
+
+  void operator()(ObjPtr<Object> obj, size_t usable_size) const
+      REQUIRES_SHARED(Locks::mutator_lock_) {
+    // Avoid AsArray as object is not yet in live bitmap or allocation stack.
+    ObjPtr<Array> array = ObjPtr<Array>::DownCast(obj);
+    // DCHECK(array->IsArrayInstance());
+    int32_t length = (usable_size - header_size_) >> component_size_shift_;
+    DCHECK_GE(length, minimum_length_);
+    uint8_t* old_end = reinterpret_cast<uint8_t*>(array->GetRawData(1U << component_size_shift_,
+                                                                    minimum_length_));
+    uint8_t* new_end = reinterpret_cast<uint8_t*>(array->GetRawData(1U << component_size_shift_,
+                                                                    length));
+    // Ensure space beyond original allocation is zeroed.
+    memset(old_end, 0, new_end - old_end);
+    array->SetLength(length);
+  }
+
+ private:
+  const int32_t minimum_length_;
+  const size_t header_size_;
+  const size_t component_size_shift_;
+
+  DISALLOW_COPY_AND_ASSIGN(SetLengthToUsableSizeVisitor);
+};
+
+template <bool kIsInstrumented, bool kFillUsable>
+inline ObjPtr<Array> Array::Alloc(Thread* self,
+                                  ObjPtr<Class> array_class,
+                                  int32_t component_count,
+                                  size_t component_size_shift,
+                                  gc::AllocatorType allocator_type) {
+  DCHECK(allocator_type != gc::kAllocatorTypeLOS);
+  DCHECK(array_class != nullptr);
+  DCHECK(array_class->IsArrayClass());
+  DCHECK_EQ(array_class->GetComponentSizeShift(), component_size_shift);
+  DCHECK_EQ(array_class->GetComponentSize(), (1U << component_size_shift));
+  size_t size = ComputeArraySize(component_count, component_size_shift);
+#ifdef __LP64__
+  // 64-bit. No size_t overflow.
+  DCHECK_NE(size, 0U);
+#else
+  // 32-bit.
+  if (UNLIKELY(size == 0)) {
+    self->ThrowOutOfMemoryError(android::base::StringPrintf("%s of length %d would overflow",
+                                                            array_class->PrettyDescriptor().c_str(),
+                                                            component_count).c_str());
+    return nullptr;
+  }
+#endif
+  gc::Heap* heap = Runtime::Current()->GetHeap();
+  ObjPtr<Array> result;
+  if (!kFillUsable) {
+    SetLengthVisitor visitor(component_count);
+    result = ObjPtr<Array>::DownCast(MakeObjPtr(
+        heap->AllocObjectWithAllocator<kIsInstrumented, true>(self, array_class, size,
+                                                              allocator_type, visitor)));
+  } else {
+    SetLengthToUsableSizeVisitor visitor(component_count,
+                                         DataOffset(1U << component_size_shift).SizeValue(),
+                                         component_size_shift);
+    result = ObjPtr<Array>::DownCast(MakeObjPtr(
+        heap->AllocObjectWithAllocator<kIsInstrumented, true>(self, array_class, size,
+                                                              allocator_type, visitor)));
+  }
+  if (kIsDebugBuild && result != nullptr && Runtime::Current()->IsStarted()) {
+    array_class = result->GetClass();  // In case the array class moved.
+    CHECK_EQ(array_class->GetComponentSize(), 1U << component_size_shift);
+    if (!kFillUsable) {
+      CHECK_EQ(result->SizeOf(), size);
+    } else {
+      CHECK_GE(result->SizeOf(), size);
+    }
+  }
+  return result;
+}
+
+template<typename T>
+inline ObjPtr<PrimitiveArray<T>> PrimitiveArray<T>::AllocateAndFill(Thread* self,
+                                                                   const T* data,
+                                                                   size_t length) {
+  StackHandleScope<1> hs(self);
+  Handle<PrimitiveArray<T>> arr(hs.NewHandle(PrimitiveArray<T>::Alloc(self, length)));
+  if (!arr.IsNull()) {
+    // Copy it in. Just skip if it's null
+    memcpy(arr->GetData(), data, sizeof(T) * length);
+  }
+  return arr.Get();
+}
+
+}  // namespace mirror
+}  // namespace art
+
+#endif  // ART_RUNTIME_MIRROR_ARRAY_ALLOC_INL_H_
diff --git a/runtime/mirror/array-inl.h b/runtime/mirror/array-inl.h
index d806e40..4427332 100644
--- a/runtime/mirror/array-inl.h
+++ b/runtime/mirror/array-inl.h
@@ -20,12 +20,10 @@
 #include "array.h"
 
 #include <android-base/logging.h>
-#include <android-base/stringprintf.h>
 
 #include "base/bit_utils.h"
 #include "base/casts.h"
 #include "class.h"
-#include "gc/heap-inl.h"
 #include "obj_ptr-inl.h"
 #include "runtime.h"
 #include "thread-current-inl.h"
@@ -61,152 +59,6 @@
   return true;
 }
 
-static inline size_t ComputeArraySize(int32_t component_count, size_t component_size_shift) {
-  DCHECK_GE(component_count, 0);
-
-  size_t component_size = 1U << component_size_shift;
-  size_t header_size = Array::DataOffset(component_size).SizeValue();
-  size_t data_size = static_cast<size_t>(component_count) << component_size_shift;
-  size_t size = header_size + data_size;
-
-  // Check for size_t overflow if this was an unreasonable request
-  // but let the caller throw OutOfMemoryError.
-#ifdef __LP64__
-  // 64-bit. No overflow as component_count is 32-bit and the maximum
-  // component size is 8.
-  DCHECK_LE((1U << component_size_shift), 8U);
-#else
-  // 32-bit.
-  DCHECK_NE(header_size, 0U);
-  DCHECK_EQ(RoundUp(header_size, component_size), header_size);
-  // The array length limit (exclusive).
-  const size_t length_limit = (0U - header_size) >> component_size_shift;
-  if (UNLIKELY(length_limit <= static_cast<size_t>(component_count))) {
-    return 0;  // failure
-  }
-#endif
-  return size;
-}
-
-// Used for setting the array length in the allocation code path to ensure it is guarded by a
-// StoreStore fence.
-class SetLengthVisitor {
- public:
-  explicit SetLengthVisitor(int32_t length) : length_(length) {
-  }
-
-  void operator()(ObjPtr<Object> obj, size_t usable_size ATTRIBUTE_UNUSED) const
-      REQUIRES_SHARED(Locks::mutator_lock_) {
-    // Avoid AsArray as object is not yet in live bitmap or allocation stack.
-    ObjPtr<Array> array = ObjPtr<Array>::DownCast(obj);
-    // DCHECK(array->IsArrayInstance());
-    array->SetLength(length_);
-  }
-
- private:
-  const int32_t length_;
-
-  DISALLOW_COPY_AND_ASSIGN(SetLengthVisitor);
-};
-
-// Similar to SetLengthVisitor, used for setting the array length to fill the usable size of an
-// array.
-class SetLengthToUsableSizeVisitor {
- public:
-  SetLengthToUsableSizeVisitor(int32_t min_length, size_t header_size,
-                               size_t component_size_shift) :
-      minimum_length_(min_length), header_size_(header_size),
-      component_size_shift_(component_size_shift) {
-  }
-
-  void operator()(ObjPtr<Object> obj, size_t usable_size) const
-      REQUIRES_SHARED(Locks::mutator_lock_) {
-    // Avoid AsArray as object is not yet in live bitmap or allocation stack.
-    ObjPtr<Array> array = ObjPtr<Array>::DownCast(obj);
-    // DCHECK(array->IsArrayInstance());
-    int32_t length = (usable_size - header_size_) >> component_size_shift_;
-    DCHECK_GE(length, minimum_length_);
-    uint8_t* old_end = reinterpret_cast<uint8_t*>(array->GetRawData(1U << component_size_shift_,
-                                                                    minimum_length_));
-    uint8_t* new_end = reinterpret_cast<uint8_t*>(array->GetRawData(1U << component_size_shift_,
-                                                                    length));
-    // Ensure space beyond original allocation is zeroed.
-    memset(old_end, 0, new_end - old_end);
-    array->SetLength(length);
-  }
-
- private:
-  const int32_t minimum_length_;
-  const size_t header_size_;
-  const size_t component_size_shift_;
-
-  DISALLOW_COPY_AND_ASSIGN(SetLengthToUsableSizeVisitor);
-};
-
-template <bool kIsInstrumented, bool kFillUsable>
-inline ObjPtr<Array> Array::Alloc(Thread* self,
-                                  ObjPtr<Class> array_class,
-                                  int32_t component_count,
-                                  size_t component_size_shift,
-                                  gc::AllocatorType allocator_type) {
-  DCHECK(allocator_type != gc::kAllocatorTypeLOS);
-  DCHECK(array_class != nullptr);
-  DCHECK(array_class->IsArrayClass());
-  DCHECK_EQ(array_class->GetComponentSizeShift(), component_size_shift);
-  DCHECK_EQ(array_class->GetComponentSize(), (1U << component_size_shift));
-  size_t size = ComputeArraySize(component_count, component_size_shift);
-#ifdef __LP64__
-  // 64-bit. No size_t overflow.
-  DCHECK_NE(size, 0U);
-#else
-  // 32-bit.
-  if (UNLIKELY(size == 0)) {
-    self->ThrowOutOfMemoryError(android::base::StringPrintf("%s of length %d would overflow",
-                                                            array_class->PrettyDescriptor().c_str(),
-                                                            component_count).c_str());
-    return nullptr;
-  }
-#endif
-  gc::Heap* heap = Runtime::Current()->GetHeap();
-  ObjPtr<Array> result;
-  if (!kFillUsable) {
-    SetLengthVisitor visitor(component_count);
-    result = ObjPtr<Array>::DownCast(MakeObjPtr(
-        heap->AllocObjectWithAllocator<kIsInstrumented, true>(self, array_class, size,
-                                                              allocator_type, visitor)));
-  } else {
-    SetLengthToUsableSizeVisitor visitor(component_count,
-                                         DataOffset(1U << component_size_shift).SizeValue(),
-                                         component_size_shift);
-    result = ObjPtr<Array>::DownCast(MakeObjPtr(
-        heap->AllocObjectWithAllocator<kIsInstrumented, true>(self, array_class, size,
-                                                              allocator_type, visitor)));
-  }
-  if (kIsDebugBuild && result != nullptr && Runtime::Current()->IsStarted()) {
-    array_class = result->GetClass();  // In case the array class moved.
-    CHECK_EQ(array_class->GetComponentSize(), 1U << component_size_shift);
-    if (!kFillUsable) {
-      CHECK_EQ(result->SizeOf(), size);
-    } else {
-      CHECK_GE(result->SizeOf(), size);
-    }
-  }
-  return result;
-}
-
-template<typename T>
-inline ObjPtr<PrimitiveArray<T>> PrimitiveArray<T>::AllocateAndFill(Thread* self,
-                                                                   const T* data,
-                                                                   size_t length) {
-  StackHandleScope<1> hs(self);
-  Handle<PrimitiveArray<T>> arr(hs.NewHandle(PrimitiveArray<T>::Alloc(self, length)));
-  if (!arr.IsNull()) {
-    // Copy it in. Just skip if it's null
-    memcpy(arr->GetData(), data, sizeof(T) * length);
-  }
-  return arr.Get();
-}
-
 template<typename T>
 inline T PrimitiveArray<T>::Get(int32_t i) {
   if (!CheckIsValidIndex(i)) {
diff --git a/runtime/mirror/array.cc b/runtime/mirror/array.cc
index 66ec368..e67c713 100644
--- a/runtime/mirror/array.cc
+++ b/runtime/mirror/array.cc
@@ -16,6 +16,7 @@
 
 #include "array-inl.h"
 
+#include "array-alloc-inl.h"
 #include "base/utils.h"
 #include "class-inl.h"
 #include "class.h"
diff --git a/runtime/mirror/array.h b/runtime/mirror/array.h
index 7edc851..7211f30 100644
--- a/runtime/mirror/array.h
+++ b/runtime/mirror/array.h
@@ -26,6 +26,7 @@
 namespace art {
 
 template<class T> class Handle;
+class Thread;
 
 namespace mirror {
 
diff --git a/runtime/mirror/emulated_stack_frame.cc b/runtime/mirror/emulated_stack_frame.cc
index ce39049..a1c536b 100644
--- a/runtime/mirror/emulated_stack_frame.cc
+++ b/runtime/mirror/emulated_stack_frame.cc
@@ -16,6 +16,8 @@
 
 #include "emulated_stack_frame.h"
 
+#include "array-alloc-inl.h"
+#include "array-inl.h"
 #include "class-inl.h"
 #include "class_root.h"
 #include "jvalue-inl.h"
diff --git a/runtime/mirror/object_array-inl.h b/runtime/mirror/object_array-inl.h
index 7d101bf..4198d36 100644
--- a/runtime/mirror/object_array-inl.h
+++ b/runtime/mirror/object_array-inl.h
@@ -23,6 +23,7 @@
 
 #include "android-base/stringprintf.h"
 
+#include "array-alloc-inl.h"
 #include "array-inl.h"
 #include "base/utils.h"
 #include "class.h"
diff --git a/runtime/mirror/object_test.cc b/runtime/mirror/object_test.cc
index cf6543f..71bf033 100644
--- a/runtime/mirror/object_test.cc
+++ b/runtime/mirror/object_test.cc
@@ -20,6 +20,7 @@
 #include <stdio.h>
 #include <memory>
 
+#include "array-alloc-inl.h"
 #include "array-inl.h"
 #include "art_field-inl.h"
 #include "art_method-inl.h"
diff --git a/runtime/mirror/string.cc b/runtime/mirror/string.cc
index d5ef039..ae4c7cc 100644
--- a/runtime/mirror/string.cc
+++ b/runtime/mirror/string.cc
@@ -17,7 +17,7 @@
 #include "string-inl.h"
 
 #include "arch/memcmp16.h"
-#include "array.h"
+#include "array-alloc-inl.h"
 #include "base/array_ref.h"
 #include "base/stl_util.h"
 #include "class-inl.h"
diff --git a/runtime/native/dalvik_system_VMDebug.cc b/runtime/native/dalvik_system_VMDebug.cc
index 24c8d14..1531bac 100644
--- a/runtime/native/dalvik_system_VMDebug.cc
+++ b/runtime/native/dalvik_system_VMDebug.cc
@@ -38,6 +38,8 @@
 #include "hprof/hprof.h"
 #include "jni/java_vm_ext.h"
 #include "jni/jni_internal.h"
+#include "mirror/array-alloc-inl.h"
+#include "mirror/array-inl.h"
 #include "mirror/class.h"
 #include "mirror/object_array-inl.h"
 #include "native_util.h"
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc
index 2a3ea46..0d7160e 100644
--- a/runtime/native/dalvik_system_VMRuntime.cc
+++ b/runtime/native/dalvik_system_VMRuntime.cc
@@ -44,6 +44,7 @@
 #include "intern_table.h"
 #include "jni/java_vm_ext.h"
 #include "jni/jni_internal.h"
+#include "mirror/array-alloc-inl.h"
 #include "mirror/class-inl.h"
 #include "mirror/dex_cache-inl.h"
 #include "mirror/object-inl.h"
diff --git a/runtime/reference_table_test.cc b/runtime/reference_table_test.cc
index 1d54d21..3ea1714 100644
--- a/runtime/reference_table_test.cc
+++ b/runtime/reference_table_test.cc
@@ -26,6 +26,7 @@
 #include "dex/primitive.h"
 #include "handle_scope-inl.h"
 #include "mirror/array-inl.h"
+#include "mirror/array-alloc-inl.h"
 #include "mirror/class-inl.h"
 #include "mirror/class_loader.h"
 #include "mirror/string.h"
diff --git a/runtime/transaction_test.cc b/runtime/transaction_test.cc
index 370a619..da6998b 100644
--- a/runtime/transaction_test.cc
+++ b/runtime/transaction_test.cc
@@ -21,7 +21,7 @@
 #include "class_linker-inl.h"
 #include "common_runtime_test.h"
 #include "dex/dex_file.h"
-#include "mirror/array-inl.h"
+#include "mirror/array-alloc-inl.h"
 #include "scoped_thread_state_change-inl.h"
 
 namespace art {