Search in sources :

Example 1 with CStringConstant

use of org.graalvm.compiler.replacements.nodes.CStringConstant in project graal by oracle.

the class VMErrorNode method generate.

@Override
public void generate(NodeLIRBuilderTool gen) {
    String whereString;
    if (stateBefore() != null) {
        String nl = CodeUtil.NEW_LINE;
        StringBuilder sb = new StringBuilder("in compiled code associated with frame state:");
        FrameState fs = stateBefore();
        while (fs != null) {
            Bytecode.appendLocation(sb.append(nl).append("\t"), fs.getCode(), fs.bci);
            fs = fs.outerFrameState();
        }
        whereString = sb.toString();
    } else {
        ResolvedJavaMethod method = graph().method();
        whereString = "in compiled code for " + (method == null ? graph().toString() : method.format("%H.%n(%p)"));
    }
    LIRKind wordKind = gen.getLIRGeneratorTool().getLIRKind(StampFactory.pointer());
    Value whereArg = gen.getLIRGeneratorTool().emitConstant(wordKind, new CStringConstant(whereString));
    Value formatArg = gen.getLIRGeneratorTool().emitConstant(wordKind, new CStringConstant(format));
    ForeignCallLinkage linkage = gen.getLIRGeneratorTool().getForeignCalls().lookupForeignCall(VM_ERROR);
    gen.getLIRGeneratorTool().emitForeignCall(linkage, null, whereArg, formatArg, gen.operand(value));
}
Also used : Value(jdk.vm.ci.meta.Value) LIRKind(org.graalvm.compiler.core.common.LIRKind) ForeignCallLinkage(org.graalvm.compiler.core.common.spi.ForeignCallLinkage) FrameState(org.graalvm.compiler.nodes.FrameState) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) CStringConstant(org.graalvm.compiler.replacements.nodes.CStringConstant)

Aggregations

ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)1 Value (jdk.vm.ci.meta.Value)1 LIRKind (org.graalvm.compiler.core.common.LIRKind)1 ForeignCallLinkage (org.graalvm.compiler.core.common.spi.ForeignCallLinkage)1 FrameState (org.graalvm.compiler.nodes.FrameState)1 CStringConstant (org.graalvm.compiler.replacements.nodes.CStringConstant)1