Various fixes to the interpreter. First 23 run-test tests pass.

- Factored out code to throw stack overflow error into its own method.
- Increased kStackOverflowReservedBytes to 10kB to support interpreter.
- Reordered return type checks to prevent type resolution with an
  exception pending.
- Fixed field checks so they pass if the field is static or the object
  is the declaring class.
- Suppressed using the interpreter for proxy methods.

Change-Id: Ide73ec928ab0aa7b31229c4e69679a35dd948e43
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index d8031c1..0a66a21 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -405,7 +405,9 @@
   } else {
     UnstartedRuntimeInvoke(self, target_method, receiver, arg_array.get(), result);
   }
-  if (!mh.GetReturnType()->IsPrimitive() && result->GetL() != NULL) {
+  // Check the return type if the result is non-null. We do the GetReturnType
+  // after the null check to avoid resolution when there's an exception pending.
+  if (result->GetL() != NULL && !mh.GetReturnType()->IsPrimitive()) {
     CHECK(mh.GetReturnType()->IsAssignableFrom(result->GetL()->GetClass()));
   }
   mh.ChangeMethod(shadow_frame.GetMethod());
@@ -1747,6 +1749,11 @@
 void EnterInterpreterFromInvoke(Thread* self, AbstractMethod* method, Object* receiver,
                                 JValue* args, JValue* result) {
   DCHECK_EQ(self, Thread::Current());
+  if (__builtin_frame_address(0) < self->GetStackEnd()) {
+    ThrowStackOverflowError(self);
+    return;
+  }
+
   MethodHelper mh(method);
   const DexFile::CodeItem* code_item = mh.GetCodeItem();
   uint16_t num_regs;