Search in sources :

Example 1 with CompilerConfigurationFactory

use of org.graalvm.compiler.hotspot.CompilerConfigurationFactory in project graal by oracle.

the class HotSpotTruffleRuntime method initLazyCompilerConfigurationName.

@Override
protected String initLazyCompilerConfigurationName() {
    final OptionValues options = getGraalOptions(OptionValues.class);
    String factoryName = Options.TruffleCompilerConfiguration.getValue(options);
    HotSpotJVMCIRuntime runtime = HotSpotJVMCIRuntime.runtime();
    CompilerConfigurationFactory compilerConfigurationFactory = CompilerConfigurationFactory.selectFactory(factoryName, options, runtime);
    return compilerConfigurationFactory.getName();
}
Also used : CompilerConfigurationFactory(org.graalvm.compiler.hotspot.CompilerConfigurationFactory) HotSpotGraalOptionValues(org.graalvm.compiler.hotspot.HotSpotGraalOptionValues) OptionValues(org.graalvm.compiler.options.OptionValues) HotSpotJVMCIRuntime(jdk.vm.ci.hotspot.HotSpotJVMCIRuntime)

Example 2 with CompilerConfigurationFactory

use of org.graalvm.compiler.hotspot.CompilerConfigurationFactory 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 3 with CompilerConfigurationFactory

use of org.graalvm.compiler.hotspot.CompilerConfigurationFactory in project graal by oracle.

the class HotSpotTruffleCompilerImpl method getCompiler.

private static GraalJVMCICompiler getCompiler(OptionValues options) {
    HotSpotJVMCIRuntime runtime = HotSpotJVMCIRuntime.runtime();
    if (!Options.TruffleCompilerConfiguration.hasBeenSet(options)) {
        JVMCICompiler compiler = runtime.getCompiler();
        if (compiler instanceof GraalJVMCICompiler) {
            return (GraalJVMCICompiler) compiler;
        }
    }
    CompilerConfigurationFactory compilerConfigurationFactory = CompilerConfigurationFactory.selectFactory(Options.TruffleCompilerConfiguration.getValue(options), options, runtime);
    return HotSpotGraalCompilerFactory.createCompiler("Truffle", runtime, options, compilerConfigurationFactory);
}
Also used : GraalJVMCICompiler(org.graalvm.compiler.api.runtime.GraalJVMCICompiler) CompilerConfigurationFactory(org.graalvm.compiler.hotspot.CompilerConfigurationFactory) EconomyCompilerConfigurationFactory(org.graalvm.compiler.hotspot.EconomyCompilerConfigurationFactory) HotSpotJVMCIRuntime(jdk.vm.ci.hotspot.HotSpotJVMCIRuntime) JVMCICompiler(jdk.vm.ci.runtime.JVMCICompiler) GraalJVMCICompiler(org.graalvm.compiler.api.runtime.GraalJVMCICompiler)

Example 4 with CompilerConfigurationFactory

use of org.graalvm.compiler.hotspot.CompilerConfigurationFactory in project graal by oracle.

the class TruffleToLibGraalEntryPoints method getCompilerConfigurationFactoryName.

@TruffleToLibGraal(GetCompilerConfigurationFactoryName)
@SuppressWarnings({ "unused", "try" })
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_getCompilerConfigurationFactoryName")
public static JString getCompilerConfigurationFactoryName(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long truffleRuntimeHandle) {
    JNIMethodScope scope = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, GetCompilerConfigurationFactoryName, env);
    try (JNIMethodScope s = scope) {
        HSTruffleCompilerRuntime hsTruffleRuntime = LibGraalObjectHandles.resolve(truffleRuntimeHandle, HSTruffleCompilerRuntime.class);
        assert TruffleCompilerRuntime.getRuntime() == hsTruffleRuntime;
        OptionValues graalOptions = hsTruffleRuntime.getGraalOptions(OptionValues.class);
        String compConfig = Options.TruffleCompilerConfiguration.getValue(graalOptions);
        CompilerConfigurationFactory compilerConfigurationFactory = CompilerConfigurationFactory.selectFactory(compConfig, graalOptions, HotSpotJVMCIRuntime.runtime());
        String name = compilerConfigurationFactory.getName();
        scope.setObjectResult(createHSString(env, name));
    } catch (Throwable t) {
        JNIExceptionWrapper.throwInHotSpot(env, t);
        scope.setObjectResult(WordFactory.nullPointer());
    }
    return scope.getObjectResult();
}
Also used : CompilerConfigurationFactory(org.graalvm.compiler.hotspot.CompilerConfigurationFactory) HotSpotGraalOptionValues(org.graalvm.compiler.hotspot.HotSpotGraalOptionValues) OptionValues(org.graalvm.compiler.options.OptionValues) JNIMethodScope(org.graalvm.jniutils.JNIMethodScope) JNIUtil.createString(org.graalvm.jniutils.JNIUtil.createString) JString(org.graalvm.jniutils.JNI.JString) GetSuppliedString(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal.Id.GetSuppliedString) JNIUtil.createHSString(org.graalvm.jniutils.JNIUtil.createHSString) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) TruffleToLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal)

Aggregations

CompilerConfigurationFactory (org.graalvm.compiler.hotspot.CompilerConfigurationFactory)4 OptionValues (org.graalvm.compiler.options.OptionValues)3 HotSpotJVMCIRuntime (jdk.vm.ci.hotspot.HotSpotJVMCIRuntime)2 EconomyCompilerConfigurationFactory (org.graalvm.compiler.hotspot.EconomyCompilerConfigurationFactory)2 HotSpotGraalOptionValues (org.graalvm.compiler.hotspot.HotSpotGraalOptionValues)2 JVMCICompiler (jdk.vm.ci.runtime.JVMCICompiler)1 SnippetReflectionProvider (org.graalvm.compiler.api.replacements.SnippetReflectionProvider)1 GraalJVMCICompiler (org.graalvm.compiler.api.runtime.GraalJVMCICompiler)1 HotSpotBackend (org.graalvm.compiler.hotspot.HotSpotBackend)1 HotSpotBackendFactory (org.graalvm.compiler.hotspot.HotSpotBackendFactory)1 HotSpotGraalRuntimeProvider (org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider)1 GraphBuilderPhase (org.graalvm.compiler.java.GraphBuilderPhase)1 LIRSuites (org.graalvm.compiler.lir.phases.LIRSuites)1 Plugins (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)1 InvocationPlugins (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins)1 CompilerConfiguration (org.graalvm.compiler.phases.tiers.CompilerConfiguration)1 Suites (org.graalvm.compiler.phases.tiers.Suites)1 Providers (org.graalvm.compiler.phases.util.Providers)1 TruffleToLibGraal (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal)1 GetSuppliedString (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal.Id.GetSuppliedString)1