Search in sources :

Example 6 with IntrinsicContext

use of org.graalvm.compiler.nodes.graphbuilderconf.IntrinsicContext in project graal by oracle.

the class CachingPEGraphDecoder method createGraph.

@SuppressWarnings("try")
private EncodedGraph createGraph(ResolvedJavaMethod method, ResolvedJavaMethod originalMethod, BytecodeProvider intrinsicBytecodeProvider) {
    StructuredGraph graphToEncode = new StructuredGraph.Builder(options, debug, allowAssumptions).useProfilingInfo(false).trackNodeSourcePosition(graphBuilderConfig.trackNodeSourcePosition()).method(method).build();
    try (DebugContext.Scope scope = debug.scope("createGraph", graphToEncode)) {
        IntrinsicContext initialIntrinsicContext = intrinsicBytecodeProvider != null ? new IntrinsicContext(originalMethod, method, intrinsicBytecodeProvider, INLINE_AFTER_PARSING) : null;
        GraphBuilderPhase.Instance graphBuilderPhaseInstance = createGraphBuilderPhaseInstance(initialIntrinsicContext);
        graphBuilderPhaseInstance.apply(graphToEncode);
        PhaseContext context = new PhaseContext(providers);
        new CanonicalizerPhase().apply(graphToEncode, context);
        /*
             * ConvertDeoptimizeToGuardPhase reduces the number of merges in the graph, so that
             * fewer frame states will be created. This significantly reduces the number of nodes in
             * the initial graph.
             */
        new ConvertDeoptimizeToGuardPhase().apply(graphToEncode, context);
        EncodedGraph encodedGraph = GraphEncoder.encodeSingleGraph(graphToEncode, architecture);
        graphCache.put(method, encodedGraph);
        return encodedGraph;
    } catch (Throwable ex) {
        throw debug.handle(ex);
    }
}
Also used : PhaseContext(org.graalvm.compiler.phases.tiers.PhaseContext) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) EncodedGraph(org.graalvm.compiler.nodes.EncodedGraph) IntrinsicContext(org.graalvm.compiler.nodes.graphbuilderconf.IntrinsicContext) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) DebugContext(org.graalvm.compiler.debug.DebugContext) GraphBuilderPhase(org.graalvm.compiler.java.GraphBuilderPhase) ConvertDeoptimizeToGuardPhase(org.graalvm.compiler.phases.common.ConvertDeoptimizeToGuardPhase)

Aggregations

IntrinsicContext (org.graalvm.compiler.nodes.graphbuilderconf.IntrinsicContext)6 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)5 DebugContext (org.graalvm.compiler.debug.DebugContext)4 GraphBuilderPhase (org.graalvm.compiler.java.GraphBuilderPhase)4 GraphBuilderConfiguration (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration)4 MetaAccessProvider (jdk.vm.ci.meta.MetaAccessProvider)3 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)3 Plugins (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)3 Bytecode (org.graalvm.compiler.bytecode.Bytecode)2 DeoptimizeNode (org.graalvm.compiler.nodes.DeoptimizeNode)2 ParameterNode (org.graalvm.compiler.nodes.ParameterNode)2 MethodCallTargetNode (org.graalvm.compiler.nodes.java.MethodCallTargetNode)2 CanonicalizerPhase (org.graalvm.compiler.phases.common.CanonicalizerPhase)2 PhaseContext (org.graalvm.compiler.phases.tiers.PhaseContext)2 String.format (java.lang.String.format)1 STATIC (java.lang.reflect.Modifier.STATIC)1 SYNCHRONIZED (java.lang.reflect.Modifier.SYNCHRONIZED)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1