Search in sources :

Example 1 with TruffleTierConfiguration

use of org.graalvm.compiler.truffle.compiler.TruffleTierConfiguration in project graal by oracle.

the class HotSpotTruffleCompilerImpl method create.

public static HotSpotTruffleCompilerImpl create(final TruffleCompilerRuntime runtime) {
    OptionValues options = runtime.getGraalOptions(OptionValues.class);
    HotSpotGraalRuntimeProvider hotspotGraalRuntime = (HotSpotGraalRuntimeProvider) getCompiler(options).getGraalRuntime();
    SnippetReflectionProvider snippetReflection = hotspotGraalRuntime.getRequiredCapability(SnippetReflectionProvider.class);
    HotSpotBackend backend = hotspotGraalRuntime.getHostBackend();
    GraphBuilderPhase phase = (GraphBuilderPhase) backend.getSuites().getDefaultGraphBuilderSuite().findPhase(GraphBuilderPhase.class).previous();
    Plugins plugins = phase.getGraphBuilderConfig().getPlugins();
    final PartialEvaluatorConfiguration lastTierPe = createPartialEvaluatorConfiguration(hotspotGraalRuntime.getCompilerConfigurationName());
    final TruffleTierConfiguration lastTierSetup = new TruffleTierConfiguration(lastTierPe, backend, options);
    CompilerConfigurationFactory lowTierCompilerConfigurationFactory = new EconomyCompilerConfigurationFactory();
    CompilerConfiguration compilerConfiguration = lowTierCompilerConfigurationFactory.createCompilerConfiguration();
    HotSpotBackendFactory backendFactory = lowTierCompilerConfigurationFactory.createBackendMap().getBackendFactory(backend.getTarget().arch);
    HotSpotBackend firstTierBackend = backendFactory.createBackend(hotspotGraalRuntime, compilerConfiguration, HotSpotJVMCIRuntime.runtime(), null);
    Suites firstTierSuites = firstTierBackend.getSuites().getDefaultSuites(options);
    LIRSuites firstTierLirSuites = firstTierBackend.getSuites().getDefaultLIRSuites(options);
    Providers firstTierProviders = firstTierBackend.getProviders();
    PartialEvaluatorConfiguration firstTierPe = new EconomyPartialEvaluatorConfiguration();
    firstTierBackend.completeInitialization(HotSpotJVMCIRuntime.runtime(), options);
    TruffleTierConfiguration firstTierSetup = new TruffleTierConfiguration(firstTierPe, firstTierBackend, firstTierProviders, firstTierSuites, firstTierLirSuites);
    final TruffleCompilerConfiguration compilerConfig = new TruffleCompilerConfiguration(runtime, plugins, snippetReflection, firstTierSetup, lastTierSetup);
    return new HotSpotTruffleCompilerImpl(hotspotGraalRuntime, compilerConfig);
}
Also used : HotSpotBackendFactory(org.graalvm.compiler.hotspot.HotSpotBackendFactory) EconomyCompilerConfigurationFactory(org.graalvm.compiler.hotspot.EconomyCompilerConfigurationFactory) EconomyPartialEvaluatorConfiguration(org.graalvm.compiler.truffle.compiler.EconomyPartialEvaluatorConfiguration) OptionValues(org.graalvm.compiler.options.OptionValues) EconomyPartialEvaluatorConfiguration(org.graalvm.compiler.truffle.compiler.EconomyPartialEvaluatorConfiguration) PartialEvaluatorConfiguration(org.graalvm.compiler.truffle.compiler.PartialEvaluatorConfiguration) TruffleTierConfiguration(org.graalvm.compiler.truffle.compiler.TruffleTierConfiguration) HotSpotGraalRuntimeProvider(org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider) Providers(org.graalvm.compiler.phases.util.Providers) SnippetReflectionProvider(org.graalvm.compiler.api.replacements.SnippetReflectionProvider) CompilerConfigurationFactory(org.graalvm.compiler.hotspot.CompilerConfigurationFactory) EconomyCompilerConfigurationFactory(org.graalvm.compiler.hotspot.EconomyCompilerConfigurationFactory) HotSpotBackend(org.graalvm.compiler.hotspot.HotSpotBackend) CompilerConfiguration(org.graalvm.compiler.phases.tiers.CompilerConfiguration) TruffleCompilerConfiguration(org.graalvm.compiler.truffle.compiler.TruffleCompilerConfiguration) TruffleCompilerConfiguration(org.graalvm.compiler.truffle.compiler.TruffleCompilerConfiguration) LIRSuites(org.graalvm.compiler.lir.phases.LIRSuites) GraphBuilderPhase(org.graalvm.compiler.java.GraphBuilderPhase) InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) Plugins(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins) LIRSuites(org.graalvm.compiler.lir.phases.LIRSuites) Suites(org.graalvm.compiler.phases.tiers.Suites)

Example 2 with TruffleTierConfiguration

use of org.graalvm.compiler.truffle.compiler.TruffleTierConfiguration in project graal by oracle.

the class HotSpotTruffleCompilerImpl method compileTruffleStub.

/**
 * Utility to compile a truffle stub. Truffle stubs avoid deoptimization as much as possible and
 * therefore deactivate all speculation and use of profiling information. Also note that truffle
 * stubs do not perform any inlining and resolve classes eagerly.
 */
private CompilationResult compileTruffleStub(DebugContext debug, ResolvedJavaMethod javaMethod, CompilationIdentifier compilationId, CompilationResultBuilderFactory resultFactory, InvocationPlugins plugins) {
    TruffleTierConfiguration tier = config.lastTier();
    Suites newSuites = tier.suites().copy();
    removeInliningPhase(newSuites);
    StructuredGraph graph = // 
    new StructuredGraph.Builder(debug.getOptions(), debug, AllowAssumptions.NO).useProfilingInfo(// 
    false).method(// 
    javaMethod).compilationId(compilationId).build();
    final Providers lastTierProviders = tier.providers();
    final Backend backend = tier.backend();
    HotSpotCodeCacheProvider codeCache = (HotSpotCodeCacheProvider) lastTierProviders.getCodeCache();
    boolean infoPoints = codeCache.shouldDebugNonSafepoints();
    GraphBuilderConfiguration newBuilderConfig = // 
    GraphBuilderConfiguration.getDefault(new Plugins(plugins)).withEagerResolving(// 
    true).withUnresolvedIsError(// 
    true).withNodeSourcePosition(infoPoints);
    new GraphBuilderPhase.Instance(lastTierProviders, newBuilderConfig, OptimisticOptimizations.ALL, null).apply(graph);
    PhaseSuite<HighTierContext> graphBuilderSuite = getGraphBuilderSuite(codeCache, backend.getSuites());
    return compileGraph(graph, javaMethod, lastTierProviders, backend, graphBuilderSuite, OptimisticOptimizations.ALL, graph.getProfilingInfo(), newSuites, tier.lirSuites(), new CompilationResult(compilationId), resultFactory, false);
}
Also used : HotSpotCodeCacheProvider(jdk.vm.ci.hotspot.HotSpotCodeCacheProvider) HotSpotCompiledCodeBuilder(org.graalvm.compiler.hotspot.HotSpotCompiledCodeBuilder) TruffleTierConfiguration(org.graalvm.compiler.truffle.compiler.TruffleTierConfiguration) GraphBuilderConfiguration(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration) Providers(org.graalvm.compiler.phases.util.Providers) HotSpotBackend(org.graalvm.compiler.hotspot.HotSpotBackend) Backend(org.graalvm.compiler.core.target.Backend) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) CompilationResult(org.graalvm.compiler.code.CompilationResult) GraphBuilderPhase(org.graalvm.compiler.java.GraphBuilderPhase) LIRSuites(org.graalvm.compiler.lir.phases.LIRSuites) Suites(org.graalvm.compiler.phases.tiers.Suites) InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) Plugins(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)

Example 3 with TruffleTierConfiguration

use of org.graalvm.compiler.truffle.compiler.TruffleTierConfiguration in project graal by oracle.

the class TruffleSupport method createSubstrateTruffleCompilerImpl.

protected static SubstrateTruffleCompiler createSubstrateTruffleCompilerImpl(SubstrateTruffleRuntime runtime, String compilerConfigurationName) {
    GraalFeature graalFeature = ImageSingletons.lookup(GraalFeature.class);
    SnippetReflectionProvider snippetReflectionProvider = graalFeature.getHostedProviders().getSnippetReflection();
    final GraphBuilderConfiguration.Plugins graphBuilderPlugins = graalFeature.getHostedProviders().getGraphBuilderPlugins();
    final TruffleTierConfiguration firstTier = new TruffleTierConfiguration(new EconomyPartialEvaluatorConfiguration(), GraalSupport.getRuntimeConfig().getBackendForNormalMethod(), GraalSupport.getFirstTierProviders(), GraalSupport.getFirstTierSuites(), GraalSupport.getFirstTierLirSuites());
    PartialEvaluatorConfiguration peConfig = TruffleCompilerImpl.createPartialEvaluatorConfiguration(compilerConfigurationName);
    final TruffleTierConfiguration lastTier = new TruffleTierConfiguration(peConfig, GraalSupport.getRuntimeConfig().getBackendForNormalMethod(), GraalSupport.getRuntimeConfig().getProviders(), GraalSupport.getSuites(), GraalSupport.getLIRSuites());
    final TruffleCompilerConfiguration truffleCompilerConfig = new TruffleCompilerConfiguration(runtime, graphBuilderPlugins, snippetReflectionProvider, firstTier, lastTier);
    return new SubstrateTruffleCompilerImpl(truffleCompilerConfig);
}
Also used : SnippetReflectionProvider(org.graalvm.compiler.api.replacements.SnippetReflectionProvider) EconomyPartialEvaluatorConfiguration(org.graalvm.compiler.truffle.compiler.EconomyPartialEvaluatorConfiguration) PartialEvaluatorConfiguration(org.graalvm.compiler.truffle.compiler.PartialEvaluatorConfiguration) EconomyPartialEvaluatorConfiguration(org.graalvm.compiler.truffle.compiler.EconomyPartialEvaluatorConfiguration) TruffleTierConfiguration(org.graalvm.compiler.truffle.compiler.TruffleTierConfiguration) TruffleCompilerConfiguration(org.graalvm.compiler.truffle.compiler.TruffleCompilerConfiguration) GraphBuilderConfiguration(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration) GraalFeature(com.oracle.svm.graal.hosted.GraalFeature) SubstrateTruffleCompilerImpl(com.oracle.svm.truffle.api.SubstrateTruffleCompilerImpl)

Aggregations

TruffleTierConfiguration (org.graalvm.compiler.truffle.compiler.TruffleTierConfiguration)3 SnippetReflectionProvider (org.graalvm.compiler.api.replacements.SnippetReflectionProvider)2 HotSpotBackend (org.graalvm.compiler.hotspot.HotSpotBackend)2 GraphBuilderPhase (org.graalvm.compiler.java.GraphBuilderPhase)2 LIRSuites (org.graalvm.compiler.lir.phases.LIRSuites)2 GraphBuilderConfiguration (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration)2 Plugins (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)2 InvocationPlugins (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins)2 Suites (org.graalvm.compiler.phases.tiers.Suites)2 Providers (org.graalvm.compiler.phases.util.Providers)2 EconomyPartialEvaluatorConfiguration (org.graalvm.compiler.truffle.compiler.EconomyPartialEvaluatorConfiguration)2 PartialEvaluatorConfiguration (org.graalvm.compiler.truffle.compiler.PartialEvaluatorConfiguration)2 TruffleCompilerConfiguration (org.graalvm.compiler.truffle.compiler.TruffleCompilerConfiguration)2 GraalFeature (com.oracle.svm.graal.hosted.GraalFeature)1 SubstrateTruffleCompilerImpl (com.oracle.svm.truffle.api.SubstrateTruffleCompilerImpl)1 HotSpotCodeCacheProvider (jdk.vm.ci.hotspot.HotSpotCodeCacheProvider)1 CompilationResult (org.graalvm.compiler.code.CompilationResult)1 Backend (org.graalvm.compiler.core.target.Backend)1 CompilerConfigurationFactory (org.graalvm.compiler.hotspot.CompilerConfigurationFactory)1 EconomyCompilerConfigurationFactory (org.graalvm.compiler.hotspot.EconomyCompilerConfigurationFactory)1