Mark more roots.
This is most of the stuff. (Everything that currently exists, though there's
more to come.)
Change-Id: I235a21b006820a027c494374a5b52ffefed89c32
diff --git a/src/thread.cc b/src/thread.cc
index 89ec844..5a612dd 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -522,6 +522,15 @@
}
}
+void Thread::VisitRoots(Heap::RootVisitor* visitor, void* arg) const {
+ //(*visitor)(&thread->threadObj, threadId, ROOT_THREAD_OBJECT, arg);
+ //(*visitor)(&thread->exception, threadId, ROOT_NATIVE_STACK, arg);
+ jni_env_->locals.VisitRoots(visitor, arg);
+ jni_env_->monitors.VisitRoots(visitor, arg);
+ // visitThreadStack(visitor, thread, arg);
+ UNIMPLEMENTED(WARNING) << "some per-Thread roots not visited";
+}
+
static const char* kStateNames[] = {
"New",
"Runnable",
@@ -588,4 +597,12 @@
list_.remove(thread);
}
+void ThreadList::VisitRoots(Heap::RootVisitor* visitor, void* arg) const {
+ MutexLock mu(lock_);
+ typedef std::list<Thread*>::const_iterator It; // TODO: C++0x auto
+ for (It it = list_.begin(), end = list_.end(); it != end; ++it) {
+ (*it)->VisitRoots(visitor, arg);
+ }
+}
+
} // namespace