Move most of class linker to ObjPtr

Return values are still mirror pointer. Fix some failing asserts in
compiler driver and tests.

Bug: 31113334

Test: test-art-host

Change-Id: I4450bf9dfb2541749496b8388616e8aae8488919
diff --git a/runtime/obj_ptr.h b/runtime/obj_ptr.h
index 75a6f9f..9318232 100644
--- a/runtime/obj_ptr.h
+++ b/runtime/obj_ptr.h
@@ -154,6 +154,15 @@
   uintptr_t reference_;
 };
 
+// Hash function for stl data structures.
+class HashObjPtr {
+ public:
+  template<class MirrorType, bool kPoison>
+  size_t operator()(const ObjPtr<MirrorType, kPoison>& ptr) const NO_THREAD_SAFETY_ANALYSIS {
+    return std::hash<MirrorType*>()(ptr.Ptr());
+  }
+};
+
 template<class MirrorType, bool kPoison, typename PointerType>
 ALWAYS_INLINE bool operator==(const PointerType* a, const ObjPtr<MirrorType, kPoison>& b)
     REQUIRES_SHARED(Locks::mutator_lock_) {