summaryrefslogtreecommitdiff
path: root/compiler/optimizing/graph_visualizer.cc
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2016-10-19 11:05:04 +0100
committerNarayan Kamath <narayan@google.com>2016-10-26 09:53:40 +0100
commitc3b7f1a34667386a2e55f59db795082a9e2408fd (patch)
tree6a454999907c9813d1d3c8e1ae4d3d50545fd4d2 /compiler/optimizing/graph_visualizer.cc
parent75dccb7238714358fca9e5e993e4daabe24af085 (diff)
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
Diffstat (limited to 'compiler/optimizing/graph_visualizer.cc')
0 files changed, 0 insertions, 0 deletions