ART: Simplify MethodHandle invocations
Use an operand iterator rather than passing arguments for both
range and varargs operands.
Test: art/test.py --host -j32
Change-Id: Ia42398773bd3732d917e19c25aa431b1e1369320
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index 127b5d7..22c9a1d 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -2649,28 +2649,24 @@
// Call DoInvokePolymorphic with |is_range| = true, as shadow frame has argument registers in
// consecutive order.
- uint32_t unused_args[Instruction::kMaxVarArgRegs] = {};
- uint32_t first_callee_arg = first_arg + 1;
-
+ RangeInstructionOperands operands(first_arg + 1, num_vregs - 1);
bool isExact = (jni::EncodeArtMethod(resolved_method) ==
WellKnownClasses::java_lang_invoke_MethodHandle_invokeExact);
bool success = false;
if (isExact) {
- success = MethodHandleInvokeExact<true/*is_range*/>(self,
- *shadow_frame,
- method_handle,
- method_type,
- unused_args,
- first_callee_arg,
- result);
+ success = MethodHandleInvokeExact(self,
+ *shadow_frame,
+ method_handle,
+ method_type,
+ &operands,
+ result);
} else {
- success = MethodHandleInvoke<true/*is_range*/>(self,
- *shadow_frame,
- method_handle,
- method_type,
- unused_args,
- first_callee_arg,
- result);
+ success = MethodHandleInvoke(self,
+ *shadow_frame,
+ method_handle,
+ method_type,
+ &operands,
+ result);
}
DCHECK(success || self->IsExceptionPending());