Remove static GcRoot<>s from Class and ClassExt.

And clean up gc_root includes in runtime/mirror/.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 31113334
Change-Id: Ib5c42a3a892ced4440720350a63a94bcf3a1ca75
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index cd03401..e46b980 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -435,7 +435,7 @@
   Handle<mirror::Class> java_lang_Class(hs.NewHandle(down_cast<mirror::Class*>(
       heap->AllocNonMovableObject<true>(self, nullptr, class_class_size, VoidFunctor()))));
   CHECK(java_lang_Class != nullptr);
-  mirror::Class::SetClassClass(java_lang_Class.Get());
+  java_lang_Class->SetClassFlags(mirror::kClassFlagClass);
   java_lang_Class->SetClass(java_lang_Class.Get());
   if (kUseBakerReadBarrier) {
     java_lang_Class->AssertReadBarrierState();
@@ -553,7 +553,6 @@
   Handle<mirror::Class> dalvik_system_ClassExt(hs.NewHandle(
       AllocClass(self, java_lang_Class.Get(), mirror::ClassExt::ClassSize(image_pointer_size_))));
   SetClassRoot(ClassRoot::kDalvikSystemClassExt, dalvik_system_ClassExt.Get());
-  mirror::ClassExt::SetClass(dalvik_system_ClassExt.Get());
   mirror::Class::SetStatus(dalvik_system_ClassExt, ClassStatus::kResolved, self);
 
   // Set up array classes for string, field, method
@@ -991,7 +990,8 @@
   class_roots_ = GcRoot<mirror::ObjectArray<mirror::Class>>(
       down_cast<mirror::ObjectArray<mirror::Class>*>(
           spaces[0]->GetImageHeader().GetImageRoot(ImageHeader::kClassRoots)));
-  mirror::Class::SetClassClass(GetClassRoot(ClassRoot::kJavaLangClass, this));
+  DCHECK_EQ(GetClassRoot(ClassRoot::kJavaLangClass, this)->GetClassFlags(),
+            mirror::kClassFlagClass);
 
   ObjPtr<mirror::Class> java_lang_Object = GetClassRoot<mirror::Object>(this);
   java_lang_Object->SetObjectSize(sizeof(mirror::Object));
@@ -1004,8 +1004,6 @@
   array_iftable_ =
       GcRoot<mirror::IfTable>(GetClassRoot(ClassRoot::kObjectArrayClass, this)->GetIfTable());
   DCHECK_EQ(array_iftable_.Read(), GetClassRoot(ClassRoot::kBooleanArrayClass, this)->GetIfTable());
-  // String class root was set above
-  mirror::ClassExt::SetClass(GetClassRoot(ClassRoot::kDalvikSystemClassExt, this));
 
   for (gc::space::ImageSpace* image_space : spaces) {
     // Boot class loader, use a null handle.
@@ -2082,7 +2080,6 @@
 }
 
 ClassLinker::~ClassLinker() {
-  mirror::Class::ResetClass();
   Thread* const self = Thread::Current();
   for (const ClassLoaderData& data : class_loaders_) {
     // CHA unloading analysis is not needed. No negative consequences are expected because
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index b004566..25ed652 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -3913,9 +3913,9 @@
 }
 
 void Heap::CheckGcStressMode(Thread* self, ObjPtr<mirror::Object>* obj) {
+  DCHECK(gc_stress_mode_);
   auto* const runtime = Runtime::Current();
-  if (gc_stress_mode_ && runtime->GetClassLinker()->IsInitialized() &&
-      !runtime->IsActiveTransaction() && mirror::Class::HasJavaLangClass()) {
+  if (runtime->GetClassLinker()->IsInitialized() && !runtime->IsActiveTransaction()) {
     // Check if we should GC.
     bool new_backtrace = false;
     {
diff --git a/runtime/interpreter/unstarted_runtime_test.cc b/runtime/interpreter/unstarted_runtime_test.cc
index fee8375..449458c 100644
--- a/runtime/interpreter/unstarted_runtime_test.cc
+++ b/runtime/interpreter/unstarted_runtime_test.cc
@@ -448,8 +448,7 @@
   // Note: all tests are not GC safe. Assume there's no GC running here with the few objects we
   //       allocate.
   StackHandleScope<3> hs_misc(self);
-  Handle<mirror::Class> object_class(
-      hs_misc.NewHandle(mirror::Class::GetJavaLangClass()->GetSuperClass()));
+  Handle<mirror::Class> object_class(hs_misc.NewHandle(GetClassRoot<mirror::Object>()));
 
   StackHandleScope<3> hs_data(self);
   hs_data.NewHandle(mirror::String::AllocFromModifiedUtf8(self, "1"));
@@ -481,8 +480,7 @@
   ShadowFrame* tmp = ShadowFrame::CreateDeoptimizedFrame(10, nullptr, nullptr, 0);
 
   StackHandleScope<1> hs_object(self);
-  Handle<mirror::Class> object_class(
-      hs_object.NewHandle(mirror::Class::GetJavaLangClass()->GetSuperClass()));
+  Handle<mirror::Class> object_class(hs_object.NewHandle(GetClassRoot<mirror::Object>()));
 
   // Simple test:
   // [1,2,3]{1 @ 2} into [4,5,6] = [4,2,6]
@@ -902,7 +900,7 @@
   JValue result;
   ShadowFrame* shadow_frame = ShadowFrame::CreateDeoptimizedFrame(10, nullptr, nullptr, 0);
 
-  ObjPtr<mirror::Class> class_klass = mirror::Class::GetJavaLangClass();
+  ObjPtr<mirror::Class> class_klass = GetClassRoot<mirror::Class>();
   shadow_frame->SetVRegReference(0, class_klass);
   UnstartedClassIsAnonymousClass(self, shadow_frame, &result, 0);
   EXPECT_EQ(result.GetZ(), 0);
@@ -996,7 +994,7 @@
 
   {
     // Just use a method in Class.
-    ObjPtr<mirror::Class> class_class = mirror::Class::GetJavaLangClass();
+    ObjPtr<mirror::Class> class_class = GetClassRoot<mirror::Class>();
     ArtMethod* caller_method =
         &*class_class->GetDeclaredMethods(class_linker->GetImagePointerSize()).begin();
     ShadowFrame* caller_frame = ShadowFrame::CreateDeoptimizedFrame(10, nullptr, caller_method, 0);
@@ -1111,7 +1109,7 @@
     {
       ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
       StackHandleScope<1> hs(self);
-      Handle<mirror::Class> h_class = hs.NewHandle(mirror::Class::GetJavaLangClass());
+      Handle<mirror::Class> h_class = hs.NewHandle(GetClassRoot<mirror::Class>());
       CHECK(class_linker->EnsureInitialized(self, h_class, true, true));
     }
 
diff --git a/runtime/mirror/call_site.cc b/runtime/mirror/call_site.cc
index 808f77c..738106c 100644
--- a/runtime/mirror/call_site.cc
+++ b/runtime/mirror/call_site.cc
@@ -18,18 +18,17 @@
 
 #include "class-inl.h"
 #include "class_root.h"
-#include "gc_root-inl.h"
+#include "obj_ptr-inl.h"
 
 namespace art {
 namespace mirror {
 
 mirror::CallSite* CallSite::Create(Thread* const self, Handle<MethodHandle> target) {
-  StackHandleScope<1> hs(self);
-  Handle<mirror::CallSite> cs(
-      hs.NewHandle(ObjPtr<CallSite>::DownCast(GetClassRoot<CallSite>()->AllocObject(self))));
+  ObjPtr<mirror::CallSite> cs =
+      ObjPtr<CallSite>::DownCast(GetClassRoot<CallSite>()->AllocObject(self));
   CHECK(!Runtime::Current()->IsActiveTransaction());
   cs->SetFieldObject<false>(TargetOffset(), target.Get());
-  return cs.Get();
+  return cs.Ptr();
 }
 
 }  // namespace mirror
diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc
index cb2708d..996461b 100644
--- a/runtime/mirror/class.cc
+++ b/runtime/mirror/class.cc
@@ -55,26 +55,6 @@
 
 using android::base::StringPrintf;
 
-GcRoot<Class> Class::java_lang_Class_;
-
-void Class::SetClassClass(ObjPtr<Class> java_lang_Class) {
-  CHECK(java_lang_Class_.IsNull())
-      << java_lang_Class_.Read()
-      << " " << java_lang_Class;
-  CHECK(java_lang_Class != nullptr);
-  java_lang_Class->SetClassFlags(kClassFlagClass);
-  java_lang_Class_ = GcRoot<Class>(java_lang_Class);
-}
-
-void Class::ResetClass() {
-  CHECK(!java_lang_Class_.IsNull());
-  java_lang_Class_ = GcRoot<Class>(nullptr);
-}
-
-void Class::VisitRoots(RootVisitor* visitor) {
-  java_lang_Class_.VisitRootIfNonNull(visitor, RootInfo(kRootStickyClass));
-}
-
 ObjPtr<mirror::Class> Class::GetPrimitiveClass(ObjPtr<mirror::String> name) {
   const char* expected_name = nullptr;
   ClassRoot class_root = ClassRoot::kJavaLangObject;  // Invalid.
@@ -1211,13 +1191,15 @@
   // We may get copied by a compacting GC.
   StackHandleScope<1> hs(self);
   Handle<Class> h_this(hs.NewHandle(this));
-  gc::Heap* heap = Runtime::Current()->GetHeap();
+  Runtime* runtime = Runtime::Current();
+  gc::Heap* heap = runtime->GetHeap();
   // The num_bytes (3rd param) is sizeof(Class) as opposed to SizeOf()
   // to skip copying the tail part that we will overwrite here.
   CopyClassVisitor visitor(self, &h_this, new_length, sizeof(Class), imt, pointer_size);
+  ObjPtr<mirror::Class> java_lang_Class = GetClassRoot<mirror::Class>(runtime->GetClassLinker());
   ObjPtr<Object> new_class = kMovingClasses ?
-      heap->AllocObject<true>(self, java_lang_Class_.Read(), new_length, visitor) :
-      heap->AllocNonMovableObject<true>(self, java_lang_Class_.Read(), new_length, visitor);
+      heap->AllocObject<true>(self, java_lang_Class, new_length, visitor) :
+      heap->AllocNonMovableObject<true>(self, java_lang_Class, new_length, visitor);
   if (UNLIKELY(new_class == nullptr)) {
     self->AssertPendingOOMException();
     return nullptr;
diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h
index 7d5f539..a637c86 100644
--- a/runtime/mirror/class.h
+++ b/runtime/mirror/class.h
@@ -30,7 +30,6 @@
 #include "dex/modifiers.h"
 #include "dex/primitive.h"
 #include "gc/allocator_type.h"
-#include "gc_root.h"
 #include "imtable.h"
 #include "object.h"
 #include "object_array.h"
@@ -1130,21 +1129,6 @@
   dex::TypeIndex FindTypeIndexInOtherDexFile(const DexFile& dex_file)
       REQUIRES_SHARED(Locks::mutator_lock_);
 
-  static Class* GetJavaLangClass() REQUIRES_SHARED(Locks::mutator_lock_) {
-    DCHECK(HasJavaLangClass());
-    return java_lang_Class_.Read();
-  }
-
-  static bool HasJavaLangClass() REQUIRES_SHARED(Locks::mutator_lock_) {
-    return !java_lang_Class_.IsNull();
-  }
-
-  // Can't call this SetClass or else gets called instead of Object::SetClass in places.
-  static void SetClassClass(ObjPtr<Class> java_lang_Class) REQUIRES_SHARED(Locks::mutator_lock_);
-  static void ResetClass();
-  static void VisitRoots(RootVisitor* visitor)
-      REQUIRES_SHARED(Locks::mutator_lock_);
-
   // Visit native roots visits roots which are keyed off the native pointers such as ArtFields and
   // ArtMethods.
   template<ReadBarrierOption kReadBarrierOption = kWithReadBarrier, class Visitor>
@@ -1504,9 +1488,6 @@
   // Static fields, variable size.
   // uint32_t fields_[0];
 
-  // java.lang.Class
-  static GcRoot<Class> java_lang_Class_;
-
   ART_FRIEND_TEST(DexCacheTest, TestResolvedFieldAccess);  // For ResolvedFieldAccessTest
   friend struct art::ClassOffsets;  // for verifying offset information
   friend class Object;  // For VisitReferences
diff --git a/runtime/mirror/class_ext.cc b/runtime/mirror/class_ext.cc
index 0819579..7214620 100644
--- a/runtime/mirror/class_ext.cc
+++ b/runtime/mirror/class_ext.cc
@@ -21,6 +21,7 @@
 #include "base/enums.h"
 #include "base/utils.h"
 #include "class-inl.h"
+#include "class_root.h"
 #include "dex/dex_file-inl.h"
 #include "gc/accounting/card_table-inl.h"
 #include "object-inl.h"
@@ -31,8 +32,6 @@
 namespace art {
 namespace mirror {
 
-GcRoot<Class> ClassExt::dalvik_system_ClassExt_;
-
 uint32_t ClassExt::ClassSize(PointerSize pointer_size) {
   uint32_t vtable_entries = Object::kVTableLength;
   return Class::ComputeClassSize(true, vtable_entries, 0, 0, 0, 0, 0, pointer_size);
@@ -102,8 +101,7 @@
 }
 
 ClassExt* ClassExt::Alloc(Thread* self) {
-  DCHECK(dalvik_system_ClassExt_.Read() != nullptr);
-  return down_cast<ClassExt*>(dalvik_system_ClassExt_.Read()->AllocObject(self).Ptr());
+  return down_cast<ClassExt*>(GetClassRoot<ClassExt>()->AllocObject(self).Ptr());
 }
 
 void ClassExt::SetVerifyError(ObjPtr<Object> err) {
@@ -119,19 +117,5 @@
   SetFieldObject<false>(OFFSET_OF_OBJECT_MEMBER(ClassExt, original_dex_file_), bytes);
 }
 
-void ClassExt::SetClass(ObjPtr<Class> dalvik_system_ClassExt) {
-  CHECK(dalvik_system_ClassExt != nullptr);
-  dalvik_system_ClassExt_ = GcRoot<Class>(dalvik_system_ClassExt);
-}
-
-void ClassExt::ResetClass() {
-  CHECK(!dalvik_system_ClassExt_.IsNull());
-  dalvik_system_ClassExt_ = GcRoot<Class>(nullptr);
-}
-
-void ClassExt::VisitRoots(RootVisitor* visitor) {
-  dalvik_system_ClassExt_.VisitRootIfNonNull(visitor, RootInfo(kRootStickyClass));
-}
-
 }  // namespace mirror
 }  // namespace art
diff --git a/runtime/mirror/class_ext.h b/runtime/mirror/class_ext.h
index 75a3800..612fd0f 100644
--- a/runtime/mirror/class_ext.h
+++ b/runtime/mirror/class_ext.h
@@ -20,7 +20,6 @@
 #include "array.h"
 #include "class.h"
 #include "dex_cache.h"
-#include "gc_root.h"
 #include "object.h"
 #include "object_array.h"
 #include "string.h"
@@ -72,10 +71,6 @@
   bool ExtendObsoleteArrays(Thread* self, uint32_t increase)
       REQUIRES_SHARED(Locks::mutator_lock_);
 
-  static void SetClass(ObjPtr<Class> dalvik_system_ClassExt);
-  static void ResetClass();
-  static void VisitRoots(RootVisitor* visitor) REQUIRES_SHARED(Locks::mutator_lock_);
-
   template<ReadBarrierOption kReadBarrierOption = kWithReadBarrier, class Visitor>
   inline void VisitNativeRoots(Visitor& visitor, PointerSize pointer_size)
       REQUIRES_SHARED(Locks::mutator_lock_);
@@ -93,8 +88,6 @@
   // The saved verification error of this class.
   HeapReference<Object> verify_error_;
 
-  static GcRoot<Class> dalvik_system_ClassExt_;
-
   friend struct art::ClassExtOffsets;  // for verifying offset information
   DISALLOW_IMPLICIT_CONSTRUCTORS(ClassExt);
 };
diff --git a/runtime/mirror/dex_cache-inl.h b/runtime/mirror/dex_cache-inl.h
index 72f1443..96778aa 100644
--- a/runtime/mirror/dex_cache-inl.h
+++ b/runtime/mirror/dex_cache-inl.h
@@ -28,7 +28,7 @@
 #include "class_linker.h"
 #include "dex/dex_file.h"
 #include "gc/heap-inl.h"
-#include "gc_root.h"
+#include "gc_root-inl.h"
 #include "mirror/call_site.h"
 #include "mirror/class.h"
 #include "mirror/method_type.h"
diff --git a/runtime/mirror/emulated_stack_frame.cc b/runtime/mirror/emulated_stack_frame.cc
index 5595102..ce39049 100644
--- a/runtime/mirror/emulated_stack_frame.cc
+++ b/runtime/mirror/emulated_stack_frame.cc
@@ -18,7 +18,6 @@
 
 #include "class-inl.h"
 #include "class_root.h"
-#include "gc_root-inl.h"
 #include "jvalue-inl.h"
 #include "method_handles-inl.h"
 #include "method_handles.h"
diff --git a/runtime/mirror/executable.h b/runtime/mirror/executable.h
index 8a28f66..23dd787 100644
--- a/runtime/mirror/executable.h
+++ b/runtime/mirror/executable.h
@@ -18,7 +18,6 @@
 #define ART_RUNTIME_MIRROR_EXECUTABLE_H_
 
 #include "accessible_object.h"
-#include "gc_root.h"
 #include "object.h"
 #include "read_barrier_option.h"
 
diff --git a/runtime/mirror/method.cc b/runtime/mirror/method.cc
index e5d3403..cf03b95 100644
--- a/runtime/mirror/method.cc
+++ b/runtime/mirror/method.cc
@@ -18,7 +18,6 @@
 
 #include "art_method.h"
 #include "class_root.h"
-#include "gc_root-inl.h"
 #include "mirror/class-inl.h"
 #include "mirror/object-inl.h"
 
diff --git a/runtime/mirror/method_handle_impl.cc b/runtime/mirror/method_handle_impl.cc
index a6c1609..88ccbc9 100644
--- a/runtime/mirror/method_handle_impl.cc
+++ b/runtime/mirror/method_handle_impl.cc
@@ -18,7 +18,6 @@
 
 #include "class-inl.h"
 #include "class_root.h"
-#include "gc_root-inl.h"
 
 namespace art {
 namespace mirror {
diff --git a/runtime/mirror/method_handles_lookup.cc b/runtime/mirror/method_handles_lookup.cc
index 1ac38da..d1e7a6d 100644
--- a/runtime/mirror/method_handles_lookup.cc
+++ b/runtime/mirror/method_handles_lookup.cc
@@ -19,7 +19,6 @@
 #include "class-inl.h"
 #include "class_root.h"
 #include "dex/modifiers.h"
-#include "gc_root-inl.h"
 #include "handle_scope.h"
 #include "jni/jni_internal.h"
 #include "mirror/method_handle_impl.h"
diff --git a/runtime/mirror/method_handles_lookup.h b/runtime/mirror/method_handles_lookup.h
index aa94f95..56261ec 100644
--- a/runtime/mirror/method_handles_lookup.h
+++ b/runtime/mirror/method_handles_lookup.h
@@ -18,7 +18,6 @@
 #define ART_RUNTIME_MIRROR_METHOD_HANDLES_LOOKUP_H_
 
 #include "base/utils.h"
-#include "gc_root.h"
 #include "handle.h"
 #include "obj_ptr.h"
 #include "object.h"
diff --git a/runtime/mirror/method_type.cc b/runtime/mirror/method_type.cc
index 483fff5..bc62ebd 100644
--- a/runtime/mirror/method_type.cc
+++ b/runtime/mirror/method_type.cc
@@ -18,7 +18,6 @@
 
 #include "class-inl.h"
 #include "class_root.h"
-#include "gc_root-inl.h"
 #include "method_handles.h"
 
 namespace art {
diff --git a/runtime/mirror/reference-inl.h b/runtime/mirror/reference-inl.h
index c65f740..f8de6e6 100644
--- a/runtime/mirror/reference-inl.h
+++ b/runtime/mirror/reference-inl.h
@@ -19,7 +19,6 @@
 
 #include "reference.h"
 
-#include "gc_root-inl.h"
 #include "obj_ptr-inl.h"
 #include "runtime.h"
 
diff --git a/runtime/mirror/stack_trace_element.cc b/runtime/mirror/stack_trace_element.cc
index ff353d8..5a7575a 100644
--- a/runtime/mirror/stack_trace_element.cc
+++ b/runtime/mirror/stack_trace_element.cc
@@ -20,7 +20,6 @@
 #include "class.h"
 #include "class_root.h"
 #include "gc/accounting/card_table-inl.h"
-#include "gc_root-inl.h"
 #include "handle_scope-inl.h"
 #include "object-inl.h"
 #include "string.h"
diff --git a/runtime/mirror/stack_trace_element.h b/runtime/mirror/stack_trace_element.h
index f25211c..55a2ef0 100644
--- a/runtime/mirror/stack_trace_element.h
+++ b/runtime/mirror/stack_trace_element.h
@@ -17,7 +17,6 @@
 #ifndef ART_RUNTIME_MIRROR_STACK_TRACE_ELEMENT_H_
 #define ART_RUNTIME_MIRROR_STACK_TRACE_ELEMENT_H_
 
-#include "gc_root.h"
 #include "object.h"
 
 namespace art {
diff --git a/runtime/mirror/string.cc b/runtime/mirror/string.cc
index b76ca19..d5ef039 100644
--- a/runtime/mirror/string.cc
+++ b/runtime/mirror/string.cc
@@ -24,7 +24,6 @@
 #include "dex/descriptors_names.h"
 #include "dex/utf-inl.h"
 #include "gc/accounting/card_table-inl.h"
-#include "gc_root-inl.h"
 #include "handle_scope-inl.h"
 #include "intern_table.h"
 #include "object-inl.h"
diff --git a/runtime/mirror/string.h b/runtime/mirror/string.h
index 598175b..0e2fc90 100644
--- a/runtime/mirror/string.h
+++ b/runtime/mirror/string.h
@@ -20,7 +20,6 @@
 #include "base/bit_utils.h"
 #include "base/globals.h"
 #include "gc/allocator_type.h"
-#include "gc_root-inl.h"
 #include "class.h"
 #include "object.h"
 
diff --git a/runtime/mirror/throwable.h b/runtime/mirror/throwable.h
index 42c612f..a9e5d1a 100644
--- a/runtime/mirror/throwable.h
+++ b/runtime/mirror/throwable.h
@@ -17,7 +17,6 @@
 #ifndef ART_RUNTIME_MIRROR_THROWABLE_H_
 #define ART_RUNTIME_MIRROR_THROWABLE_H_
 
-#include "gc_root.h"
 #include "object.h"
 
 namespace art {
diff --git a/runtime/mirror/var_handle.cc b/runtime/mirror/var_handle.cc
index 71f41b9..4319c5d 100644
--- a/runtime/mirror/var_handle.cc
+++ b/runtime/mirror/var_handle.cc
@@ -21,7 +21,6 @@
 #include "class-inl.h"
 #include "class_linker.h"
 #include "class_root.h"
-#include "gc_root-inl.h"
 #include "intrinsics_enum.h"
 #include "jni/jni_internal.h"
 #include "jvalue-inl.h"
diff --git a/runtime/proxy_test.h b/runtime/proxy_test.h
index 860d96c..411dc7a 100644
--- a/runtime/proxy_test.h
+++ b/runtime/proxy_test.h
@@ -40,11 +40,10 @@
                                          const std::vector<Handle<mirror::Class>>& interfaces)
     REQUIRES_SHARED(Locks::mutator_lock_) {
   StackHandleScope<1> hs(soa.Self());
-  Handle<mirror::Class> javaLangObject = hs.NewHandle(
-      class_linker->FindSystemClass(soa.Self(), "Ljava/lang/Object;"));
+  Handle<mirror::Class> javaLangObject = hs.NewHandle(GetClassRoot<mirror::Object>());
   CHECK(javaLangObject != nullptr);
 
-  jclass javaLangClass = soa.AddLocalReference<jclass>(mirror::Class::GetJavaLangClass());
+  jclass javaLangClass = soa.AddLocalReference<jclass>(GetClassRoot<mirror::Class>());
 
   // Builds the interfaces array.
   jobjectArray proxyClassInterfaces =
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 6384d01..0d9d16c 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1976,10 +1976,6 @@
 }
 
 void Runtime::VisitConstantRoots(RootVisitor* visitor) {
-  // Visit the classes held as static in mirror classes, these can be visited concurrently and only
-  // need to be visited once per GC since they never change.
-  mirror::Class::VisitRoots(visitor);
-  mirror::ClassExt::VisitRoots(visitor);
   // Visiting the roots of these ArtMethods is not currently required since all the GcRoots are
   // null.
   BufferedRootVisitor<16> buffered_visitor(visitor, RootInfo(kRootVMInternal));