Search in sources :

Example 11 with PermanentBailoutException

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);
}
Also used : PermanentBailoutException(org.graalvm.compiler.core.common.PermanentBailoutException) BailoutException(jdk.vm.ci.code.BailoutException) FrameState(org.graalvm.compiler.nodes.FrameState) PermanentBailoutException(org.graalvm.compiler.core.common.PermanentBailoutException)

Example 12 with PermanentBailoutException

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;
}
Also used : ValueNode(org.graalvm.compiler.nodes.ValueNode) PermanentBailoutException(org.graalvm.compiler.core.common.PermanentBailoutException)

Example 13 with PermanentBailoutException

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;
}
Also used : Indent(org.graalvm.compiler.debug.Indent) OptionValues(org.graalvm.compiler.options.OptionValues) SubstrateIntrinsicGraphBuilder(com.oracle.graal.pointsto.phases.SubstrateIntrinsicGraphBuilder) GraphBuilderConfiguration(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration) DebugContext(org.graalvm.compiler.debug.DebugContext) GraalDebugHandlersFactory(org.graalvm.compiler.printer.GraalDebugHandlersFactory) PhaseContext(org.graalvm.compiler.phases.tiers.PhaseContext) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) InvocationPlugin(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin) ResolvedJavaMethodBytecode(org.graalvm.compiler.bytecode.ResolvedJavaMethodBytecode) Bytecode(org.graalvm.compiler.bytecode.Bytecode) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) ResolvedJavaMethodBytecode(org.graalvm.compiler.bytecode.ResolvedJavaMethodBytecode) PermanentBailoutException(org.graalvm.compiler.core.common.PermanentBailoutException)

Example 14 with PermanentBailoutException

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;
}
Also used : EntryMarkerNode(org.graalvm.compiler.nodes.EntryMarkerNode) GraalError(org.graalvm.compiler.debug.GraalError) PermanentBailoutException(org.graalvm.compiler.core.common.PermanentBailoutException)

Example 15 with PermanentBailoutException

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);
}
Also used : HotSpotLIRGenerator(org.graalvm.compiler.hotspot.HotSpotLIRGenerator) Value(jdk.vm.ci.meta.Value) HotSpotObjectConstant(jdk.vm.ci.hotspot.HotSpotObjectConstant) HotSpotMetaspaceConstant(jdk.vm.ci.hotspot.HotSpotMetaspaceConstant) PermanentBailoutException(org.graalvm.compiler.core.common.PermanentBailoutException)

Aggregations

PermanentBailoutException (org.graalvm.compiler.core.common.PermanentBailoutException)17 Value (jdk.vm.ci.meta.Value)5 HotSpotMetaspaceConstant (jdk.vm.ci.hotspot.HotSpotMetaspaceConstant)4 HotSpotObjectConstant (jdk.vm.ci.hotspot.HotSpotObjectConstant)3 DebugContext (org.graalvm.compiler.debug.DebugContext)3 GraalError (org.graalvm.compiler.debug.GraalError)3 Indent (org.graalvm.compiler.debug.Indent)3 HotSpotLIRGenerator (org.graalvm.compiler.hotspot.HotSpotLIRGenerator)3 ArrayDeque (java.util.ArrayDeque)2 ArrayList (java.util.ArrayList)2 BitSet (java.util.BitSet)2 StackSlot (jdk.vm.ci.code.StackSlot)2 ValueUtil.asStackSlot (jdk.vm.ci.code.ValueUtil.asStackSlot)2 JavaConstant (jdk.vm.ci.meta.JavaConstant)2 FixedNode (org.graalvm.compiler.nodes.FixedNode)2 Block (org.graalvm.compiler.nodes.cfg.Block)2 SubstrateIntrinsicGraphBuilder (com.oracle.graal.pointsto.phases.SubstrateIntrinsicGraphBuilder)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 DataOutputStream (java.io.DataOutputStream)1 EnumSet (java.util.EnumSet)1