Search in sources :

Example 1 with MethodHandleAccessProvider

use of jdk.vm.ci.meta.MethodHandleAccessProvider in project graal by oracle.

the class MethodHandleNode method simplify.

@Override
public void simplify(SimplifierTool tool) {
    MethodHandleAccessProvider methodHandleAccess = tool.getConstantReflection().getMethodHandleAccess();
    ValueNode[] argumentsArray = arguments.toArray(new ValueNode[arguments.size()]);
    final FixedNode before = this;
    GraphAdder adder = new GraphAdder(graph()) {

        @Override
        public <T extends ValueNode> T add(T node) {
            T added = graph().addOrUnique(node);
            if (added instanceof FixedWithNextNode) {
                graph().addBeforeFixed(before, (FixedWithNextNode) added);
            }
            return added;
        }
    };
    InvokeNode invoke = tryResolveTargetInvoke(adder, methodHandleAccess, intrinsicMethod, targetMethod, bci, returnStamp, argumentsArray);
    if (invoke != null) {
        assert invoke.graph() == null;
        invoke = graph().addOrUniqueWithInputs(invoke);
        invoke.setStateAfter(stateAfter());
        FixedNode currentNext = next();
        replaceAtUsages(invoke);
        GraphUtil.removeFixedWithUnusedInputs(this);
        graph().addBeforeFixed(currentNext, invoke);
    }
}
Also used : MethodHandleAccessProvider(jdk.vm.ci.meta.MethodHandleAccessProvider) FixedWithNextNode(org.graalvm.compiler.nodes.FixedWithNextNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) InvokeNode(org.graalvm.compiler.nodes.InvokeNode) FixedNode(org.graalvm.compiler.nodes.FixedNode)

Aggregations

MethodHandleAccessProvider (jdk.vm.ci.meta.MethodHandleAccessProvider)1 FixedNode (org.graalvm.compiler.nodes.FixedNode)1 FixedWithNextNode (org.graalvm.compiler.nodes.FixedWithNextNode)1 InvokeNode (org.graalvm.compiler.nodes.InvokeNode)1 ValueNode (org.graalvm.compiler.nodes.ValueNode)1