From bfd9a4378eacaf2dc2bbe05ad48c5164fc93c9fe Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Wed, 21 May 2014 17:43:44 -0700 Subject: 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 --- runtime/entrypoints/entrypoint_utils.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'runtime/entrypoints/entrypoint_utils.cc') 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(interface_method_jobj))); + // This can cause thread suspension. + mirror::Class* result_type = mh_interface_method.GetReturnType(); mirror::Object* result_ref = soa.Decode(result); mirror::Object* rcvr = soa.Decode(rcvr_jobj); - mirror::ArtMethod* interface_method = - soa.Decode(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; -- cgit v1.2.3-59-g8ed1b