Search in sources :

Example 11 with GraphBuilderConfiguration

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

the class PEGraphDecoderTest method test.

@Test
@SuppressWarnings("try")
public void test() {
    ResolvedJavaMethod testMethod = getResolvedJavaMethod(PEGraphDecoderTest.class, "doTest", Object.class);
    StructuredGraph targetGraph = null;
    DebugContext debug = getDebugContext();
    try (DebugContext.Scope scope = debug.scope("GraphPETest", testMethod)) {
        GraphBuilderConfiguration graphBuilderConfig = GraphBuilderConfiguration.getDefault(getDefaultGraphBuilderPlugins()).withEagerResolving(true).withUnresolvedIsError(true);
        registerPlugins(graphBuilderConfig.getPlugins().getInvocationPlugins());
        targetGraph = new StructuredGraph.Builder(getInitialOptions(), debug, AllowAssumptions.YES).method(testMethod).build();
        CachingPEGraphDecoder decoder = new CachingPEGraphDecoder(getTarget().arch, targetGraph, getProviders(), graphBuilderConfig, OptimisticOptimizations.NONE, AllowAssumptions.YES, null, null, new InlineInvokePlugin[] { new InlineAll() }, null, null, null, null);
        decoder.decode(testMethod, false);
        debug.dump(DebugContext.BASIC_LEVEL, targetGraph, "Target Graph");
        targetGraph.verify();
        PhaseContext context = new PhaseContext(getProviders());
        new CanonicalizerPhase().apply(targetGraph, context);
        targetGraph.verify();
    } catch (Throwable ex) {
        if (targetGraph != null) {
            debug.dump(DebugContext.BASIC_LEVEL, targetGraph, ex.toString());
        }
        debug.handle(ex);
    }
}
Also used : PhaseContext(org.graalvm.compiler.phases.tiers.PhaseContext) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) GraphBuilderConfiguration(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) DebugContext(org.graalvm.compiler.debug.DebugContext) CachingPEGraphDecoder(org.graalvm.compiler.replacements.CachingPEGraphDecoder) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest) Test(org.junit.Test)

Example 12 with GraphBuilderConfiguration

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

the class Target_com_oracle_truffle_api_interop_java_ObjectProxyHandler method beforeAnalysis.

@SuppressWarnings("deprecation")
@Override
public void beforeAnalysis(BeforeAnalysisAccess access) {
    BeforeAnalysisAccessImpl config = (BeforeAnalysisAccessImpl) access;
    getLanguageClasses().forEach(config::registerForReflectiveInstantiation);
    config.registerHierarchyForReflectiveInstantiation(TruffleInstrument.class);
    config.registerHierarchyForReflectiveInstantiation(com.oracle.truffle.api.instrumentation.InstrumentableFactory.class);
    if (useTruffleCompiler()) {
        SubstrateTruffleRuntime truffleRuntime = (SubstrateTruffleRuntime) Truffle.getRuntime();
        GraalFeature graalFeature = ImageSingletons.lookup(GraalFeature.class);
        SnippetReflectionProvider snippetReflection = graalFeature.getHostedProviders().getSnippetReflection();
        SubstrateTruffleCompiler truffleCompiler = truffleRuntime.initTruffleCompiler();
        truffleRuntime.lookupCallMethods(config.getMetaAccess());
        PartialEvaluator partialEvaluator = truffleCompiler.getPartialEvaluator();
        registerKnownTruffleFields(config, partialEvaluator.getKnownTruffleTypes());
        support.registerInterpreterEntryMethodsAsCompiled(partialEvaluator, access);
        GraphBuilderConfiguration graphBuilderConfig = partialEvaluator.getConfigForParsing();
        if (Options.TruffleInlineDuringParsing.getValue()) {
            graphBuilderConfig.getPlugins().appendInlineInvokePlugin(new TruffleParsingInlineInvokePlugin(graalFeature.getHostedProviders().getReplacements(), graphBuilderConfig.getPlugins().getInvocationPlugins(), partialEvaluator, method -> includeCallee(method, null, null)));
        }
        registerNeverPartOfCompilation(graphBuilderConfig.getPlugins().getInvocationPlugins());
        graphBuilderConfig.getPlugins().getInvocationPlugins().closeRegistration();
        HostedProviders newHostedProviders = new HostedProviders(partialEvaluator.getProviders().getMetaAccess(), partialEvaluator.getProviders().getCodeCache(), partialEvaluator.getProviders().getConstantReflection(), new HostedTruffleConstantFieldProvider(partialEvaluator.getProviders().getConstantFieldProvider()), partialEvaluator.getProviders().getForeignCalls(), partialEvaluator.getProviders().getLowerer(), partialEvaluator.getProviders().getReplacements(), partialEvaluator.getProviders().getStampProvider(), snippetReflection, graalFeature.getHostedProviders().getWordTypes());
        newHostedProviders.setGraphBuilderPlugins(graphBuilderConfig.getPlugins());
        graalFeature.initializeRuntimeCompilationConfiguration(newHostedProviders, graphBuilderConfig, this::includeCallee, this::deoptimizeOnException);
        for (ResolvedJavaMethod method : partialEvaluator.getCompilationRootMethods()) {
            graalFeature.prepareMethodForRuntimeCompilation(method, config);
        }
        initializeMethodBlacklist(config.getMetaAccess());
        /*
             * Stack frames that are visited by Truffle-level stack walking must have full frame
             * information available, otherwise SubstrateStackIntrospection cannot visit them.
             */
        for (ResolvedJavaMethod method : truffleRuntime.getAnyFrameMethod()) {
            graalFeature.requireFrameInformationForMethod(method);
            /*
                 * To avoid corner case errors, we also force compilation of these methods. This
                 * only affects builds where no Truffle language is included, because any real
                 * language makes these methods reachable (and therefore compiled).
                 */
            config.registerAsCompiled((AnalysisMethod) method);
        }
    }
    firstAnalysisRun = true;
}
Also used : BeforeAnalysisAccessImpl(com.oracle.svm.hosted.FeatureImpl.BeforeAnalysisAccessImpl) BeforeAnalysisAccessImpl(com.oracle.svm.hosted.FeatureImpl.BeforeAnalysisAccessImpl) HostedProviders(com.oracle.graal.pointsto.meta.HostedProviders) Arrays(java.util.Arrays) ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType) KnownTruffleTypes(org.graalvm.compiler.truffle.compiler.substitutions.KnownTruffleTypes) ResolvedJavaField(jdk.vm.ci.meta.ResolvedJavaField) BooleanSupplier(java.util.function.BooleanSupplier) InlineInfo.createStandardInlineInfo(org.graalvm.compiler.nodes.graphbuilderconf.InlineInvokePlugin.InlineInfo.createStandardInlineInfo) BigDecimal(java.math.BigDecimal) Vector(java.util.Vector) CompilerDirectives(com.oracle.truffle.api.CompilerDirectives) SubstrateTruffleCompiler(com.oracle.svm.truffle.api.SubstrateTruffleCompiler) Deoptimizer(com.oracle.svm.core.deopt.Deoptimizer) Map(java.util.Map) RootNode(com.oracle.truffle.api.nodes.RootNode) Executable(java.lang.reflect.Executable) BigInteger(java.math.BigInteger) TruffleCallBoundary(org.graalvm.compiler.truffle.runtime.TruffleCallBoundary) Alias(com.oracle.svm.core.annotate.Alias) JavaStackWalker(com.oracle.svm.core.stack.JavaStackWalker) FilesFeature(com.oracle.svm.core.jdk.FilesFeature) Set(java.util.Set) FilesSupport(com.oracle.svm.core.jdk.FilesSupport) AnalysisField(com.oracle.graal.pointsto.meta.AnalysisField) GraphBuilderContext(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext) HostedOptionValues(com.oracle.svm.core.option.HostedOptionValues) MetaAccessProvider(jdk.vm.ci.meta.MetaAccessProvider) GraphBuilderConfiguration(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration) GraalFeature(com.oracle.svm.graal.hosted.GraalFeature) InlineDuringParsingMaxDepth(org.graalvm.compiler.java.BytecodeParserOptions.InlineDuringParsingMaxDepth) ConstantNode(org.graalvm.compiler.nodes.ConstantNode) TreeSet(java.util.TreeSet) HostedOptionKey(com.oracle.svm.core.option.HostedOptionKey) InvocationPlugin(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin) AnalysisMethod(com.oracle.graal.pointsto.meta.AnalysisMethod) NeverPartOfCompilationNode(org.graalvm.compiler.truffle.compiler.nodes.asserts.NeverPartOfCompilationNode) TruffleInstrument(com.oracle.truffle.api.instrumentation.TruffleInstrument) SubstratePartialEvaluator(com.oracle.svm.truffle.api.SubstratePartialEvaluator) Field(java.lang.reflect.Field) Replacements(org.graalvm.compiler.nodes.spi.Replacements) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) TreeMap(java.util.TreeMap) RuntimeBytecodeParser(com.oracle.svm.graal.hosted.GraalFeature.RuntimeBytecodeParser) RecomputeFieldValue(com.oracle.svm.core.annotate.RecomputeFieldValue) SubstrateOptimizedCallTarget(com.oracle.svm.truffle.api.SubstrateOptimizedCallTarget) Providers(org.graalvm.compiler.phases.util.Providers) DefaultTruffleRuntime(com.oracle.truffle.api.impl.DefaultTruffleRuntime) ListIterator(java.util.ListIterator) InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) TruffleRuntime(com.oracle.truffle.api.TruffleRuntime) SubstrateTruffleRuntime(com.oracle.svm.truffle.api.SubstrateTruffleRuntime) JavaKind(jdk.vm.ci.meta.JavaKind) Option(org.graalvm.compiler.options.Option) UserError(com.oracle.svm.core.util.UserError) Method(java.lang.reflect.Method) IdentityHashMap(java.util.IdentityHashMap) Predicate(java.util.function.Predicate) Collection(java.util.Collection) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) InstrumentPhase(org.graalvm.compiler.truffle.compiler.phases.InstrumentPhase) OptimizedCallTarget(org.graalvm.compiler.truffle.runtime.OptimizedCallTarget) Collectors(java.util.stream.Collectors) Registration(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration) FileTypeDetector(java.nio.file.spi.FileTypeDetector) TargetClass(com.oracle.svm.core.annotate.TargetClass) VMError(com.oracle.svm.core.util.VMError) ValueNode(org.graalvm.compiler.nodes.ValueNode) CallTreeNode(com.oracle.svm.graal.hosted.GraalFeature.CallTreeNode) List(java.util.List) Modifier(java.lang.reflect.Modifier) SnippetReflectionProvider(org.graalvm.compiler.api.replacements.SnippetReflectionProvider) Optional(java.util.Optional) NeverInline(com.oracle.svm.core.annotate.NeverInline) SubstrateOptionsParser(com.oracle.svm.core.option.SubstrateOptionsParser) InliningUtilities(com.oracle.svm.hosted.code.InliningUtilities) Architecture(jdk.vm.ci.code.Architecture) HashMap(java.util.HashMap) Profile(com.oracle.truffle.api.profiles.Profile) InlineInvokePlugin(org.graalvm.compiler.nodes.graphbuilderconf.InlineInvokePlugin) HashSet(java.util.HashSet) Hashtable(java.util.Hashtable) WeakHashMap(java.util.WeakHashMap) HostedType(com.oracle.svm.hosted.meta.HostedType) CompilerAsserts(com.oracle.truffle.api.CompilerAsserts) ImageSingletons(org.graalvm.nativeimage.ImageSingletons) Iterator(java.util.Iterator) ReentrantLock(java.util.concurrent.locks.ReentrantLock) Feature(org.graalvm.nativeimage.Feature) Heap(com.oracle.svm.core.heap.Heap) Delete(com.oracle.svm.core.annotate.Delete) BeforeCompilationAccessImpl(com.oracle.svm.hosted.FeatureImpl.BeforeCompilationAccessImpl) ExplodeLoop(com.oracle.truffle.api.nodes.ExplodeLoop) Frame(com.oracle.truffle.api.frame.Frame) AfterRegistrationAccessImpl(com.oracle.svm.hosted.FeatureImpl.AfterRegistrationAccessImpl) PartialEvaluator(org.graalvm.compiler.truffle.compiler.PartialEvaluator) Truffle(com.oracle.truffle.api.Truffle) Kind(com.oracle.svm.core.annotate.RecomputeFieldValue.Kind) Comparator(java.util.Comparator) Collections(java.util.Collections) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) GraphBuilderConfiguration(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration) GraalFeature(com.oracle.svm.graal.hosted.GraalFeature) HostedProviders(com.oracle.graal.pointsto.meta.HostedProviders) SubstratePartialEvaluator(com.oracle.svm.truffle.api.SubstratePartialEvaluator) PartialEvaluator(org.graalvm.compiler.truffle.compiler.PartialEvaluator) SnippetReflectionProvider(org.graalvm.compiler.api.replacements.SnippetReflectionProvider) SubstrateTruffleCompiler(com.oracle.svm.truffle.api.SubstrateTruffleCompiler) SubstrateTruffleRuntime(com.oracle.svm.truffle.api.SubstrateTruffleRuntime) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Example 13 with GraphBuilderConfiguration

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

the class GraalCompilerTest method getCustomGraphBuilderSuite.

protected PhaseSuite<HighTierContext> getCustomGraphBuilderSuite(GraphBuilderConfiguration gbConf) {
    PhaseSuite<HighTierContext> suite = getDefaultGraphBuilderSuite();
    ListIterator<BasePhase<? super HighTierContext>> iterator = suite.findPhase(GraphBuilderPhase.class);
    initializeInvocationPluginExtensions();
    GraphBuilderConfiguration gbConfCopy = editGraphBuilderConfiguration(gbConf.copy());
    iterator.remove();
    iterator.add(new GraphBuilderPhase(gbConfCopy));
    return suite;
}
Also used : GraphBuilderConfiguration(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) GraphBuilderPhase(org.graalvm.compiler.java.GraphBuilderPhase) BasePhase(org.graalvm.compiler.phases.BasePhase)

Example 14 with GraphBuilderConfiguration

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

the class IntrinsifyMethodHandlesInvocationPlugin method processInvokeWithMethodHandle.

@SuppressWarnings("try")
private void processInvokeWithMethodHandle(GraphBuilderContext b, BytecodeProvider bytecodeProvider, ResolvedJavaMethod methodHandleMethod, ValueNode[] methodHandleArguments) {
    Plugins graphBuilderPlugins = new Plugins(((ReplacementsImpl) originalProviders.getReplacements()).getGraphBuilderPlugins());
    registerInvocationPlugins(graphBuilderPlugins.getInvocationPlugins(), bytecodeProvider);
    graphBuilderPlugins.prependParameterPlugin(new MethodHandlesParameterPlugin(methodHandleArguments));
    graphBuilderPlugins.clearInlineInvokePlugins();
    graphBuilderPlugins.prependInlineInvokePlugin(new MethodHandlesInlineInvokePlugin());
    graphBuilderPlugins.prependNodePlugin(new MethodHandlePlugin(originalProviders.getConstantReflection().getMethodHandleAccess(), false));
    /* We do all the word type rewriting because parameters to the lambda can be word types. */
    SnippetReflectionProvider originalSnippetReflection = GraalAccess.getOriginalSnippetReflection();
    WordOperationPlugin wordOperationPlugin = new WordOperationPlugin(originalSnippetReflection, new WordTypes(originalProviders.getMetaAccess(), FrameAccess.getWordKind()));
    graphBuilderPlugins.appendInlineInvokePlugin(wordOperationPlugin);
    graphBuilderPlugins.appendTypePlugin(wordOperationPlugin);
    graphBuilderPlugins.appendTypePlugin(new TrustedInterfaceTypePlugin());
    graphBuilderPlugins.appendNodePlugin(wordOperationPlugin);
    GraphBuilderConfiguration graphBuilderConfig = GraphBuilderConfiguration.getSnippetDefault(graphBuilderPlugins);
    GraphBuilderPhase.Instance graphBuilder = new GraphBuilderPhase.Instance(originalProviders.getMetaAccess(), originalProviders.getStampProvider(), originalProviders.getConstantReflection(), originalProviders.getConstantFieldProvider(), graphBuilderConfig, OptimisticOptimizations.NONE, null);
    DebugContext debug = b.getDebug();
    StructuredGraph graph = new StructuredGraph.Builder(b.getOptions(), debug).method(toOriginal(methodHandleMethod)).build();
    try (DebugContext.Scope s = debug.scope("IntrinsifyMethodHandles", graph)) {
        graphBuilder.apply(graph);
        /*
             * We do not care about the improved type information from Pi nodes, so we just delete
             * them to simplify our graph.
             */
        for (PiNode pi : graph.getNodes(PiNode.TYPE)) {
            pi.replaceAndDelete(pi.object());
        }
        /*
             * Support for MethodHandle that adapt the input type to a more generic type, i.e., a
             * MethodHandle that does a dynamic type check on a parameter.
             */
        for (UnaryOpLogicNode node : graph.getNodes().filter(UnaryOpLogicNode.class).filter(v -> v instanceof IsNullNode || v instanceof InstanceOfNode)) {
            ValueNode value = node.getValue();
            if (value instanceof ParameterNode) {
                /*
                     * We just assume that the InstanceOfNode or IsNullNode are used in an If and
                     * the true-successor is actually the branch we want. If that assumption is
                     * wrong, nothing bad happens - we will just continue to report the invocation
                     * as unsupported because the updated stamp for the parameter will not simplify
                     * the graph.
                     */
                if (node instanceof InstanceOfNode) {
                    InstanceOfNode inst = (InstanceOfNode) node;
                    TypeReference typeRef = inst.type();
                    value.setStamp(new ObjectStamp(typeRef.getType(), typeRef.isExact(), !inst.allowsNull(), false));
                } else {
                    assert node instanceof IsNullNode;
                    ResolvedJavaType type = value.stamp(NodeView.DEFAULT).javaType(originalProviders.getMetaAccess());
                    value.setStamp(new ObjectStamp(type, false, /* non-null */
                    true, false));
                }
            }
        }
        /*
             * The canonicalizer converts unsafe field accesses for get/set method handles back to
             * high-level field load and store nodes.
             */
        new CanonicalizerPhase().apply(graph, new PhaseContext(originalProviders));
        for (FixedGuardNode guard : graph.getNodes(FixedGuardNode.TYPE)) {
            if (guard.next() instanceof AccessFieldNode && guard.condition() instanceof IsNullNode && guard.isNegated() && ((IsNullNode) guard.condition()).getValue() == ((AccessFieldNode) guard.next()).object()) {
                /*
                     * Method handles to load and stores fields have null checks. Remove them, since
                     * the null check is implicitly done by the field access.
                     */
                GraphUtil.removeFixedWithUnusedInputs(guard);
            }
        }
        debug.dump(DebugContext.VERY_DETAILED_LEVEL, graph, "Final intrinisfication graph");
        /*
             * After parsing (and recursive inlining during parsing), the graph must contain only
             * one invocation (and therefore only one MethodCallTargetNode), plus the parameters,
             * constants, start, and return nodes.
             */
        Node singleFunctionality = null;
        ReturnNode singleReturn = null;
        for (Node node : graph.getNodes()) {
            if (node == graph.start() || node instanceof ParameterNode || node instanceof ConstantNode || node instanceof FrameState) {
                /* Ignore the allowed framework around the nodes we care about. */
                continue;
            } else if (node instanceof Invoke) {
                /* We check the MethodCallTargetNode, so we can ignore the invoke. */
                continue;
            } else if ((node instanceof MethodCallTargetNode || node instanceof LoadFieldNode || node instanceof StoreFieldNode) && singleFunctionality == null) {
                singleFunctionality = node;
                continue;
            } else if (node instanceof ReturnNode && singleReturn == null) {
                singleReturn = (ReturnNode) node;
                continue;
            }
            throw new UnsupportedFeatureException("Invoke with MethodHandle argument could not be reduced to at most a single call: " + methodHandleMethod.format("%H.%n(%p)"));
        }
        if (singleFunctionality instanceof MethodCallTargetNode) {
            MethodCallTargetNode singleCallTarget = (MethodCallTargetNode) singleFunctionality;
            assert singleReturn.result() == null || singleReturn.result() == singleCallTarget.invoke();
            /*
                 * Replace the originalTarget with the replacementTarget. Note that the
                 * replacementTarget node belongs to a different graph than originalTarget, so we
                 * need to match parameter back to the original graph and allocate a new
                 * MethodCallTargetNode for the original graph.
                 */
            ValueNode[] replacedArguments = new ValueNode[singleCallTarget.arguments().size()];
            for (int i = 0; i < replacedArguments.length; i++) {
                replacedArguments[i] = lookup(b, methodHandleArguments, singleCallTarget.arguments().get(i));
            }
            b.handleReplacedInvoke(singleCallTarget.invokeKind(), lookup(singleCallTarget.targetMethod()), replacedArguments, false);
        } else if (singleFunctionality instanceof LoadFieldNode) {
            LoadFieldNode fieldLoad = (LoadFieldNode) singleFunctionality;
            b.addPush(b.getInvokeReturnType().getJavaKind(), LoadFieldNode.create(null, lookup(b, methodHandleArguments, fieldLoad.object()), lookup(fieldLoad.field())));
        } else if (singleFunctionality instanceof StoreFieldNode) {
            StoreFieldNode fieldStore = (StoreFieldNode) singleFunctionality;
            b.add(new StoreFieldNode(lookup(b, methodHandleArguments, fieldStore.object()), lookup(fieldStore.field()), lookup(b, methodHandleArguments, fieldStore.value())));
        } else if (singleReturn.result() != null) {
            /* Replace the invocation with he constant result. */
            JavaConstant constantResult = singleReturn.result().asJavaConstant();
            assert b.getInvokeReturnType().getJavaKind() == constantResult.getJavaKind();
            b.addPush(constantResult.getJavaKind(), ConstantNode.forConstant(lookup(constantResult), universeProviders.getMetaAccess()));
        } else {
            /* No invoke and no return value, so nothing to do. */
            assert b.getInvokeReturnType().getJavaKind() == JavaKind.Void;
        }
    } catch (Throwable ex) {
        throw debug.handle(ex);
    }
}
Also used : ObjectStamp(org.graalvm.compiler.core.common.type.ObjectStamp) MethodCallTargetNode(org.graalvm.compiler.nodes.java.MethodCallTargetNode) AccessFieldNode(org.graalvm.compiler.nodes.java.AccessFieldNode) ReturnNode(org.graalvm.compiler.nodes.ReturnNode) FixedGuardNode(org.graalvm.compiler.nodes.FixedGuardNode) PiNode(org.graalvm.compiler.nodes.PiNode) UnaryOpLogicNode(org.graalvm.compiler.nodes.UnaryOpLogicNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) IsNullNode(org.graalvm.compiler.nodes.calc.IsNullNode) FloatingNode(org.graalvm.compiler.nodes.calc.FloatingNode) LoadFieldNode(org.graalvm.compiler.nodes.java.LoadFieldNode) ConstantNode(org.graalvm.compiler.nodes.ConstantNode) InstanceOfNode(org.graalvm.compiler.nodes.java.InstanceOfNode) ParameterNode(org.graalvm.compiler.nodes.ParameterNode) StoreFieldNode(org.graalvm.compiler.nodes.java.StoreFieldNode) Node(org.graalvm.compiler.graph.Node) WordTypes(org.graalvm.compiler.word.WordTypes) JavaConstant(jdk.vm.ci.meta.JavaConstant) PiNode(org.graalvm.compiler.nodes.PiNode) FrameState(org.graalvm.compiler.nodes.FrameState) UnaryOpLogicNode(org.graalvm.compiler.nodes.UnaryOpLogicNode) ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType) Invoke(org.graalvm.compiler.nodes.Invoke) PhaseContext(org.graalvm.compiler.phases.tiers.PhaseContext) SnippetReflectionProvider(org.graalvm.compiler.api.replacements.SnippetReflectionProvider) ConstantNode(org.graalvm.compiler.nodes.ConstantNode) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) ParameterNode(org.graalvm.compiler.nodes.ParameterNode) TypeReference(org.graalvm.compiler.core.common.type.TypeReference) GraphBuilderPhase(org.graalvm.compiler.java.GraphBuilderPhase) InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) Plugins(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins) StoreFieldNode(org.graalvm.compiler.nodes.java.StoreFieldNode) UnsupportedFeatureException(com.oracle.graal.pointsto.constraints.UnsupportedFeatureException) GraphBuilderConfiguration(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration) DebugContext(org.graalvm.compiler.debug.DebugContext) LoadFieldNode(org.graalvm.compiler.nodes.java.LoadFieldNode) TrustedInterfaceTypePlugin(com.oracle.svm.core.graal.phases.TrustedInterfaceTypePlugin) FixedGuardNode(org.graalvm.compiler.nodes.FixedGuardNode) ReturnNode(org.graalvm.compiler.nodes.ReturnNode) MethodCallTargetNode(org.graalvm.compiler.nodes.java.MethodCallTargetNode) IsNullNode(org.graalvm.compiler.nodes.calc.IsNullNode) AccessFieldNode(org.graalvm.compiler.nodes.java.AccessFieldNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) InstanceOfNode(org.graalvm.compiler.nodes.java.InstanceOfNode) MethodHandlePlugin(org.graalvm.compiler.replacements.MethodHandlePlugin) WordOperationPlugin(org.graalvm.compiler.word.WordOperationPlugin)

Example 15 with GraphBuilderConfiguration

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

the class PartialEvaluator method createGraphBuilderConfig.

protected GraphBuilderConfiguration createGraphBuilderConfig(GraphBuilderConfiguration config, boolean canDelayIntrinsification) {
    GraphBuilderConfiguration newConfig = config.copy();
    InvocationPlugins invocationPlugins = newConfig.getPlugins().getInvocationPlugins();
    registerTruffleInvocationPlugins(invocationPlugins, canDelayIntrinsification);
    boolean mustInstrumentBranches = TruffleCompilerOptions.getValue(TruffleInstrumentBranches) || TruffleCompilerOptions.getValue(TruffleInstrumentBoundaries);
    return newConfig.withNodeSourcePosition(newConfig.trackNodeSourcePosition() || mustInstrumentBranches || TruffleCompilerOptions.getValue(TraceTrufflePerformanceWarnings));
}
Also used : InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) GraphBuilderConfiguration(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration)

Aggregations

GraphBuilderConfiguration (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration)21 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)16 GraphBuilderPhase (org.graalvm.compiler.java.GraphBuilderPhase)15 Plugins (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)12 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)11 DebugContext (org.graalvm.compiler.debug.DebugContext)11 InvocationPlugins (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins)11 OptionValues (org.graalvm.compiler.options.OptionValues)10 HighTierContext (org.graalvm.compiler.phases.tiers.HighTierContext)10 MetaAccessProvider (jdk.vm.ci.meta.MetaAccessProvider)9 Providers (org.graalvm.compiler.phases.util.Providers)7 Method (java.lang.reflect.Method)6 CanonicalizerPhase (org.graalvm.compiler.phases.common.CanonicalizerPhase)6 DebugCloseable (org.graalvm.compiler.debug.DebugCloseable)5 PhaseSuite (org.graalvm.compiler.phases.PhaseSuite)5 PhaseContext (org.graalvm.compiler.phases.tiers.PhaseContext)5 RuntimeProvider (org.graalvm.compiler.runtime.RuntimeProvider)5 SnippetReflectionProvider (org.graalvm.compiler.api.replacements.SnippetReflectionProvider)3 Bytecode (org.graalvm.compiler.bytecode.Bytecode)3 IntrinsicContext (org.graalvm.compiler.nodes.graphbuilderconf.IntrinsicContext)3