summaryrefslogtreecommitdiffstats
path: root/runtime/thread_list.cc
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2013-09-12 17:33:56 -0700
committerMathieu Chartier <mathieuc@google.com>2013-09-13 10:30:24 -0700
commit423d2a3dcbb260b020efb5da59f784c9f02accbf (patch)
tree79ed739e6072f8308c1cd880f9420a1c63539c95 /runtime/thread_list.cc
parentb048dd2b662c19644361f4396a1e8d6213445ee8 (diff)
downloadart-423d2a3dcbb260b020efb5da59f784c9f02accbf.zip
art-423d2a3dcbb260b020efb5da59f784c9f02accbf.tar.gz
art-423d2a3dcbb260b020efb5da59f784c9f02accbf.tar.bz2
Add support for changing roots through the root visitor callback.
Needed for copying collectors. Change-Id: Icc4a342a57e0cfb79587edb02ef8c85e08808877
Diffstat (limited to 'runtime/thread_list.cc')
-rw-r--r--runtime/thread_list.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index aba81fe..44cf810 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -569,10 +569,24 @@ void ThreadList::VisitRoots(RootVisitor* visitor, void* arg) const {
}
}
+struct VerifyRootWrapperArg {
+ VerifyRootVisitor* visitor;
+ void* arg;
+};
+
+static mirror::Object* VerifyRootWrapperCallback(mirror::Object* root, void* arg) {
+ VerifyRootWrapperArg* wrapperArg = reinterpret_cast<VerifyRootWrapperArg*>(arg);
+ wrapperArg->visitor(root, wrapperArg->arg, 0, NULL);
+ return root;
+}
+
void ThreadList::VerifyRoots(VerifyRootVisitor* visitor, void* arg) const {
+ VerifyRootWrapperArg wrapper;
+ wrapper.visitor = visitor;
+ wrapper.arg = arg;
MutexLock mu(Thread::Current(), *Locks::thread_list_lock_);
for (const auto& thread : list_) {
- thread->VerifyRoots(visitor, arg);
+ thread->VisitRoots(VerifyRootWrapperCallback, &wrapper);
}
}