Search in sources :

Example 1 with ForeignCallWithExceptionNode

use of org.graalvm.compiler.nodes.extended.ForeignCallWithExceptionNode in project graal by oracle.

the class NodeLIRBuilder method emitForeignCall.

@Override
public void emitForeignCall(ForeignCall x) {
    ForeignCallLinkage linkage = gen.getForeignCalls().lookupForeignCall(x.getDescriptor());
    LabelRef exceptionEdge = null;
    if (x instanceof ForeignCallWithExceptionNode) {
        exceptionEdge = getLIRBlock(((ForeignCallWithExceptionNode) x).exceptionEdge());
    }
    LIRFrameState callState = stateWithExceptionEdge(x, exceptionEdge);
    Value[] args = x.operands(this);
    Value result = gen.emitForeignCall(linkage, callState, args);
    if (result != null) {
        setResult(x.asNode(), result);
    }
    if (x instanceof ForeignCallWithExceptionNode) {
        gen.emitJump(getLIRBlock(((ForeignCallWithExceptionNode) x).next()));
    }
}
Also used : LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) ComplexMatchValue(org.graalvm.compiler.core.match.ComplexMatchValue) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) ForeignCallWithExceptionNode(org.graalvm.compiler.nodes.extended.ForeignCallWithExceptionNode) ForeignCallLinkage(org.graalvm.compiler.core.common.spi.ForeignCallLinkage) LabelRef(org.graalvm.compiler.lir.LabelRef)

Example 2 with ForeignCallWithExceptionNode

use of org.graalvm.compiler.nodes.extended.ForeignCallWithExceptionNode in project graal by oracle.

the class NodeLLVMBuilder method emitForeignCall.

@Override
public void emitForeignCall(ForeignCall i) {
    ForeignCallLinkage linkage = gen.getForeignCalls().lookupForeignCall(i.getDescriptor());
    LIRFrameState state = state(i);
    Value[] args = i.operands(this);
    Value result = null;
    if (i instanceof ForeignCallNode) {
        result = gen.emitForeignCall(linkage, state, args);
    } else if (i instanceof ForeignCallWithExceptionNode) {
        ForeignCallWithExceptionNode foreignCallWithExceptionNode = (ForeignCallWithExceptionNode) i;
        LLVMBasicBlockRef successor = gen.getBlock(foreignCallWithExceptionNode.next());
        LLVMBasicBlockRef handler = gen.getBlock(foreignCallWithExceptionNode.exceptionEdge());
        result = gen.emitForeignCall(linkage, state, successor, handler, args);
    } else {
        throw shouldNotReachHere();
    }
    if (result != null) {
        setResult(i.asNode(), result);
    }
}
Also used : LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) ForeignCallNode(org.graalvm.compiler.nodes.extended.ForeignCallNode) LLVMBasicBlockRef(com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMBasicBlockRef) ConstantValue(org.graalvm.compiler.lir.ConstantValue) LLVMAddressValue(com.oracle.svm.core.graal.llvm.lowering.LLVMAddressLowering.LLVMAddressValue) Value(jdk.vm.ci.meta.Value) RegisterValue(jdk.vm.ci.code.RegisterValue) ForeignCallWithExceptionNode(org.graalvm.compiler.nodes.extended.ForeignCallWithExceptionNode) ForeignCallLinkage(org.graalvm.compiler.core.common.spi.ForeignCallLinkage)

Aggregations

Value (jdk.vm.ci.meta.Value)2 ForeignCallLinkage (org.graalvm.compiler.core.common.spi.ForeignCallLinkage)2 LIRFrameState (org.graalvm.compiler.lir.LIRFrameState)2 ForeignCallWithExceptionNode (org.graalvm.compiler.nodes.extended.ForeignCallWithExceptionNode)2 LLVMAddressValue (com.oracle.svm.core.graal.llvm.lowering.LLVMAddressLowering.LLVMAddressValue)1 LLVMBasicBlockRef (com.oracle.svm.shadowed.org.bytedeco.llvm.LLVM.LLVMBasicBlockRef)1 RegisterValue (jdk.vm.ci.code.RegisterValue)1 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)1 ComplexMatchValue (org.graalvm.compiler.core.match.ComplexMatchValue)1 ConstantValue (org.graalvm.compiler.lir.ConstantValue)1 LabelRef (org.graalvm.compiler.lir.LabelRef)1 ForeignCallNode (org.graalvm.compiler.nodes.extended.ForeignCallNode)1