Refactor ClassRoot/GetClassRoot().

Move it outside the ClassLinker, into its own header file,
and add retrieval based on a mirror class template argument.
Keep the SetClassRoot() as a private member of ClassLinker.

Make the new GetClassRoot()s return ObjPtr<>.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 31113334
Change-Id: Icbc6b62b41f6ffd65b437297a21eadbb0454e2b7
diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc
index 3b64874..7bd5a6a 100644
--- a/runtime/hprof/hprof.cc
+++ b/runtime/hprof/hprof.cc
@@ -50,6 +50,7 @@
 #include "base/time_utils.h"
 #include "base/unix_file/fd_file.h"
 #include "class_linker.h"
+#include "class_root.h"
 #include "common_throws.h"
 #include "debugger.h"
 #include "dex/dex_file-inl.h"
@@ -1418,8 +1419,7 @@
   __ AddObjectId(obj);
   __ AddStackTraceSerialNumber(LookupStackTraceSerialNumber(obj));
   __ AddU4(elements.size());
-  __ AddClassId(LookupClassId(
-      Runtime::Current()->GetClassLinker()->GetClassRoot(ClassLinker::kObjectArrayClass)));
+  __ AddClassId(LookupClassId(GetClassRoot<mirror::ObjectArray<mirror::Object>>().Ptr()));
   for (mirror::Object* e : elements) {
     __ AddObjectId(e);
   }