Address some review comments
Addressed comments in dex cache and class table. Added class table
test.
Test: mm test-art-host-gtest-class_table_test -j20
Change-Id: I3ec0282247187acb1ec7af25b309501f001a1c3e
diff --git a/runtime/class_table-inl.h b/runtime/class_table-inl.h
index 229cd47..dfe8949 100644
--- a/runtime/class_table-inl.h
+++ b/runtime/class_table-inl.h
@@ -71,6 +71,19 @@
return true;
}
+template <typename Visitor>
+bool ClassTable::Visit(const Visitor& visitor) {
+ ReaderMutexLock mu(Thread::Current(), lock_);
+ for (ClassSet& class_set : classes_) {
+ for (TableSlot& table_slot : class_set) {
+ if (!visitor(table_slot.Read())) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
template<ReadBarrierOption kReadBarrierOption>
inline mirror::Class* ClassTable::TableSlot::Read() const {
const uint32_t before = data_.LoadRelaxed();