summaryrefslogtreecommitdiff
path: root/runtime/mirror/array.cc
diff options
context:
space:
mode:
author Hans Boehm <hboehm@google.com> 2024-08-19 21:32:19 +0000
committer Hans Boehm <hboehm@google.com> 2024-08-19 23:48:03 +0000
commit7c89f49c2c542df1a5780fb851e2ef0e0909f48f (patch)
tree02bc90403e3f56bbb59c7fb1d89b785cd8257b28 /runtime/mirror/array.cc
parent806ace6dfa77cd65b05b20affb6a7e7072dcc845 (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/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 =