Ensure proxy methods are reported by instrumentation

Previously we would not report proxy methods to instrumentation in all
cases. Specifically if the instrumentation trampolines were not
installed we would never report proxy method entry or exit. This fixes
that and ensures that proxy methods are always reported to
instrumentation regardless of what instrumentation method is being
used. It also ensures that these methods will only ever be reported
once per entry.

Test: ./test.py --host
Test: ./test/testrunner/testrunner.py \
         --host \
         --run-test-option='--with-agent libtifast.so=MethodEntry,MethodExit'

Change-Id: I78f1d4b3b3f242e8915989ab26f7c204baab08e5
diff --git a/openjdkjvmti/events.cc b/openjdkjvmti/events.cc
index 5cb4299..f71a5dc 100644
--- a/openjdkjvmti/events.cc
+++ b/openjdkjvmti/events.cc
@@ -504,8 +504,9 @@
       REQUIRES_SHARED(art::Locks::mutator_lock_) OVERRIDE {
     if (!method->IsRuntimeMethod() &&
         event_handler_->IsEventEnabledAnywhere(ArtJvmtiEvent::kMethodExit)) {
-      DCHECK_EQ(method->GetReturnTypePrimitive(), art::Primitive::kPrimNot)
-          << method->PrettyMethod();
+      DCHECK_EQ(
+          method->GetInterfaceMethodIfProxy(art::kRuntimePointerSize)->GetReturnTypePrimitive(),
+          art::Primitive::kPrimNot) << method->PrettyMethod();
       DCHECK(!self->IsExceptionPending());
       jvalue val;
       art::JNIEnvExt* jnienv = self->GetJniEnv();
@@ -530,8 +531,9 @@
       REQUIRES_SHARED(art::Locks::mutator_lock_) OVERRIDE {
     if (!method->IsRuntimeMethod() &&
         event_handler_->IsEventEnabledAnywhere(ArtJvmtiEvent::kMethodExit)) {
-      DCHECK_NE(method->GetReturnTypePrimitive(), art::Primitive::kPrimNot)
-          << method->PrettyMethod();
+      DCHECK_NE(
+          method->GetInterfaceMethodIfProxy(art::kRuntimePointerSize)->GetReturnTypePrimitive(),
+          art::Primitive::kPrimNot) << method->PrettyMethod();
       DCHECK(!self->IsExceptionPending());
       jvalue val;
       art::JNIEnvExt* jnienv = self->GetJniEnv();