summaryrefslogtreecommitdiff
path: root/runtime/method_handles.h
Commit message (Collapse)AuthorAgeFilesLines
* ObjPtr<>-ify UnstartedRuntime, fix 2 stale reference uses.Vladimir Marko2018-05-231-74/+2
| | | | | | Test: Rely on TreeHugger. Bug: 31113334 Change-Id: I35f76c3e3b94dfca18dbe67aba065a1270f4e5ee
* ART: Update invoke-custom implementationOrion Hodson2018-03-081-0/+7
| | | | | | | | | | | | | | | | | | | Adds type checking for bootstrap arguments and support for variable arity bootstrap arguments. Adds tests for malformed bootstrap arguments, variable arity bootstrap arguments, and invocation arguments to passed to the CallSite's MethodHandle. Removes unnecessary wrapping when j.l.Error's are raised during BSM invocation. Removes BSM argument type checking from verifier. This is now performed during invocation. Bug: 73927525 Test: art/test/run-test --host 952-invoke-custom Change-Id: Id43226edad64ad9812e4ba1a069dfb70b8196dad
* ART: Support for VarHandle invokersOrion Hodson2018-02-221-1/+2
| | | | | | | | | Enables VarHandles to invoked by a MethodHandle. Bug: b/65872996 Test: art/test/run-test --host 713 Change-Id: I4672dd50654396c2b45bd212a523698cf22879eb
* Revert^2 "ART: Interpreter support for VarHandle accessors"Orion Hodson2018-02-091-9/+9
| | | | | | | | This reverts commit c4d3bf4eaff9720ed0bb7775db6fc24a1bd755dd. Bug: 65872996 Test: art/test/testrunner.py -b --host Change-Id: I2d1017c45cee5b2fd2dd05e5eeff0a72146663b1
* Revert "ART: Interpreter support for VarHandle accessors"Orion Hodson2018-02-061-9/+9
| | | | | | | | This reverts commit becc83b59ff703c02198f832dbc3216a0ab8a022. Reason for revert: breaks on the ART buildbots due to localized toolchain differences. Change-Id: Ieb1d93b0fc7116ddc542d8bbfee1975bcb30a8f7
* ART: Interpreter support for VarHandle accessorsOrion Hodson2018-02-061-9/+9
| | | | | | | | | Add support for invoking VarHandle accessors in the interpreter and forces code with VarHandles accessor invocations to use the interpreter. Bug: 65872996 Test: art/test/run-test --host 712 Change-Id: I9ee3ad6aef6a3bc73d90cec0a8e023e5db42b7a2
* Create dex subdirectoryDavid Sehr2018-01-051-1/+1
| | | | | | | | | Move all the DexFile related source to a common subdirectory dex/ of runtime. Bug: 71361973 Test: make -j 50 test-art-host Change-Id: I59e984ed660b93e0776556308be3d653722f5223
* ART: Simplify MethodHandle invocationsOrion Hodson2017-11-131-36/+22
| | | | | | | | Use an operand iterator rather than passing arguments for both range and varargs operands. Test: art/test.py --host -j32 Change-Id: Ia42398773bd3732d917e19c25aa431b1e1369320
* cpplint: Cleanup errorsIgor Murashkin2017-11-081-2/+2
| | | | | | | | | Cleanup errors from upstream cpplint in preparation for moving art's cpplint fork to upstream tip-of-tree cpplint. Test: cd art && mm Bug: 68951293 Change-Id: I15faed4594cbcb8399850f8bdee39d42c0c5b956
* ART: Intrinsify polymorphic signature methodsOrion Hodson2017-11-011-8/+17
| | | | | | | | | | | | | | | Adds VarHandle accessor method to list of intrinsics. Adds code to interpreter to ensure intrinsics with polymorphic signatures are initialized. Rename most uses of InvokePolymorphic to InvokeMethodHandle (and similar changes) to be clear that the particular code path applies to MethodHandle instances rather than VarHandle. Change-Id: Ib74865124a1e986badc0a7c4bb3d782af07225d4 Bug: 65872996 Test: art/test.py --host
* ART: Refactor stack.hAndreas Gampe2017-06-191-3/+1
| | | | | | | | | Factor out LockCountData, ShadowFrame and JavaFrameRootInfo and leave stack.h for the StackVisitor. Move single-use function to user to remove DexFile dependency. Test: m test-art-host Change-Id: I53d2880917bdf6782856fd2b16f38a0293f3aefc
* ART: Clean up thread.h and thread_list.hAndreas Gampe2017-06-011-0/+1
| | | | | | | | | Remove dependency on stack.h and gc_root.h. Remove unused object callbacks include. Factor out ManagedStack into its own set of files. Fix up users of transitive includes. Test: m test-art-host Change-Id: I01286c43d8c7710948c161b1348faabb05922e59
* ART: Add missing namespace commentsAndreas Gampe2017-05-301-1/+1
| | | | | | | | Add closing namespace comments. Bug: 32619234 Test: m Change-Id: I1f50e09dcd1038c4b540b87e5c19e319c1f592e4
* ART: invoke-custom supportOrion Hodson2017-02-141-3/+3
| | | | | | | | Adds invoke-custom instruction to the interpreter. Bug: 33191717,30550796 Test: art/test/run-test --host 952 Change-Id: I3b754128649a8b3a00ade79ba2518d0e377f3a1e
* ART: Make method handle runtime code callable from compiler.Orion Hodson2017-01-061-48/+15
| | | | | | | | | | | Most of this change is moving the existing method handles code, but it also introduces a new header file, common_dex_operations.h, that has some operations taken from interpreter_common.{h,cc} that are also used by method handles (perform call, set field, get field). Bug: 30550796 Test: m test-art-host Change-Id: I2235e13770a5562950f2767f65a25ca273479150
* Revert "Revert "Method Handles: Add VarargsCollector.""Orion Hodson2016-11-251-1/+7
| | | | | | | | This reverts commit 12af7a41c224923fb55699305008214636a1a3da. Test: m test-art-host-run-test-956-methodhandles Bug: 30550796 Change-Id: Ia820093bab919667729daba5b14330de51a63f79
* Revert "Method Handles: Add VarargsCollector."Orion Hodson2016-11-251-7/+1
| | | | | | This reverts commit ab52ce1480d9c4701bfe3ff3530596ec0c5760ee. Change-Id: Idc6dd28b58a61cbd2c9ee72e8a0eeb07b2ca0edf
* Method Handles: Add VarargsCollector.Orion Hodson2016-11-231-1/+7
| | | | | | | | | Enable support for methods with variable arity arguments. Test: m test-art-host-run-test-956-methodhandles Bug: 30550796 Change-Id: I205724ddacc6c9840e18093a3984c1ad6e54394a
* MethodHandles: Enable return value conversions.Orion Hodson2016-11-101-0/+10
| | | | | | | | | | | Enables return values conversions and simplify the type conversion logic. Ensures check for WrongMethodTypeExceptions before invoking a method handle. Test: m test-art-host-run-test-956-methodhandles Bug: 30550796 Change-Id: I8add3ad0a19b43010946b4fb9f1c0f0949287860
* Argument conversions for setter/getter MethodHandles.Orion Hodson2016-11-081-8/+35
| | | | | | | Test: m test-art-host-run-test-959-invoke-polymorphic-accessors Bug: 30550796 Change-Id: I9898605fc9f9f8a80f47f9559f3ccb99b02b07c8
* Address review comments from change 000e1885701c8f.Narayan Kamath2016-11-021-7/+6
| | | | | | | | Style fixes, and better OOM handling. bug: 30550796 Test: make test-art-host Change-Id: I2ab58e25bd08daace6609ba45d860994a354280f
* method_handles: Complete support for emulated stack frames.Narayan Kamath2016-10-281-12/+127
| | | | | | | | | | | | Most of this change is a refactor that templatizes the code that performs argument conversions. This allows us to copy arguments between two shadow frames, or an emulated stack frame and a shadow frame. Test: make test-art-host Bug: 30550796 Change-Id: I23e65735a2dbd28f3c7b7d1ccf9762e77e0cf1f1
* Interpreter: Add support for method handle transforms [Part 1].Narayan Kamath2016-10-261-9/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* method_handles: Minor refactor of PerformArgumentConversions.Narayan Kamath2016-10-241-2/+9
| | | | | | | | | | | | Separate out a method that can perform a single argument conversion. Useful for Field setters and also for future use in transforming handles where the input source will not be a stack frame. Also remove unnecessary JValue* argument. bug: 30550796 Test: make test-art-host Change-Id: I75a63800839dbf1016a2c362169e138c83f34e4c
* interpreter: support for non-exact invokes.Narayan Kamath2016-10-141-0/+25
| | | | | | | | | | 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
* Basic implementation of invoke / invoke-polymorphic.Narayan Kamath2016-10-051-0/+51
Basic switch interpreter support for invoke-polymorphic. This change allows for virtual/interface and static invokes on method handles. Support for direct invokes (including constructors) and field getters and setters will be added in follow up changes. Bug: 30550796 Test: make test-art-host Change-Id: Ieb3a991d974060d930d56467908d5c7c11d0e38e