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_table.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_table.h')
-rw-r--r-- | runtime/class_table.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/class_table.h b/runtime/class_table.h index 212a7d6631..123c069f0e 100644 --- a/runtime/class_table.h +++ b/runtime/class_table.h @@ -85,6 +85,9 @@ class ClassTable { template<typename Visitor> void VisitRoot(const Visitor& visitor) const NO_THREAD_SAFETY_ANALYSIS; + template<typename Visitor> + class ClassAndRootVisitor; + private: // Extract a raw pointer from an address. static ObjPtr<mirror::Class> ExtractPtr(uint32_t data) @@ -185,6 +188,12 @@ class ClassTable { REQUIRES(!lock_) REQUIRES_SHARED(Locks::mutator_lock_); + template<class Visitor> + void VisitClassesAndRoots(Visitor& visitor) + NO_THREAD_SAFETY_ANALYSIS + REQUIRES(!lock_) + REQUIRES_SHARED(Locks::mutator_lock_); + // Stops visit if the visitor returns false. template <ReadBarrierOption kReadBarrierOption = kWithReadBarrier, typename Visitor> bool Visit(Visitor& visitor) |