Fix pointer size mismatch

When compiler starts interpreter and unstarted_runtime, the pointer size
needed should be determined by the target instead of using compiler's
binary mode. Since compiler is only compiled once for both 32-bit and
64-bit, there will be a mismatch for some cases.

Fixed the pointer size used in compiler and interpreter, retrieve
pointer size from ClassLinker when needed.

Updated corresponding test, otherwise there would be check fail which
test the equality of pointer sizes between the template argument and
runtime information.

Test: make test-art-host -j64
Change-Id: I927a24ec79f8f82420133c6996703b940852a1e0
diff --git a/runtime/interpreter/interpreter_common.h b/runtime/interpreter/interpreter_common.h
index 38edc7a..74fec48 100644
--- a/runtime/interpreter/interpreter_common.h
+++ b/runtime/interpreter/interpreter_common.h
@@ -241,7 +241,7 @@
   }
   CHECK(receiver->GetClass()->ShouldHaveEmbeddedVTable());
   ArtMethod* const called_method = receiver->GetClass()->GetEmbeddedVTableEntry(
-      vtable_idx, kRuntimePointerSize);
+      vtable_idx, Runtime::Current()->GetClassLinker()->GetImagePointerSize());
   if (UNLIKELY(called_method == nullptr)) {
     CHECK(self->IsExceptionPending());
     result->SetJ(0);
diff --git a/runtime/interpreter/unstarted_runtime_test.cc b/runtime/interpreter/unstarted_runtime_test.cc
index c314f3c..c2ef724 100644
--- a/runtime/interpreter/unstarted_runtime_test.cc
+++ b/runtime/interpreter/unstarted_runtime_test.cc
@@ -386,8 +386,9 @@
   Thread* self = Thread::Current();
   ScopedObjectAccess soa(self);
   mirror::Class* klass = mirror::String::GetJavaLangString();
-  ArtMethod* method = klass->FindDeclaredDirectMethod("<init>", "(Ljava/lang/String;)V",
-                                                      kRuntimePointerSize);
+  ArtMethod* method =
+      klass->FindDeclaredDirectMethod("<init>", "(Ljava/lang/String;)V",
+                                      Runtime::Current()->GetClassLinker()->GetImagePointerSize());
 
   // create instruction data for invoke-direct {v0, v1} of method with fake index
   uint16_t inst_data[3] = { 0x2070, 0x0000, 0x0010 };
@@ -1335,10 +1336,16 @@
   ArtMethod* throw_cons = throw_class->FindDeclaredDirectMethod(
       "<init>", "(Ljava/lang/String;)V", class_linker->GetImagePointerSize());
   ASSERT_TRUE(throw_cons != nullptr);
-
-  Handle<mirror::Constructor> cons = hs.NewHandle(
-      mirror::Constructor::CreateFromArtMethod<kRuntimePointerSize, false>(self, throw_cons));
-  ASSERT_TRUE(cons != nullptr);
+  Handle<mirror::Constructor> cons;
+  if (class_linker->GetImagePointerSize() == PointerSize::k64) {
+     cons = hs.NewHandle(
+        mirror::Constructor::CreateFromArtMethod<PointerSize::k64, false>(self, throw_cons));
+    ASSERT_TRUE(cons != nullptr);
+  } else {
+    cons = hs.NewHandle(
+        mirror::Constructor::CreateFromArtMethod<PointerSize::k32, false>(self, throw_cons));
+    ASSERT_TRUE(cons != nullptr);
+  }
 
   Handle<mirror::ObjectArray<mirror::Object>> args = hs.NewHandle(
       mirror::ObjectArray<mirror::Object>::Alloc(