Add Handle/HandleScope and delete SirtRef.

Delete SirtRef and replaced it with Handle. Handles are value types
which wrap around StackReference*.

Renamed StackIndirectReferenceTable to HandleScope.

Added a scoped handle wrapper which wraps around an Object** and
restores it in its destructor.

Renamed Handle::get -> Get.

Bug: 8473721

Change-Id: Idbfebd4f35af629f0f43931b7c5184b334822c7a
diff --git a/runtime/native/java_lang_reflect_Field.cc b/runtime/native/java_lang_reflect_Field.cc
index ce622d9..0d54772 100644
--- a/runtime/native/java_lang_reflect_Field.cc
+++ b/runtime/native/java_lang_reflect_Field.cc
@@ -94,13 +94,14 @@
     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
   soa.Self()->AssertThreadSuspensionIsAllowable();
   if (f->IsStatic()) {
-    SirtRef<mirror::Class> sirt_klass(soa.Self(), f->GetDeclaringClass());
-    if (UNLIKELY(!Runtime::Current()->GetClassLinker()->EnsureInitialized(sirt_klass, true, true))) {
+    StackHandleScope<1> hs(soa.Self());
+    Handle<mirror::Class> h_klass(hs.NewHandle(f->GetDeclaringClass()));
+    if (UNLIKELY(!Runtime::Current()->GetClassLinker()->EnsureInitialized(h_klass, true, true))) {
       DCHECK(soa.Self()->IsExceptionPending());
       *class_or_rcvr = nullptr;
       return false;
     }
-    *class_or_rcvr = sirt_klass.get();
+    *class_or_rcvr = h_klass.Get();
     return true;
   }
 
@@ -271,7 +272,8 @@
     const char* field_type_desciptor = fh.GetTypeDescriptor();
     field_prim_type = Primitive::GetType(field_type_desciptor[0]);
     if (field_prim_type == Primitive::kPrimNot) {
-      SirtRef<mirror::Object> sirt_obj(soa.Self(), o);
+      StackHandleScope<1> hs(soa.Self());
+      HandleWrapper<mirror::Object> h(hs.NewHandleWrapper(&o));
       // May cause resolution.
       CHECK(!kMovingFields) << "Resolution may trigger thread suspension";
       field_type = fh.GetType(true);