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());
}
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);
}
}
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);
}
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);
}
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);
}
Aggregations