Support for resolving unknown direct/static methods.

If we can't resolve a method we don't know whether it is direct or
static from the dex information (other than the invocation instruction).
Add support for a third type of resolution stub that can discover the
type of the method based on the calling method and PC of the invocation
instruction. Its still unimplemented to look up the instruction and
figure out if the type is static or not.

Change-Id: I8b76e6ba2c946376e7fe287dbcca17bcaab0e133
diff --git a/src/runtime.cc b/src/runtime.cc
index 231c010..5d2689d 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -592,20 +592,30 @@
   abstract_method_error_stub_array_ = abstract_method_error_stub_array;
 }
 
-bool Runtime::HasResolutionStubArray(bool is_static) const {
-  return resolution_stub_array_[is_static ? 1 : 0] != NULL;
+
+Runtime::TrampolineType Runtime::GetTrampolineType(Method* method) {
+  if (method == NULL) {
+    return Runtime::kUnknownMethod;
+  } else if (method->IsStatic()) {
+    return Runtime::kStaticMethod;
+  } else {
+    return Runtime::kInstanceMethod;
+  }
 }
 
-ByteArray* Runtime::GetResolutionStubArray(bool is_static) const {
-  CHECK(HasResolutionStubArray(is_static));
-  return resolution_stub_array_[is_static ? 1 : 0];
+bool Runtime::HasResolutionStubArray(TrampolineType type) const {
+  return resolution_stub_array_[type] != NULL;
 }
 
-void Runtime::SetResolutionStubArray(ByteArray* resolution_stub_array, bool is_static) {
+ByteArray* Runtime::GetResolutionStubArray(TrampolineType type) const {
+  CHECK(HasResolutionStubArray(type));
+  return resolution_stub_array_[type];
+}
+
+void Runtime::SetResolutionStubArray(ByteArray* resolution_stub_array, TrampolineType type) {
   CHECK(resolution_stub_array != NULL);
-  CHECK(!HasResolutionStubArray(is_static) ||
-        resolution_stub_array_[is_static ? 1 : 0] == resolution_stub_array);
-  resolution_stub_array_[is_static ? 1 : 0] = resolution_stub_array;
+  CHECK(!HasResolutionStubArray(type) || resolution_stub_array_[type] == resolution_stub_array);
+  resolution_stub_array_[type] = resolution_stub_array;
 }
 
 Method* Runtime::CreateCalleeSaveMethod(InstructionSet insns) {