diff options
Diffstat (limited to 'runtime/runtime.cc')
-rw-r--r-- | runtime/runtime.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 9c3b9de70c..97db5fb0fd 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -859,7 +859,11 @@ void Runtime::CallExitHook(jint status) { } void Runtime::SweepSystemWeaks(IsMarkedVisitor* visitor) { - GetInternTable()->SweepInternTableWeaks(visitor); + // Userfaultfd compaction updates weak intern-table page-by-page via + // LinearAlloc. + if (!GetHeap()->IsPerformingUffdCompaction()) { + GetInternTable()->SweepInternTableWeaks(visitor); + } GetMonitorList()->SweepMonitorList(visitor); GetJavaVM()->SweepJniWeakGlobals(visitor); GetHeap()->SweepAllocationRecords(visitor); @@ -2590,8 +2594,14 @@ void Runtime::VisitConstantRoots(RootVisitor* visitor) { } void Runtime::VisitConcurrentRoots(RootVisitor* visitor, VisitRootFlags flags) { - intern_table_->VisitRoots(visitor, flags); - class_linker_->VisitRoots(visitor, flags); + // Userfaultfd compaction updates intern-tables and class-tables page-by-page + // via LinearAlloc. So don't visit them here. + if (GetHeap()->IsPerformingUffdCompaction()) { + class_linker_->VisitRoots(visitor, flags, /*visit_class_roots=*/false); + } else { + intern_table_->VisitRoots(visitor, flags); + class_linker_->VisitRoots(visitor, flags, /*visit_class_roots=*/true); + } jni_id_manager_->VisitRoots(visitor); heap_->VisitAllocationRecords(visitor); if (jit_ != nullptr) { |