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/oat/runtime/support_throw.cc b/src/oat/runtime/support_throw.cc
index 420b442..21adc52 100644
--- a/src/oat/runtime/support_throw.cc
+++ b/src/oat/runtime/support_throw.cc
@@ -91,27 +91,7 @@
 extern "C" void artThrowStackOverflowFromCode(Thread* self, AbstractMethod** sp)
     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
   FinishCalleeSaveFrameSetup(self, sp, Runtime::kSaveAll);
-  CHECK(!self->IsHandlingStackOverflow()) << "Recursive stack overflow.";
-  // Remove extra entry pushed onto second stack during method tracing.
-  if (Runtime::Current()->IsMethodTracingActive()) {
-    InstrumentationMethodUnwindFromCode(self);
-  }
-  self->SetStackEndForStackOverflow();  // Allow space on the stack for constructor to execute.
-  JNIEnvExt* env = self->GetJniEnv();
-  std::string msg("stack size ");
-  msg += PrettySize(self->GetStackSize());
-  // Use low-level JNI routine and pre-baked error class to avoid class linking operations that
-  // would consume more stack.
-  int rc = ::art::ThrowNewException(env, WellKnownClasses::java_lang_StackOverflowError,
-                                    msg.c_str(), NULL);
-  if (rc != JNI_OK) {
-    // TODO: ThrowNewException failed presumably because of an OOME, we continue to throw the OOME
-    //       or die in the CHECK below. We may want to throw a pre-baked StackOverflowError
-    //       instead.
-    LOG(ERROR) << "Couldn't throw new StackOverflowError because JNI ThrowNew failed.";
-    CHECK(self->IsExceptionPending());
-  }
-  self->ResetDefaultStackEnd();  // Return to default stack size.
+  ThrowStackOverflowError(self);
   self->DeliverException();
 }