From 1d556df25837ed6e14a9cc630e0f6967056a8c51 Mon Sep 17 00:00:00 2001 From: Lokesh Gidra Date: Tue, 17 Oct 2023 21:38:44 +0000 Subject: Revert^2 "Update class-table and intern-table concurrently with uffd GC" This reverts commit 9faffd5c4e062ca45bd6f29a3b6d1b276e6c9839. Reason for revert: Reland after fixing null-pointer dereference Bug: 160737021 Test: art/testrunner/testrunner.py Change-Id: I80d3eda827ea805efc5a0e0eb0b80a9d8ceb9dd5 --- runtime/class_table-inl.h | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'runtime/class_table-inl.h') diff --git a/runtime/class_table-inl.h b/runtime/class_table-inl.h index ecc8a0a620..4ee59a79f7 100644 --- a/runtime/class_table-inl.h +++ b/runtime/class_table-inl.h @@ -68,12 +68,14 @@ inline bool ClassTable::ClassDescriptorEquals::operator()(const TableSlot& a, return a.Read()->DescriptorEquals(b.first); } -template -void ClassTable::VisitRoots(Visitor& visitor) { +template +void ClassTable::VisitRoots(Visitor& visitor, bool skip_classes) { ReaderMutexLock mu(Thread::Current(), lock_); - for (ClassSet& class_set : classes_) { - for (TableSlot& table_slot : class_set) { - table_slot.VisitRoot(visitor); + if (!skip_classes) { + for (ClassSet& class_set : classes_) { + for (TableSlot& table_slot : class_set) { + table_slot.VisitRoot(visitor); + } } } for (GcRoot& root : strong_roots_) { @@ -86,12 +88,14 @@ void ClassTable::VisitRoots(Visitor& visitor) { } } -template -void ClassTable::VisitRoots(const Visitor& visitor) { +template +void ClassTable::VisitRoots(const Visitor& visitor, bool skip_classes) { ReaderMutexLock mu(Thread::Current(), lock_); - for (ClassSet& class_set : classes_) { - for (TableSlot& table_slot : class_set) { - table_slot.VisitRoot(visitor); + if (!skip_classes) { + for (ClassSet& class_set : classes_) { + for (TableSlot& table_slot : class_set) { + table_slot.VisitRoot(visitor); + } } } for (GcRoot& root : strong_roots_) { @@ -104,6 +108,18 @@ void ClassTable::VisitRoots(const Visitor& visitor) { } } +template +void ClassTable::VisitClassesIfConditionMet(Condition& cond, Visitor& visitor) { + ReaderMutexLock mu(Thread::Current(), lock_); + for (ClassSet& class_set : classes_) { + if (cond(class_set)) { + for (TableSlot& table_slot : class_set) { + table_slot.VisitRoot(visitor); + } + } + } +} + template class ClassTable::TableSlot::ClassAndRootVisitor { public: -- cgit v1.2.3-59-g8ed1b