Interpreter entries and instrumentation as a listener.

Make the instrumentation responsible for whether we want method entry/exit
stubs, and allow it to use interpreter entry stubs when instruction by
instruction instrumentation is required. Improve deoptimization so more JDWP
test cases are passing.

Refactor exception debug posting, in particular improve reporting in the
interpreter. Improve class linker exception throwing so that broken dex files
are more likely to be reported. Fixes the performance issue Bug: 8410519.

Fix some error reporting lock level errors for the large object space. Make
fast object verification faster.

Add some debug mode robustness to finding dex PCs in GC maps.

Add printf attributes to JniAbortF and fix errors.

Expand run-test 044 to test return behaviors and fix issues with not throwing
appropriate exceptions for proxies.

Ensure causes are reported with a class linker NoClassDefFoundError and JNI
NoSuchFieldError.

Remove unused debugMe and updateDebuggerFromCode.

There's a minor sizing tweak to the arg array builder, and an extra reference
array check in the interpreter.

Some clean-up of trace code.

Fix reg type cache destructor if it is called after the reg type cache is
shutdown (as is the case in oatdump).

Change-Id: I6519c7b35df77f978d011999354c864f4918e8ce
diff --git a/src/runtime_support.h b/src/runtime_support.h
index 89026c1..c7eb957 100644
--- a/src/runtime_support.h
+++ b/src/runtime_support.h
@@ -68,7 +68,8 @@
   }
   if (access_check) {
     if (UNLIKELY(!klass->IsInstantiable())) {
-      self->ThrowNewException("Ljava/lang/InstantiationError;",
+      ThrowLocation throw_location = self->GetCurrentLocationForThrow();
+      self->ThrowNewException(throw_location, "Ljava/lang/InstantiationError;",
                               PrettyDescriptor(klass).c_str());
       return NULL;  // Failure
     }
@@ -95,7 +96,7 @@
                                                 Thread* self, bool access_check)
     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
   if (UNLIKELY(component_count < 0)) {
-    self->ThrowNewExceptionF("Ljava/lang/NegativeArraySizeException;", "%d", component_count);
+    ThrowNegativeArraySizeException(component_count);
     return NULL;  // Failure
   }
   mirror::Class* klass = method->GetDexCacheResolvedTypes()->Get(type_idx);
@@ -257,8 +258,9 @@
     UNLOCK_FUNCTION(monitor_lock_) {
   // Save any pending exception over monitor exit call.
   mirror::Throwable* saved_exception = NULL;
+  ThrowLocation saved_throw_location;
   if (UNLIKELY(self->IsExceptionPending())) {
-    saved_exception = self->GetException();
+    saved_exception = self->GetException(&saved_throw_location);
     self->ClearException();
   }
   // Decode locked object and unlock, before popping local references.
@@ -267,11 +269,11 @@
     LOG(FATAL) << "Synchronized JNI code returning with an exception:\n"
         << saved_exception->Dump()
         << "\nEncountered second exception during implicit MonitorExit:\n"
-        << self->GetException()->Dump();
+        << self->GetException(NULL)->Dump();
   }
   // Restore pending exception.
   if (saved_exception != NULL) {
-    self->SetException(saved_exception);
+    self->SetException(saved_throw_location, saved_exception);
   }
 }
 
@@ -280,14 +282,12 @@
   if (o == NULL) {
     return;
   }
+  mirror::AbstractMethod* m = self->GetCurrentMethod(NULL);
   if (o == kInvalidIndirectRefObject) {
-    JniAbortF(NULL, "invalid reference returned from %s",
-              PrettyMethod(self->GetCurrentMethod()).c_str());
+    JniAbortF(NULL, "invalid reference returned from %s", PrettyMethod(m).c_str());
   }
   // Make sure that the result is an instance of the type this method was expected to return.
-  mirror::AbstractMethod* m = self->GetCurrentMethod();
-  MethodHelper mh(m);
-  mirror::Class* return_type = mh.GetReturnType();
+  mirror::Class* return_type = MethodHelper(m).GetReturnType();
 
   if (!o->InstanceOf(return_type)) {
     JniAbortF(NULL, "attempt to return an instance of %s from %s",