OSDN Git Service

ART: Fix computation of frame size for direct proxy methods
authorSerguei Katkov <serguei.i.katkov@intel.com>
Fri, 29 Aug 2014 11:20:15 +0000 (18:20 +0700)
committerIan Rogers <irogers@google.com>
Thu, 4 Sep 2014 14:23:16 +0000 (07:23 -0700)
Proxy method has only one direct method and it is a constructor which
is cloned from java.lang.reflect.Proxy class together with code.
As a result its body is a compiled quick code and frame size should be
computed accordingly in contrast with other virtual methods which are
invoked through stub.

Change-Id: I0ac99b2f567b281c9342152bad1149dd6cd39480
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
(cherry picked from commit 805bab1738549b2477b3ad4d9d57fd7c681451b9)

runtime/mirror/art_method-inl.h

index 58321c7..fbbe1b6 100644 (file)
@@ -347,7 +347,11 @@ inline QuickMethodFrameInfo ArtMethod::GetQuickFrameInfo() {
     return QuickMethodFrameInfo(kStackAlignment, 0u, 0u);
   }
   Runtime* runtime = Runtime::Current();
-  if (UNLIKELY(IsAbstract()) || UNLIKELY(IsProxyMethod())) {
+  // For Proxy method we exclude direct method (there is only one direct method - constructor).
+  // Direct method is cloned from original java.lang.reflect.Proxy class together with code
+  // and as a result it is executed as usual quick compiled method without any stubs.
+  // So the frame info should be returned as it is a quick method not a stub.
+  if (UNLIKELY(IsAbstract()) || UNLIKELY(IsProxyMethod() && !IsDirect())) {
     return runtime->GetCalleeSaveMethodFrameInfo(Runtime::kRefsAndArgs);
   }
   if (UNLIKELY(IsRuntimeMethod())) {