summaryrefslogtreecommitdiff
path: root/runtime/mirror/array.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2024-09-30 09:04:41 +0000
committer Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-09-30 13:19:59 +0000
commite159a3bce2dc2dda37127592e8f0b39c377e05ec (patch)
tree0781d0f7353358aa98b5e609228e3665987a43c1 /runtime/mirror/array.cc
parent7b74ddc161107c60ab405e8ec3794d3aa32df5dc (diff)
Revert^5 "Object.clone() allocates more movable objects"
This reverts commit ea269f69d05fe333e4b36634b925c3c40fc8ce95. Bug: 355291033 Bug: 354087169 Bug: 360363656 Bug: 361327909 Bug: 364629185 Reason for revert: Failure on asan: +addressOf succeeded on movable object +Unexpectedly got 0 address in checkMovable Change-Id: I1f27845bf3fb7a1542f24b943d999f2d4da5e23a
Diffstat (limited to 'runtime/mirror/array.cc')
-rw-r--r--runtime/mirror/array.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/runtime/mirror/array.cc b/runtime/mirror/array.cc
index 65371d0f5e..a4f6c88e4c 100644
--- a/runtime/mirror/array.cc
+++ b/runtime/mirror/array.cc
@@ -144,8 +144,9 @@ ObjPtr<Array> Array::CopyOf(Handle<Array> h_this, Thread* self, int32_t new_leng
CHECK(klass->IsPrimitiveArray()) << "Will miss write barriers";
DCHECK_GE(new_length, 0);
auto* heap = Runtime::Current()->GetHeap();
- DCHECK(!heap->IsNonMovable(h_this.Get()));
- gc::AllocatorType allocator_type = heap->GetCurrentAllocator();
+ gc::AllocatorType allocator_type = heap->IsMovableObject(h_this.Get())
+ ? heap->GetCurrentAllocator()
+ : heap->GetCurrentNonMovingAllocator();
const auto component_size = klass->GetComponentSize();
const auto component_shift = klass->GetComponentSizeShift();
ObjPtr<Array> new_array =