summaryrefslogtreecommitdiff
path: root/runtime/mirror/object_array-alloc-inl.h
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/object_array-alloc-inl.h
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/object_array-alloc-inl.h')
-rw-r--r--runtime/mirror/object_array-alloc-inl.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/runtime/mirror/object_array-alloc-inl.h b/runtime/mirror/object_array-alloc-inl.h
index d3688762a4..e79d154f84 100644
--- a/runtime/mirror/object_array-alloc-inl.h
+++ b/runtime/mirror/object_array-alloc-inl.h
@@ -66,8 +66,9 @@ inline ObjPtr<ObjectArray<T>> ObjectArray<T>::CopyOf(Handle<ObjectArray<T>> h_th
int32_t new_length) {
DCHECK_GE(new_length, 0);
gc::Heap* heap = Runtime::Current()->GetHeap();
- DCHECK(heap->PossiblyAllocatedMovable(h_this.Get()));
- gc::AllocatorType allocator_type = heap->GetCurrentAllocator();
+ gc::AllocatorType allocator_type = heap->IsMovableObject(h_this.Get())
+ ? heap->GetCurrentAllocator()
+ : heap->GetCurrentNonMovingAllocator();
ObjPtr<ObjectArray<T>> new_array = Alloc(self, h_this->GetClass(), new_length, allocator_type);
if (LIKELY(new_array != nullptr)) {
new_array->AssignableMemcpy(0, h_this.Get(), 0, std::min(h_this->GetLength(), new_length));