From 528b169d1351f3606778ba10fe9ae8fcecf7a7c4 Mon Sep 17 00:00:00 2001 From: Lokesh Gidra Date: Tue, 12 Oct 2021 15:30:43 -0700 Subject: Stop-the-world compaction phase The CL implements the core logic for per-page compaction, but in a stop-the-world pause. Even though it's performed during a pause, it handles every page independetly as the final goal is to have a concurrent implementation. This CL doesn't handle updating the native roots. Also, the black allocations since the marking-phase pause are not handled yet. Test: art/test/testrunner/testrunner.py Bug: 160737021 Change-Id: Ib0be20663e0f9f76ee66a2a42180c4bd3579e41b --- runtime/mirror/object_array-inl.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'runtime/mirror/object_array-inl.h') diff --git a/runtime/mirror/object_array-inl.h b/runtime/mirror/object_array-inl.h index e4fe03b357..1bd0185743 100644 --- a/runtime/mirror/object_array-inl.h +++ b/runtime/mirror/object_array-inl.h @@ -327,7 +327,20 @@ template template inline void ObjectArray::VisitReferences(const Visitor& visitor) { const size_t length = static_cast(GetLength()); for (size_t i = 0; i < length; ++i) { - visitor(this, OffsetOfElement(i), false); + visitor(this, OffsetOfElement(i), /* is_static= */ false); + } +} + +template template +inline void ObjectArray::VisitReferences(const Visitor& visitor, + MemberOffset begin, + MemberOffset end) { + const size_t length = static_cast(GetLength()); + begin = std::max(begin, OffsetOfElement(0)); + end = std::min(end, OffsetOfElement(length)); + while (begin < end) { + visitor(this, begin, /* is_static= */ false, /*is_obj_array*/ true); + begin += kHeapReferenceSize; } } -- cgit v1.2.3-59-g8ed1b