diff options
author | Mathieu Chartier <mathieuc@google.com> | 2013-09-12 17:33:56 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2013-09-13 10:30:24 -0700 |
commit | 423d2a3dcbb260b020efb5da59f784c9f02accbf (patch) | |
tree | 79ed739e6072f8308c1cd880f9420a1c63539c95 /runtime/thread_list.cc | |
parent | b048dd2b662c19644361f4396a1e8d6213445ee8 (diff) | |
download | art-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.cc | 16 |
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); } } |