diff options
author | 2024-08-19 21:32:19 +0000 | |
---|---|---|
committer | 2024-08-19 23:48:03 +0000 | |
commit | 7c89f49c2c542df1a5780fb851e2ef0e0909f48f (patch) | |
tree | 02bc90403e3f56bbb59c7fb1d89b785cd8257b28 /runtime/mirror/object_array-alloc-inl.h | |
parent | 806ace6dfa77cd65b05b20affb6a7e7072dcc845 (diff) |
Revert "Object.clone() allocates more movable objects"
This reverts commit a5001fed23788c966fd87048d7f17ba8c0b51914.
Reason for revert: b/360363656
Change-Id: Ibfea46976bb6434d728c69160edb5904ab7708aa
Diffstat (limited to 'runtime/mirror/object_array-alloc-inl.h')
-rw-r--r-- | runtime/mirror/object_array-alloc-inl.h | 5 |
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)); |