Fix braino in InvokeFromTransform

ShadowFrame created with the unpacked EmulatedStackFrame should use
the caller method, not the method that will subsequently be called.

Fix: 217885158
Test: atest CtsLibcoreOjTestCases:test.java.lang.invoke (with libartd)
Test: atest CtsLibcoreTestCases:libcore.java.lang.invoke (with libartd)
Test: art/test.py --host
Change-Id: I531972531f7fb963a5bcb90cd0e0e5f390a7d4b4
diff --git a/runtime/method_handles.cc b/runtime/method_handles.cc
index a775763..185b9ae 100644
--- a/runtime/method_handles.cc
+++ b/runtime/method_handles.cc
@@ -397,7 +397,6 @@
   DCHECK_EQ(kNumRegsForTransform, accessor.RegistersSize());
   DCHECK_EQ(kNumRegsForTransform, accessor.InsSize());
 
-
   StackHandleScope<2> hs(self);
   Handle<mirror::MethodType> callee_type(hs.NewHandle(method_handle->GetMethodType()));
   Handle<mirror::EmulatedStackFrame> sf(
@@ -789,10 +788,7 @@
   ShadowFrameAllocaUniquePtr shadow_frame_unique_ptr =
       CREATE_SHADOW_FRAME(num_regs, &shadow_frame, called_method, /* dex pc */ 0);
   ShadowFrame* new_shadow_frame = shadow_frame_unique_ptr.get();
-  CopyArgumentsFromCallerFrame(shadow_frame,
-                               new_shadow_frame,
-                               operands,
-                               first_dest_reg);
+  CopyArgumentsFromCallerFrame(shadow_frame, new_shadow_frame, operands, first_dest_reg);
   self->EndAssertNoThreadSuspension(old_cause);
 
   PerformCall(self,
@@ -917,9 +913,10 @@
   const RangeInstructionOperands operands(0, num_vregs);
 
   const char* old_cause = self->StartAssertNoThreadSuspension("InvokeFromTransform");
-  ArtMethod* called_method = method_handle->GetTargetMethod();  // invoke / invokeExact.
-  ShadowFrameAllocaUniquePtr shadow_frame =
-      CREATE_SHADOW_FRAME(num_vregs, &caller_frame, called_method, caller_frame.GetDexPC());
+  ShadowFrameAllocaUniquePtr shadow_frame = CREATE_SHADOW_FRAME(num_vregs,
+                                                                &caller_frame,
+                                                                caller_frame.GetMethod(),
+                                                                caller_frame.GetDexPC());
   if (num_vregs > 0) {
     emulated_frame->WriteToShadowFrame(
         self, callsite_type, operands.GetOperand(0), shadow_frame.get());