From b7607c2fd67e12e998aebd71db38414ffc65621b Mon Sep 17 00:00:00 2001 From: Lokesh Gidra Date: Fri, 28 Jan 2022 12:30:31 -0800 Subject: Update native gc-roots separately in compaction pause The concurrent compaction algorithm requires all GC roots to be updated to post-compact addresses before resuming mutators for concurrent compaction. Therefore, unlike CC, we cannot update native roots in classes/dex-caches/class-loaders while visiting references (VisitReferences) on heap objects. This CL separates the two and updates all the gc-roots in the compaction pause. Bug: 160737021 Test: art/test/testrunner/testrunner.py Change-Id: I8a57472ba49b9dc30bc0f41a7db3f5efa7eafd9a --- runtime/mirror/class_ext.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'runtime/mirror/class_ext.h') diff --git a/runtime/mirror/class_ext.h b/runtime/mirror/class_ext.h index b805ea0582..b025eb21af 100644 --- a/runtime/mirror/class_ext.h +++ b/runtime/mirror/class_ext.h @@ -27,6 +27,7 @@ namespace art { struct ClassExtOffsets; +class DexCacheVisitor; namespace mirror { @@ -46,6 +47,8 @@ class MANAGED ClassExt : public Object { ObjPtr GetErroneousStateError() REQUIRES_SHARED(Locks::mutator_lock_); + template ObjPtr> GetObsoleteDexCaches() REQUIRES_SHARED(Locks::mutator_lock_); template h_this, Thread* self, uint32_t increase) REQUIRES_SHARED(Locks::mutator_lock_); - template + template inline void VisitNativeRoots(Visitor& visitor, PointerSize pointer_size) REQUIRES_SHARED(Locks::mutator_lock_); + // NO_THREAD_SAFETY_ANALYSIS for dex_lock and heap_bitmap_lock_ as both are at + // higher lock-level than class-table's lock, which is already acquired and + // is at lower (kClassLoaderClassesLock) level. + template + inline void VisitDexCaches(DexCacheVisitor& visitor) + NO_THREAD_SAFETY_ANALYSIS + REQUIRES_SHARED(Locks::mutator_lock_); + template inline void VisitMethods(Visitor visitor, PointerSize pointer_size) REQUIRES_SHARED(Locks::mutator_lock_); -- cgit v1.2.3-59-g8ed1b