use of org.graalvm.compiler.core.common.PermanentBailoutException in project graal by oracle.
the class BytecodeParser method bailout.
@Override
public BailoutException bailout(String string) {
FrameState currentFrameState = createFrameState(bci(), null);
StackTraceElement[] elements = GraphUtil.approxSourceStackTraceElement(currentFrameState);
BailoutException bailout = new PermanentBailoutException(string);
throw GraphUtil.createBailoutException(string, bailout, elements);
}
use of org.graalvm.compiler.core.common.PermanentBailoutException in project graal by oracle.
the class FrameStateBuilder method isCompatibleWith.
public boolean isCompatibleWith(FrameStateBuilder other) {
assert code.equals(other.code) && graph == other.graph && localsSize() == other.localsSize() : "Can only compare frame states of the same method";
assert lockedObjects.length == monitorIds.length && other.lockedObjects.length == other.monitorIds.length : "mismatch between lockedObjects and monitorIds";
if (stackSize() != other.stackSize()) {
return false;
}
for (int i = 0; i < stackSize(); i++) {
ValueNode x = stack[i];
ValueNode y = other.stack[i];
assert x != null && y != null;
if (x != y && (x == TWO_SLOT_MARKER || x.isDeleted() || y == TWO_SLOT_MARKER || y.isDeleted() || x.getStackKind() != y.getStackKind())) {
return false;
}
}
if (lockedObjects.length != other.lockedObjects.length) {
return false;
}
for (int i = 0; i < lockedObjects.length; i++) {
if (GraphUtil.originalValue(lockedObjects[i]) != GraphUtil.originalValue(other.lockedObjects[i]) || monitorIds[i] != other.monitorIds[i]) {
throw new PermanentBailoutException("unbalanced monitors");
}
}
return true;
}
use of org.graalvm.compiler.core.common.PermanentBailoutException in project graal by oracle.
the class MethodTypeFlowBuilder method parse.
@SuppressWarnings("try")
private boolean parse() {
OptionValues options = bb.getOptions();
DebugContext debug = DebugContext.create(options, new GraalDebugHandlersFactory(bb.getProviders().getSnippetReflection()));
try (Indent indent = debug.logAndIndent("parse graph %s", method)) {
boolean needParsing = false;
graph = method.buildGraph(debug, method, bb.getProviders(), Purpose.ANALYSIS);
if (graph == null) {
InvocationPlugin plugin = bb.getProviders().getGraphBuilderPlugins().getInvocationPlugins().lookupInvocation(method);
if (plugin != null && !plugin.inlineOnly()) {
Bytecode code = new ResolvedJavaMethodBytecode(method);
graph = new SubstrateIntrinsicGraphBuilder(options, debug, bb.getProviders().getMetaAccess(), bb.getProviders().getConstantReflection(), bb.getProviders().getConstantFieldProvider(), bb.getProviders().getStampProvider(), code).buildGraph(plugin);
}
}
if (graph == null) {
if (!method.hasBytecodes()) {
return false;
}
needParsing = true;
graph = new StructuredGraph.Builder(options, debug).method(method).build();
}
try (DebugContext.Scope s = debug.scope("ClosedWorldAnalysis", graph, method, this)) {
// enable this logging to get log output in compilation passes
try (Indent indent2 = debug.logAndIndent("parse graph phases")) {
if (needParsing) {
GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(bb.getProviders().getGraphBuilderPlugins()).withEagerResolving(true).withUnresolvedIsError(PointstoOptions.UnresolvedIsError.getValue(bb.getOptions())).withNodeSourcePosition(true).withBytecodeExceptionMode(BytecodeExceptionMode.CheckAll);
bb.getHostVM().createGraphBuilderPhase(bb.getProviders(), config, OptimisticOptimizations.NONE, null).apply(graph);
}
} catch (PermanentBailoutException ex) {
bb.getUnsupportedFeatures().addMessage(method.format("%H.%n(%p)"), method, ex.getLocalizedMessage(), null, ex);
return false;
}
// Register used types and fields before canonicalization can optimize them.
registerUsedElements(bb, graph, methodFlow);
new CanonicalizerPhase().apply(graph, new PhaseContext(bb.getProviders()));
// Do it again after canonicalization changed type checks and field accesses.
registerUsedElements(bb, graph, methodFlow);
} catch (Throwable e) {
throw debug.handle(e);
}
}
return true;
}
use of org.graalvm.compiler.core.common.PermanentBailoutException in project graal by oracle.
the class OnStackReplacementPhase method getEntryMarker.
private static EntryMarkerNode getEntryMarker(StructuredGraph graph) {
NodeIterable<EntryMarkerNode> osrNodes = graph.getNodes(EntryMarkerNode.TYPE);
EntryMarkerNode osr = osrNodes.first();
if (osr == null) {
throw new PermanentBailoutException("No OnStackReplacementNode generated");
}
if (osrNodes.count() > 1) {
throw new GraalError("Multiple OnStackReplacementNodes generated");
}
if (osr.stateAfter().stackSize() != 0) {
throw new PermanentBailoutException("OSR with stack entries not supported: %s", osr.stateAfter().toString(Verbosity.Debugger));
}
return osr;
}
use of org.graalvm.compiler.core.common.PermanentBailoutException in project graal by oracle.
the class LoadConstantIndirectlyFixedNode method generate.
@Override
public void generate(NodeLIRBuilderTool gen) {
assert constant != null : "Expected the value to fold: " + value;
Value result;
if (constant instanceof HotSpotObjectConstant) {
result = ((HotSpotLIRGenerator) gen.getLIRGeneratorTool()).emitLoadObjectAddress(constant);
} else if (constant instanceof HotSpotMetaspaceConstant) {
result = ((HotSpotLIRGenerator) gen.getLIRGeneratorTool()).emitLoadMetaspaceAddress(constant, action);
} else {
throw new PermanentBailoutException("Unsupported constant type: " + constant);
}
gen.setResult(this, result);
}
Aggregations