interpreter: support for non-exact invokes.

Performs primitive argument conversions as well as boxing and unboxing
operations. Support for return value conversions will be added in a
follow up change.

Test: make test-art-host

Change-Id: I2e3348ff64a5826e477f87c12a7d5c390eb3a653
diff --git a/runtime/method_handles.h b/runtime/method_handles.h
index 5c68a8f..a36b66d 100644
--- a/runtime/method_handles.h
+++ b/runtime/method_handles.h
@@ -19,8 +19,17 @@
 
 #include <ostream>
 
+#include "dex_instruction.h"
+#include "jvalue.h"
+
 namespace art {
 
+namespace mirror {
+  class MethodType;
+}
+
+class ShadowFrame;
+
 // Defines the behaviour of a given method handle. The behaviour
 // of a handle of a given kind is identical to the dex bytecode behaviour
 // of the equivalent instruction.
@@ -46,6 +55,22 @@
   return handle_kind <= kLastInvokeKind;
 }
 
+// Perform argument conversions between |callsite_type| (the type of the
+// incoming arguments) and |callee_type| (the type of the method being
+// invoked). These include widening and narrowing conversions as well as
+// boxing and unboxing. Returns true on success, on false on failure. A
+// pending exception will always be set on failure.
+template <bool is_range> REQUIRES_SHARED(Locks::mutator_lock_)
+bool PerformArgumentConversions(Thread* self,
+                                Handle<mirror::MethodType> callsite_type,
+                                Handle<mirror::MethodType> callee_type,
+                                const ShadowFrame& caller_frame,
+                                uint32_t first_src_reg,
+                                uint32_t first_dest_reg,
+                                const uint32_t (&arg)[Instruction::kMaxVarArgRegs],
+                                ShadowFrame* callee_frame,
+                                JValue* result);
+
 }  // namespace art
 
 #endif  // ART_RUNTIME_METHOD_HANDLES_H_