summaryrefslogtreecommitdiff
path: root/runtime/entrypoints/entrypoint_utils.cc
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2014-05-21 17:43:44 -0700
committer Mathieu Chartier <mathieuc@google.com> 2014-06-09 12:46:32 -0700
commitbfd9a4378eacaf2dc2bbe05ad48c5164fc93c9fe (patch)
tree3d3f667c8232a9c1bb6fe9daea0d364f9ae01d8c /runtime/entrypoints/entrypoint_utils.cc
parent2e1ca953c7fb165da36cc26ea74d3045d7e272c8 (diff)
Change MethodHelper to use a Handle.
Added ConstHandle to help prevent errors where you modify the value stored in the handle of the caller. Also fixed compaction bugs related to not knowing MethodHelper::GetReturnType can resolve types. This bug was present in interpreter RETURN_OBJECT. Bug: 13077697 Change-Id: I71f964d4d810ab4debda1a09bc968af8f3c874a3
Diffstat (limited to 'runtime/entrypoints/entrypoint_utils.cc')
-rw-r--r--runtime/entrypoints/entrypoint_utils.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/runtime/entrypoints/entrypoint_utils.cc b/runtime/entrypoints/entrypoint_utils.cc
index 320273d176..a0e32f520d 100644
--- a/runtime/entrypoints/entrypoint_utils.cc
+++ b/runtime/entrypoints/entrypoint_utils.cc
@@ -189,18 +189,21 @@ JValue InvokeProxyInvocationHandler(ScopedObjectAccessAlreadyRunnable& soa, cons
// Do nothing.
return zero;
} else {
+ StackHandleScope<1> hs(soa.Self());
+ MethodHelper mh_interface_method(
+ hs.NewHandle(soa.Decode<mirror::ArtMethod*>(interface_method_jobj)));
+ // This can cause thread suspension.
+ mirror::Class* result_type = mh_interface_method.GetReturnType();
mirror::Object* result_ref = soa.Decode<mirror::Object*>(result);
mirror::Object* rcvr = soa.Decode<mirror::Object*>(rcvr_jobj);
- mirror::ArtMethod* interface_method =
- soa.Decode<mirror::ArtMethod*>(interface_method_jobj);
- mirror::Class* result_type = MethodHelper(interface_method).GetReturnType();
mirror::ArtMethod* proxy_method;
- if (interface_method->GetDeclaringClass()->IsInterface()) {
- proxy_method = rcvr->GetClass()->FindVirtualMethodForInterface(interface_method);
+ if (mh_interface_method.GetMethod()->GetDeclaringClass()->IsInterface()) {
+ proxy_method = rcvr->GetClass()->FindVirtualMethodForInterface(
+ mh_interface_method.GetMethod());
} else {
// Proxy dispatch to a method defined in Object.
- DCHECK(interface_method->GetDeclaringClass()->IsObjectClass());
- proxy_method = interface_method;
+ DCHECK(mh_interface_method.GetMethod()->GetDeclaringClass()->IsObjectClass());
+ proxy_method = mh_interface_method.GetMethod();
}
ThrowLocation throw_location(rcvr, proxy_method, -1);
JValue result_unboxed;