diff options
author | 2016-12-12 11:06:59 -0800 | |
---|---|---|
committer | 2016-12-13 10:12:07 -0800 | |
commit | db70ce5e788404f36cb5dbb137c6a8f79f34a2a0 (patch) | |
tree | b291c40e1b6c44f3744404f085706f4b07cbb73c /runtime/class_table-inl.h | |
parent | 7d785fca4fd6cf3507aaa807681b3d73ed586c9b (diff) |
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
Diffstat (limited to 'runtime/class_table-inl.h')
-rw-r--r-- | runtime/class_table-inl.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/runtime/class_table-inl.h b/runtime/class_table-inl.h index 229cd477dd..dfe8949134 100644 --- a/runtime/class_table-inl.h +++ b/runtime/class_table-inl.h @@ -71,6 +71,19 @@ bool ClassTable::Visit(Visitor& visitor) { 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(); |