use of org.graalvm.compiler.nodes.extended.ForeignCallNode in project graal by oracle.
the class ForeignCallDeoptimizeTest method registerInvocationPlugins.
@Override
protected void registerInvocationPlugins(InvocationPlugins invocationPlugins) {
ForeignCallsProvider foreignCalls = ((HotSpotProviders) getProviders()).getForeignCalls();
invocationPlugins.register(new InvocationPlugin() {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode arg) {
ForeignCallNode node = new ForeignCallNode(foreignCalls, HotSpotForeignCallsProviderImpl.TEST_DEOPTIMIZE_CALL_INT, arg);
b.addPush(JavaKind.Int, node);
return true;
}
}, ForeignCallDeoptimizeTest.class, "testCallInt", int.class);
super.registerInvocationPlugins(invocationPlugins);
}
use of org.graalvm.compiler.nodes.extended.ForeignCallNode in project graal by oracle.
the class PEGraphDecoder method handleFixedNode.
@Override
protected void handleFixedNode(MethodScope s, LoopScope loopScope, int nodeOrderId, FixedNode node) {
PEMethodScope methodScope = (PEMethodScope) s;
if (node instanceof ForeignCallNode) {
ForeignCallNode foreignCall = (ForeignCallNode) node;
if (foreignCall.getBci() == BytecodeFrame.UNKNOWN_BCI && methodScope.invokeData != null) {
foreignCall.setBci(methodScope.invokeData.invoke.bci());
}
}
super.handleFixedNode(methodScope, loopScope, nodeOrderId, node);
}
use of org.graalvm.compiler.nodes.extended.ForeignCallNode in project graal by oracle.
the class GenericArrayCopyCallNode method lower.
@Override
public void lower(LoweringTool tool) {
if (graph().getGuardsStage().areFrameStatesAtDeopts()) {
StructuredGraph graph = graph();
ValueNode srcAddr = objectAddress(getSource());
ValueNode destAddr = objectAddress(getDestination());
ForeignCallNode call = graph.add(new ForeignCallNode(runtime.getHostBackend().getForeignCalls(), HotSpotBackend.GENERIC_ARRAYCOPY, srcAddr, srcPos, destAddr, destPos, length));
call.setStateAfter(stateAfter());
graph.replaceFixedWithFixed(this, call);
}
}
use of org.graalvm.compiler.nodes.extended.ForeignCallNode in project graal by oracle.
the class ForeignCallPlugin method execute.
@Override
public boolean execute(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode[] args) {
ForeignCallNode foreignCall = new ForeignCallNode(foreignCalls, descriptor, args);
foreignCall.setBci(b.bci());
b.addPush(targetMethod.getSignature().getReturnKind(), foreignCall);
return true;
}
use of org.graalvm.compiler.nodes.extended.ForeignCallNode in project graal by oracle.
the class LoopSafepointEliminationPhase method run.
@Override
protected void run(StructuredGraph graph, MidTierContext context) {
LoopsData loops = new LoopsData(graph);
if (context.getOptimisticOptimizations().useLoopLimitChecks(graph.getOptions()) && graph.getGuardsStage().allowsFloatingGuards()) {
loops.detectedCountedLoops();
for (LoopEx loop : loops.countedLoops()) {
if (loop.loop().getChildren().isEmpty() && loop.counted().getStamp().getBits() <= 32) {
boolean hasSafepoint = false;
for (LoopEndNode loopEnd : loop.loopBegin().loopEnds()) {
hasSafepoint |= loopEnd.canSafepoint();
}
if (hasSafepoint) {
loop.counted().createOverFlowGuard();
loop.loopBegin().disableSafepoint();
}
}
}
}
for (LoopEx loop : loops.loops()) {
for (LoopEndNode loopEnd : loop.loopBegin().loopEnds()) {
Block b = loops.getCFG().blockFor(loopEnd);
blocks: while (b != loop.loop().getHeader()) {
assert b != null;
for (FixedNode node : b.getNodes()) {
if (node instanceof Invoke || (node instanceof ForeignCallNode && ((ForeignCallNode) node).isGuaranteedSafepoint())) {
loopEnd.disableSafepoint();
break blocks;
}
}
b = b.getDominator();
}
}
}
loops.deleteUnusedNodes();
}
Aggregations