Merge "Throw if ResolveMethod fails." into dalvik-dev
diff --git a/src/thread.cc b/src/thread.cc
index dc08799..91a9415 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -1192,6 +1192,15 @@
   return false;
 }
 
+void Thread::SirtVisitRoots(Heap::RootVisitor* visitor, void* arg) {
+  for (StackIndirectReferenceTable* cur = top_sirt_; cur; cur = cur->Link()) {
+    size_t num_refs = cur->NumberOfReferences();
+    for (size_t j = 0; j < num_refs; j++) {
+      visitor(cur->References()[j], arg);
+    }
+  }
+}
+
 void Thread::PopSirt() {
   CHECK(top_sirt_ != NULL);
   top_sirt_ = top_sirt_->Link();
@@ -1671,6 +1680,9 @@
   }
   jni_env_->locals.VisitRoots(visitor, arg);
   jni_env_->monitors.VisitRoots(visitor, arg);
+
+  SirtVisitRoots(visitor, arg);
+
   // Cheat and steal the long jump context. Assume that we are not doing a GC during exception
   // delivery.
   Context* context = GetLongJumpContext();
diff --git a/src/thread.h b/src/thread.h
index db5bbe8..3a8abba 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -392,6 +392,8 @@
   // Is the given obj in this thread's stack indirect reference table?
   bool SirtContains(jobject obj);
 
+  void SirtVisitRoots(Heap::RootVisitor* visitor, void* arg);
+
   // Pop the top SIRT
   void PopSirt();