summaryrefslogtreecommitdiff
path: root/runtime/mirror/object_array-alloc-inl.h
diff options
context:
space:
mode:
author Hans Boehm <hboehm@google.com> 2024-09-04 00:27:53 +0000
committer Hans Boehm <hboehm@google.com> 2024-09-26 15:14:48 +0000
commitea269f69d05fe333e4b36634b925c3c40fc8ce95 (patch)
treedb1feb8fb32fd875bf899a45409610da99aa30f0 /runtime/mirror/object_array-alloc-inl.h
parentf255d9c2c508443ae4a0fb57f903db46ff3e39be (diff)
Revert^4 "Object.clone() allocates more movable objects"
This reverts commit fc0ed57a5f25d8a7b3fbf200224bd880ed05eff5. PS1 is identical to aosp/3231043 PS2 adds 2280-address-of test, re-allows non-movable objects to be allocated in LOS, and more generally tracks non-movable objects in other spaces. PS3 Style tweak PS4 Disable test on jvm Bug: 355291033 Bug: 354087169 Bug: 360363656 Bug: 361327909 Bug: 364629185 Test: Build and boot AOSP Test: testrunner.py --host -b --all-gc -t 2280-address-of Change-Id: I4b2929c353a6ede916762de509056817f001d6f8
Diffstat (limited to 'runtime/mirror/object_array-alloc-inl.h')
-rw-r--r--runtime/mirror/object_array-alloc-inl.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/runtime/mirror/object_array-alloc-inl.h b/runtime/mirror/object_array-alloc-inl.h
index e79d154f84..d3688762a4 100644
--- a/runtime/mirror/object_array-alloc-inl.h
+++ b/runtime/mirror/object_array-alloc-inl.h
@@ -66,9 +66,8 @@ 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();
- gc::AllocatorType allocator_type = heap->IsMovableObject(h_this.Get())
- ? heap->GetCurrentAllocator()
- : heap->GetCurrentNonMovingAllocator();
+ DCHECK(heap->PossiblyAllocatedMovable(h_this.Get()));
+ gc::AllocatorType allocator_type = heap->GetCurrentAllocator();
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));