From ea269f69d05fe333e4b36634b925c3c40fc8ce95 Mon Sep 17 00:00:00 2001 From: Hans Boehm Date: Wed, 4 Sep 2024 00:27:53 +0000 Subject: 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 --- runtime/mirror/object_array-alloc-inl.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'runtime/mirror/object_array-alloc-inl.h') 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::CopyOf(Handle> 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> 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)); -- cgit v1.2.3-59-g8ed1b