diff options
author | 2022-01-28 12:30:31 -0800 | |
---|---|---|
committer | 2022-08-10 18:06:05 +0000 | |
commit | b7607c2fd67e12e998aebd71db38414ffc65621b (patch) | |
tree | 0b816edc36dc3a696c366e1e5922018accbde5b7 /runtime/class_linker.h | |
parent | 5d73d6b3e4de8e7a1cb1aa6c8683a6afac7725be (diff) |
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
Diffstat (limited to 'runtime/class_linker.h')
-rw-r--r-- | runtime/class_linker.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/runtime/class_linker.h b/runtime/class_linker.h index 895d820c7b..1ac47562b2 100644 --- a/runtime/class_linker.h +++ b/runtime/class_linker.h @@ -128,6 +128,13 @@ class ClassLoaderVisitor { REQUIRES_SHARED(Locks::classlinker_classes_lock_, Locks::mutator_lock_) = 0; }; +class DexCacheVisitor { + public: + virtual ~DexCacheVisitor() {} + virtual void Visit(ObjPtr<mirror::DexCache> dex_cache) + REQUIRES_SHARED(Locks::dex_lock_, Locks::mutator_lock_) = 0; +}; + template <typename Func> class ClassLoaderFuncVisitor final : public ClassLoaderVisitor { public: @@ -479,6 +486,11 @@ class ClassLinker { REQUIRES(!Locks::classlinker_classes_lock_) REQUIRES_SHARED(Locks::mutator_lock_); + // Visits only the classes in the boot class path. + template <typename Visitor> + inline void VisitBootClasses(Visitor* visitor) + REQUIRES_SHARED(Locks::classlinker_classes_lock_) + REQUIRES_SHARED(Locks::mutator_lock_); // Less efficient variant of VisitClasses that copies the class_table_ into secondary storage // so that it can visit individual classes without holding the doesn't hold the // Locks::classlinker_classes_lock_. As the Locks::classlinker_classes_lock_ isn't held this code @@ -780,6 +792,10 @@ class ClassLinker { void VisitClassLoaders(ClassLoaderVisitor* visitor) const REQUIRES_SHARED(Locks::classlinker_classes_lock_, Locks::mutator_lock_); + // Visit all of the dex caches in the class linker. + void VisitDexCaches(DexCacheVisitor* visitor) const + REQUIRES_SHARED(Locks::dex_lock_, Locks::mutator_lock_); + // Checks that a class and its superclass from another class loader have the same virtual methods. bool ValidateSuperClassDescriptors(Handle<mirror::Class> klass) REQUIRES_SHARED(Locks::mutator_lock_); |