From 1956542906d0b128a86975af009ba4601d02129a Mon Sep 17 00:00:00 2001 From: Hans Boehm Date: Tue, 20 Aug 2024 00:38:50 +0000 Subject: Revert^2 "Object.clone() allocates more movable objects" This reverts commit 7c89f49c2c542df1a5780fb851e2ef0e0909f48f. PS1 is identical to aosp/3200711. PS2 revises the approach a bit by continuing to allocate non-movable objects in LargeObjectsSpace, but tracking them explicitly in a renamed, and now lock-protected, data structure stray_non_movable_objects_, which explicitly tracks nonmovable objects in both zygote and large objects spaces. This was done after discovering that there are applications that allocate more than 64MB of mostly large DirectByteBuffers. Also modifies 070-nio-buffer to check that we can allocate lots of direct ByteBuffers. PS3-PS5 have minor tweaks (comments and slight code simplification). Bug: 355291033 Bug: 354087169 Bug: 360363656 Bug: 361327909 Test: Build and boot AOSP Test: testrunner.py --host -b --all-gc -t 070-nio-buffer Change-Id: Ia6948c516b30188934a644a3f8f788914dfabb2a --- runtime/mirror/array-alloc-inl.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'runtime/mirror/array-alloc-inl.h') diff --git a/runtime/mirror/array-alloc-inl.h b/runtime/mirror/array-alloc-inl.h index b905fd1727..69d2e2017f 100644 --- a/runtime/mirror/array-alloc-inl.h +++ b/runtime/mirror/array-alloc-inl.h @@ -143,16 +143,14 @@ inline ObjPtr Array::Alloc(Thread* self, ObjPtr result; if (!kFillUsable) { SetLengthVisitor visitor(component_count); - result = ObjPtr::DownCast( - heap->AllocObjectWithAllocator( - self, array_class, size, allocator_type, visitor)); + result = ObjPtr::DownCast(heap->AllocObjectWithAllocator( + self, array_class, size, allocator_type, visitor)); } else { SetLengthToUsableSizeVisitor visitor(component_count, DataOffset(1U << component_size_shift).SizeValue(), component_size_shift); - result = ObjPtr::DownCast( - heap->AllocObjectWithAllocator( - self, array_class, size, allocator_type, visitor)); + result = ObjPtr::DownCast(heap->AllocObjectWithAllocator( + self, array_class, size, allocator_type, visitor)); } if (kIsDebugBuild && result != nullptr && Runtime::Current()->IsStarted()) { array_class = result->GetClass(); // In case the array class moved. -- cgit v1.2.3-59-g8ed1b