Interpreter: Add support for method handle transforms [Part 1].

Method handle transformations are implemented in Java by
subclasses of java.lang.invoke.Transformers.Transformer. Transformer
extends MethodHandle and provides a transformer method defined like so:

public static class TransformerImpl extends Transformer {
    @Override
    public void transform(EmulatedStackFrame emulatedStackFrame) throws Throwable {
    }
}

An EmulatedStackFrame is synthesized by the runtime based on the
caller stack frame and arguments specified by the instruction. It will
contain all input arguments to the method their associated types. It
will also exactly match the method type specified by the target handle
(i.e, argument coversions are performed by the runtime).

The transformer method operates on supplied EmulatedStackFrame
and other instance state to synthesize the transformation. In some
cases, these transformations will end up calling other signature
polymorphic methods. In those cases, the transformer can construct
an EmulatedStackFrame and issue the invoke passing that through as
the single input argument. For e.g,

  EmulatedStackFrame sf = EmulatedStackFrame.newInstance();
  sf.pushArgument("foo", String.class);
  sf.pushIntArgument(42);

  // The callsite type for this polymorphic invoke is
  // (Ldalvik/system/EmulatedStackFrame)V;
  delegate.invoke(sf);

The runtime will treat such polymorphic invokes specially and unmarshal
this EmulatedStackFrame on to the callee stack frame based on the type
and number of arguments contained in the EmulatedStackFrame and the
declared type of the target method handle.

In this change :

Adds the basic plumbing for transformer invokes. In particular, the code
for marshaling and unmarshaling emulated stack frames isn't implemented
and will be added in a follow up method. This plumbing is sufficient to
implement a test case of a method handle transform that doesn't need any
input arguments, so is trivially implementable without proper
EmulatedStackFrame support.

bug: 30550796
Test: make test-art-host
Change-Id: Iafa29accaef26d0a33f8b83713bed5d929df547e
6 files changed