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