Search in sources :

Example 6 with TruffleCallNode

use of org.graalvm.compiler.truffle.common.TruffleCallNode in project graal by oracle.

the class CallNode method copyGraphAndAddChildren.

private StructuredGraph copyGraphAndAddChildren(GraphManager.Entry entry) {
    StructuredGraph graph = entry.graph;
    return (StructuredGraph) graph.copy(new Consumer<UnmodifiableEconomicMap<Node, Node>>() {

        @Override
        public void accept(UnmodifiableEconomicMap<Node, Node> duplicates) {
            final EconomicMap<Invoke, TruffleCallNode> replacements = EconomicMap.create();
            for (Invoke original : entry.invokeToTruffleCallNode.getKeys()) {
                if (!original.isAlive()) {
                    continue;
                }
                final TruffleCallNode truffleCallNode = entry.invokeToTruffleCallNode.get(original);
                Invoke replacement = (Invoke) duplicates.get((Node) original);
                if (replacement != null && replacement.isAlive()) {
                    replacements.put(replacement, truffleCallNode);
                }
            }
            addChildren(CallNode.this, replacements);
        }
    }, graph.getDebug());
}
Also used : UnmodifiableEconomicMap(org.graalvm.collections.UnmodifiableEconomicMap) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) Consumer(java.util.function.Consumer) TruffleCallNode(org.graalvm.compiler.truffle.common.TruffleCallNode) TruffleCallNode(org.graalvm.compiler.truffle.common.TruffleCallNode) Node(org.graalvm.compiler.graph.Node) Invoke(org.graalvm.compiler.nodes.Invoke)

Example 7 with TruffleCallNode

use of org.graalvm.compiler.truffle.common.TruffleCallNode in project graal by oracle.

the class IsolatedCompilableTruffleAST method getCallNodes0.

@CEntryPoint(include = CEntryPoint.NotIncludedAutomatically.class)
@CEntryPointOptions(publishAs = CEntryPointOptions.Publish.NotPublished)
private static CompilerHandle<IsolatedTruffleCallNode[]> getCallNodes0(@SuppressWarnings("unused") ClientIsolateThread client, ClientHandle<SubstrateCompilableTruffleAST> compilableHandle) {
    SubstrateCompilableTruffleAST compilable = IsolatedCompileClient.get().unhand(compilableHandle);
    TruffleCallNode[] nodes = compilable.getCallNodes();
    ClientHandle<?>[] nodeHandles = new ClientHandle<?>[nodes.length];
    for (int i = 0; i < nodes.length; i++) {
        nodeHandles[i] = IsolatedCompileClient.get().hand(nodes[i]);
    }
    try (PinnedObject pinnedNodeHandles = PinnedObject.create(nodeHandles)) {
        return getCallNodes1(IsolatedCompileClient.get().getCompiler(), pinnedNodeHandles.addressOfArrayElement(0), nodeHandles.length);
    }
}
Also used : SubstrateCompilableTruffleAST(com.oracle.svm.truffle.api.SubstrateCompilableTruffleAST) TruffleCallNode(org.graalvm.compiler.truffle.common.TruffleCallNode) PinnedObject(org.graalvm.nativeimage.PinnedObject) ClientHandle(com.oracle.svm.graal.isolated.ClientHandle) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) CEntryPointOptions(com.oracle.svm.core.c.function.CEntryPointOptions)

Example 8 with TruffleCallNode

use of org.graalvm.compiler.truffle.common.TruffleCallNode in project graal by oracle.

the class IsolatedCompilableTruffleAST method getCallNodes1.

@CEntryPoint(include = CEntryPoint.NotIncludedAutomatically.class)
@CEntryPointOptions(publishAs = CEntryPointOptions.Publish.NotPublished)
private static CompilerHandle<IsolatedTruffleCallNode[]> getCallNodes1(@SuppressWarnings("unused") CompilerIsolateThread compiler, WordPointer nodeHandleArray, int length) {
    IsolatedTruffleCallNode[] nodes = new IsolatedTruffleCallNode[length];
    for (int i = 0; i < nodes.length; i++) {
        ClientHandle<TruffleCallNode> handle = nodeHandleArray.read(i);
        nodes[i] = new IsolatedTruffleCallNode(handle);
    }
    return IsolatedCompileContext.get().hand(nodes);
}
Also used : TruffleCallNode(org.graalvm.compiler.truffle.common.TruffleCallNode) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) CEntryPointOptions(com.oracle.svm.core.c.function.CEntryPointOptions)

Example 9 with TruffleCallNode

use of org.graalvm.compiler.truffle.common.TruffleCallNode in project graal by oracle.

the class IsolatedTruffleCallNode method getCurrentCallTarget0.

@CEntryPoint(include = CEntryPoint.NotIncludedAutomatically.class)
@CEntryPointOptions(publishAs = CEntryPointOptions.Publish.NotPublished)
private static ClientHandle<SubstrateCompilableTruffleAST> getCurrentCallTarget0(@SuppressWarnings("unused") ClientIsolateThread client, ClientHandle<TruffleCallNode> nodeHandle) {
    TruffleCallNode node = IsolatedCompileClient.get().unhand(nodeHandle);
    CompilableTruffleAST target = node.getCurrentCallTarget();
    return IsolatedCompileClient.get().hand((SubstrateCompilableTruffleAST) target);
}
Also used : TruffleCallNode(org.graalvm.compiler.truffle.common.TruffleCallNode) SubstrateCompilableTruffleAST(com.oracle.svm.truffle.api.SubstrateCompilableTruffleAST) CompilableTruffleAST(org.graalvm.compiler.truffle.common.CompilableTruffleAST) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) CEntryPointOptions(com.oracle.svm.core.c.function.CEntryPointOptions)

Example 10 with TruffleCallNode

use of org.graalvm.compiler.truffle.common.TruffleCallNode in project graal by oracle.

the class IsolatedTruffleInlining method findCallNode0.

@CEntryPoint(include = CEntryPoint.NotIncludedAutomatically.class)
@CEntryPointOptions(publishAs = CEntryPointOptions.Publish.NotPublished)
private static ClientHandle<TruffleCallNode> findCallNode0(@SuppressWarnings("unused") ClientIsolateThread client, ClientHandle<? extends TruffleInliningData> inliningHandle, ClientHandle<?> callNodeConstantHandle) {
    TruffleInliningData inlining = IsolatedCompileClient.get().unhand(inliningHandle);
    JavaConstant callNodeConstant = SubstrateObjectConstant.forObject(IsolatedCompileClient.get().unhand(callNodeConstantHandle));
    TruffleCallNode callNode = inlining.findCallNode(callNodeConstant);
    return IsolatedCompileClient.get().hand(callNode);
}
Also used : TruffleCallNode(org.graalvm.compiler.truffle.common.TruffleCallNode) TruffleInliningData(org.graalvm.compiler.truffle.common.TruffleInliningData) JavaConstant(jdk.vm.ci.meta.JavaConstant) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) CEntryPointOptions(com.oracle.svm.core.c.function.CEntryPointOptions)

Aggregations

TruffleCallNode (org.graalvm.compiler.truffle.common.TruffleCallNode)10 CEntryPointOptions (com.oracle.svm.core.c.function.CEntryPointOptions)4 CEntryPoint (org.graalvm.nativeimage.c.function.CEntryPoint)4 Invoke (org.graalvm.compiler.nodes.Invoke)3 SubstrateCompilableTruffleAST (com.oracle.svm.truffle.api.SubstrateCompilableTruffleAST)2 ClientHandle (com.oracle.svm.graal.isolated.ClientHandle)1 BlockNode (com.oracle.truffle.api.nodes.BlockNode)1 Node (com.oracle.truffle.api.nodes.Node)1 NodeVisitor (com.oracle.truffle.api.nodes.NodeVisitor)1 RootNode (com.oracle.truffle.api.nodes.RootNode)1 ArrayList (java.util.ArrayList)1 Consumer (java.util.function.Consumer)1 JavaConstant (jdk.vm.ci.meta.JavaConstant)1 UnmodifiableEconomicMap (org.graalvm.collections.UnmodifiableEconomicMap)1 Node (org.graalvm.compiler.graph.Node)1 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)1 CompilableTruffleAST (org.graalvm.compiler.truffle.common.CompilableTruffleAST)1 TruffleInliningData (org.graalvm.compiler.truffle.common.TruffleInliningData)1 TruffleFromLibGraal (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal)1 JNIEnv (org.graalvm.jniutils.JNI.JNIEnv)1