Fix stale root error in verifier

There was a stale root error caused by the static roots from
the reg types. These were visitied if there was an active verifier
in the method_verifiers_ but this is not always the case when a GC
is run. The fix is to always visit the static method verifier roots.

This only showed up as a bug without an image since these roots
were primitive classes and always in the image, and therefore
didn't ever need to be updated due to moving GC.

(cherry picked from commit 6167864e28e4e12658ebdbaf1d5239acdaf4aaa4)

Change-Id: I592f2770570de97b431671cfbd409f63697892f1
diff --git a/runtime/verifier/reg_type_cache.cc b/runtime/verifier/reg_type_cache.cc
index 121fccb..bffec4b 100644
--- a/runtime/verifier/reg_type_cache.cc
+++ b/runtime/verifier/reg_type_cache.cc
@@ -555,6 +555,28 @@
   }
 }
 
+void RegTypeCache::VisitStaticRoots(RootCallback* callback, void* arg) {
+  // Visit the primitive types, this is required since if there are no active verifiers they wont
+  // be in the entries array, and therefore not visited as roots.
+  if (primitive_initialized_) {
+    UndefinedType::GetInstance()->VisitRoots(callback, arg);
+    ConflictType::GetInstance()->VisitRoots(callback, arg);
+    BooleanType::GetInstance()->VisitRoots(callback, arg);
+    ByteType::GetInstance()->VisitRoots(callback, arg);
+    ShortType::GetInstance()->VisitRoots(callback, arg);
+    CharType::GetInstance()->VisitRoots(callback, arg);
+    IntegerType::GetInstance()->VisitRoots(callback, arg);
+    LongLoType::GetInstance()->VisitRoots(callback, arg);
+    LongHiType::GetInstance()->VisitRoots(callback, arg);
+    FloatType::GetInstance()->VisitRoots(callback, arg);
+    DoubleLoType::GetInstance()->VisitRoots(callback, arg);
+    DoubleHiType::GetInstance()->VisitRoots(callback, arg);
+    for (int32_t value = kMinSmallConstant; value <= kMaxSmallConstant; ++value) {
+      small_precise_constants_[value - kMinSmallConstant]->VisitRoots(callback, arg);
+    }
+  }
+}
+
 void RegTypeCache::VisitRoots(RootCallback* callback, void* arg) {
   for (const RegType* entry : entries_) {
     entry->VisitRoots(callback, arg);