Search in sources :

Example 1 with LoopsDataProvider

use of org.graalvm.compiler.nodes.spi.LoopsDataProvider in project graal by oracle.

the class HotSpotBackendFactory method createBackend.

@SuppressWarnings("try")
public final HotSpotBackend createBackend(HotSpotGraalRuntimeProvider graalRuntime, CompilerConfiguration compilerConfiguration, HotSpotJVMCIRuntime jvmciRuntime, HotSpotBackend host) {
    assert host == null;
    OptionValues options = graalRuntime.getOptions();
    JVMCIBackend jvmci = jvmciRuntime.getHostJVMCIBackend();
    GraalHotSpotVMConfig config = graalRuntime.getVMConfig();
    if (IS_BUILDING_NATIVE_IMAGE || IS_IN_NATIVE_IMAGE) {
        SnippetSignature.initPrimitiveKindCache(jvmci.getMetaAccess());
    }
    HotSpotCodeCacheProvider codeCache = (HotSpotCodeCacheProvider) jvmci.getCodeCache();
    TargetDescription target = codeCache.getTarget();
    MetaAccessProvider metaAccess = new HotSpotSnippetMetaAccessProvider(jvmci.getMetaAccess());
    HotSpotConstantReflectionProvider constantReflection = (HotSpotConstantReflectionProvider) jvmci.getConstantReflection();
    ConstantFieldProvider constantFieldProvider = new HotSpotGraalConstantFieldProvider(config, metaAccess);
    HotSpotProviders providers;
    try (InitTimer t = timer("create providers")) {
        HotSpotRegistersProvider registers;
        try (InitTimer rt = timer("create HotSpotRegisters provider")) {
            registers = createRegisters();
        }
        Value[] nativeABICallerSaveRegisters;
        try (InitTimer rt = timer("create NativeABICallerSaveRegisters")) {
            nativeABICallerSaveRegisters = createNativeABICallerSaveRegisters(config, codeCache.getRegisterConfig());
        }
        HotSpotWordTypes wordTypes;
        try (InitTimer rt = timer("create WordTypes")) {
            wordTypes = createWordTypes(metaAccess, target);
        }
        HotSpotHostForeignCallsProvider foreignCalls;
        try (InitTimer rt = timer("create ForeignCalls provider")) {
            foreignCalls = createForeignCalls(jvmciRuntime, graalRuntime, metaAccess, codeCache, wordTypes, nativeABICallerSaveRegisters);
        }
        HotSpotPlatformConfigurationProvider platformConfigurationProvider;
        try (InitTimer rt = timer("create platform configuration provider")) {
            platformConfigurationProvider = createConfigInfoProvider(config, metaAccess);
        }
        HotSpotMetaAccessExtensionProvider metaAccessExtensionProvider;
        try (InitTimer rt = timer("create MetaAccessExtensionProvider")) {
            metaAccessExtensionProvider = createMetaAccessExtensionProvider();
        }
        HotSpotStampProvider stampProvider;
        try (InitTimer rt = timer("create stamp provider")) {
            stampProvider = createStampProvider();
        }
        HotSpotLoweringProvider lowerer;
        try (InitTimer rt = timer("create Lowerer provider")) {
            lowerer = createLowerer(graalRuntime, metaAccess, foreignCalls, registers, constantReflection, platformConfigurationProvider, metaAccessExtensionProvider, target);
        }
        LoopsDataProvider loopsDataProvider;
        try (InitTimer rt = timer("create loopsdata provider")) {
            loopsDataProvider = createLoopsDataProvider();
        }
        HotSpotSnippetReflectionProvider snippetReflection;
        try (InitTimer rt = timer("create SnippetReflection provider")) {
            snippetReflection = createSnippetReflection(graalRuntime, constantReflection, wordTypes);
        }
        BytecodeProvider bytecodeProvider;
        try (InitTimer rt = timer("create Bytecode provider")) {
            bytecodeProvider = createBytecodeProvider(metaAccess, snippetReflection);
        }
        providers = new HotSpotProviders(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, null, null, registers, snippetReflection, wordTypes, stampProvider, platformConfigurationProvider, metaAccessExtensionProvider, loopsDataProvider, config);
        HotSpotReplacementsImpl replacements;
        try (InitTimer rt = timer("create Replacements provider")) {
            replacements = createReplacements(target, providers, snippetReflection, bytecodeProvider);
            providers = replacements.getProviders();
            replacements.maybeInitializeEncoder();
        }
        GraphBuilderConfiguration.Plugins plugins;
        try (InitTimer rt = timer("create GraphBuilderPhase plugins")) {
            plugins = createGraphBuilderPlugins(graalRuntime, compilerConfiguration, config, target, constantReflection, foreignCalls, metaAccess, snippetReflection, replacements, wordTypes, options);
            replacements.setGraphBuilderPlugins(plugins);
        }
        try (InitTimer rt = timer("create Suites provider")) {
            HotSpotSuitesProvider suites = createSuites(config, graalRuntime, compilerConfiguration, plugins, registers, replacements, options);
            providers.setSuites(suites);
        }
        assert replacements == replacements.getProviders().getReplacements();
        assert providers.getGraphBuilderPlugins() == plugins;
    }
    try (InitTimer rt = timer("instantiate backend")) {
        return createBackend(config, graalRuntime, providers);
    }
}
Also used : InitTimer(jdk.vm.ci.common.InitTimer) OptionValues(org.graalvm.compiler.options.OptionValues) JVMCIBackend(jdk.vm.ci.runtime.JVMCIBackend) TargetDescription(jdk.vm.ci.code.TargetDescription) HotSpotProviders(org.graalvm.compiler.hotspot.meta.HotSpotProviders) HotSpotPlatformConfigurationProvider(org.graalvm.compiler.hotspot.meta.HotSpotPlatformConfigurationProvider) HotSpotMetaAccessExtensionProvider(org.graalvm.compiler.hotspot.meta.HotSpotMetaAccessExtensionProvider) HotSpotRegistersProvider(org.graalvm.compiler.hotspot.meta.HotSpotRegistersProvider) HotSpotSuitesProvider(org.graalvm.compiler.hotspot.meta.HotSpotSuitesProvider) HotSpotStampProvider(org.graalvm.compiler.hotspot.meta.HotSpotStampProvider) HotSpotHostForeignCallsProvider(org.graalvm.compiler.hotspot.meta.HotSpotHostForeignCallsProvider) HotSpotCodeCacheProvider(jdk.vm.ci.hotspot.HotSpotCodeCacheProvider) GraphBuilderConfiguration(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration) BytecodeProvider(org.graalvm.compiler.bytecode.BytecodeProvider) ClassfileBytecodeProvider(org.graalvm.compiler.replacements.classfile.ClassfileBytecodeProvider) HotSpotSnippetReflectionProvider(org.graalvm.compiler.hotspot.meta.HotSpotSnippetReflectionProvider) HotSpotWordTypes(org.graalvm.compiler.hotspot.word.HotSpotWordTypes) HotSpotLoweringProvider(org.graalvm.compiler.hotspot.meta.HotSpotLoweringProvider) LoopsDataProvider(org.graalvm.compiler.nodes.spi.LoopsDataProvider) Value(jdk.vm.ci.meta.Value) HotSpotConstantReflectionProvider(jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider) HotSpotGraalConstantFieldProvider(org.graalvm.compiler.hotspot.meta.HotSpotGraalConstantFieldProvider) MetaAccessProvider(jdk.vm.ci.meta.MetaAccessProvider) HotSpotGraalConstantFieldProvider(org.graalvm.compiler.hotspot.meta.HotSpotGraalConstantFieldProvider) ConstantFieldProvider(org.graalvm.compiler.core.common.spi.ConstantFieldProvider)

Example 2 with LoopsDataProvider

use of org.graalvm.compiler.nodes.spi.LoopsDataProvider in project graal by oracle.

the class SharedRuntimeConfigurationBuilder method build.

public SharedRuntimeConfigurationBuilder build() {
    EnumMap<ConfigKind, RegisterConfig> registerConfigs = new EnumMap<>(ConfigKind.class);
    for (ConfigKind config : ConfigKind.values()) {
        registerConfigs.put(config, ImageSingletons.lookup(SubstrateRegisterConfigFactory.class).newRegisterFactory(config, metaAccess, ConfigurationValues.getTarget(), SubstrateOptions.PreserveFramePointer.getValue()));
    }
    wordTypes = new SubstrateWordTypes(metaAccess, FrameAccess.getWordKind());
    Providers p = createProviders(null, null, null, null, null, null, null, null, null, null, null);
    StampProvider stampProvider = createStampProvider(p);
    p = createProviders(null, null, null, null, null, null, stampProvider, null, null, null, null);
    ConstantReflectionProvider constantReflection = createConstantReflectionProvider(p);
    p = createProviders(null, constantReflection, null, null, null, null, stampProvider, null, null, null, null);
    ConstantFieldProvider constantFieldProvider = createConstantFieldProvider(p);
    SnippetReflectionProvider snippetReflection = createSnippetReflectionProvider();
    ForeignCallsProvider foreignCalls = createForeignCallsProvider(registerConfigs.get(ConfigKind.NORMAL));
    p = createProviders(null, constantReflection, constantFieldProvider, foreignCalls, null, null, stampProvider, snippetReflection, null, null, null);
    BarrierSet barrierSet = ImageSingletons.lookup(Heap.class).createBarrierSet(metaAccess);
    PlatformConfigurationProvider platformConfig = new SubstratePlatformConfigurationProvider(barrierSet);
    MetaAccessExtensionProvider metaAccessExtensionProvider = new SubstrateMetaAccessExtensionProvider();
    p = createProviders(null, constantReflection, constantFieldProvider, foreignCalls, null, null, stampProvider, snippetReflection, platformConfig, metaAccessExtensionProvider, null);
    LoweringProvider lowerer = createLoweringProvider(p);
    p = createProviders(null, constantReflection, constantFieldProvider, foreignCalls, lowerer, null, stampProvider, snippetReflection, platformConfig, metaAccessExtensionProvider, null);
    Replacements replacements = createReplacements(p, snippetReflection);
    p = createProviders(null, constantReflection, constantFieldProvider, foreignCalls, lowerer, replacements, stampProvider, snippetReflection, platformConfig, metaAccessExtensionProvider, null);
    LoopsDataProvider loopsDataProvider = originalLoopsDataProvider;
    p = createProviders(null, constantReflection, constantFieldProvider, foreignCalls, lowerer, replacements, stampProvider, snippetReflection, platformConfig, metaAccessExtensionProvider, loopsDataProvider);
    EnumMap<ConfigKind, SubstrateBackend> backends = new EnumMap<>(ConfigKind.class);
    for (ConfigKind config : ConfigKind.values()) {
        CodeCacheProvider codeCacheProvider = createCodeCacheProvider(registerConfigs.get(config));
        Providers newProviders = createProviders(codeCacheProvider, constantReflection, constantFieldProvider, foreignCalls, lowerer, replacements, stampProvider, snippetReflection, platformConfig, metaAccessExtensionProvider, loopsDataProvider);
        backends.put(config, GraalConfiguration.runtimeInstance().createBackend(newProviders));
    }
    runtimeConfig = new RuntimeConfiguration(p, snippetReflection, backends, wordTypes);
    return this;
}
Also used : ForeignCallsProvider(org.graalvm.compiler.core.common.spi.ForeignCallsProvider) SubstrateForeignCallsProvider(com.oracle.svm.core.graal.meta.SubstrateForeignCallsProvider) SubstratePlatformConfigurationProvider(com.oracle.svm.core.graal.code.SubstratePlatformConfigurationProvider) RegisterConfig(jdk.vm.ci.code.RegisterConfig) SubstrateStampProvider(com.oracle.svm.core.graal.meta.SubstrateStampProvider) StampProvider(org.graalvm.compiler.nodes.spi.StampProvider) Replacements(org.graalvm.compiler.nodes.spi.Replacements) ConfigKind(com.oracle.svm.core.graal.meta.SubstrateRegisterConfig.ConfigKind) SubstrateLoweringProvider(com.oracle.svm.core.graal.meta.SubstrateLoweringProvider) LoweringProvider(org.graalvm.compiler.nodes.spi.LoweringProvider) Providers(org.graalvm.compiler.phases.util.Providers) SubstrateBackend(com.oracle.svm.core.graal.code.SubstrateBackend) CodeCacheProvider(jdk.vm.ci.code.CodeCacheProvider) SubstrateWordTypes(com.oracle.svm.core.graal.word.SubstrateWordTypes) Heap(com.oracle.svm.core.heap.Heap) RuntimeConfiguration(com.oracle.svm.core.graal.meta.RuntimeConfiguration) SubstrateMetaAccessExtensionProvider(com.oracle.svm.core.graal.code.SubstrateMetaAccessExtensionProvider) MetaAccessExtensionProvider(org.graalvm.compiler.core.common.spi.MetaAccessExtensionProvider) BarrierSet(org.graalvm.compiler.nodes.gc.BarrierSet) SubstrateMetaAccessExtensionProvider(com.oracle.svm.core.graal.code.SubstrateMetaAccessExtensionProvider) SnippetReflectionProvider(org.graalvm.compiler.api.replacements.SnippetReflectionProvider) SubstrateSnippetReflectionProvider(com.oracle.svm.core.graal.meta.SubstrateSnippetReflectionProvider) LoopsDataProvider(org.graalvm.compiler.nodes.spi.LoopsDataProvider) ConstantReflectionProvider(jdk.vm.ci.meta.ConstantReflectionProvider) EnumMap(java.util.EnumMap) ConstantFieldProvider(org.graalvm.compiler.core.common.spi.ConstantFieldProvider) PlatformConfigurationProvider(org.graalvm.compiler.nodes.spi.PlatformConfigurationProvider) SubstratePlatformConfigurationProvider(com.oracle.svm.core.graal.code.SubstratePlatformConfigurationProvider)

Aggregations

ConstantFieldProvider (org.graalvm.compiler.core.common.spi.ConstantFieldProvider)2 LoopsDataProvider (org.graalvm.compiler.nodes.spi.LoopsDataProvider)2 SubstrateBackend (com.oracle.svm.core.graal.code.SubstrateBackend)1 SubstrateMetaAccessExtensionProvider (com.oracle.svm.core.graal.code.SubstrateMetaAccessExtensionProvider)1 SubstratePlatformConfigurationProvider (com.oracle.svm.core.graal.code.SubstratePlatformConfigurationProvider)1 RuntimeConfiguration (com.oracle.svm.core.graal.meta.RuntimeConfiguration)1 SubstrateForeignCallsProvider (com.oracle.svm.core.graal.meta.SubstrateForeignCallsProvider)1 SubstrateLoweringProvider (com.oracle.svm.core.graal.meta.SubstrateLoweringProvider)1 ConfigKind (com.oracle.svm.core.graal.meta.SubstrateRegisterConfig.ConfigKind)1 SubstrateSnippetReflectionProvider (com.oracle.svm.core.graal.meta.SubstrateSnippetReflectionProvider)1 SubstrateStampProvider (com.oracle.svm.core.graal.meta.SubstrateStampProvider)1 SubstrateWordTypes (com.oracle.svm.core.graal.word.SubstrateWordTypes)1 Heap (com.oracle.svm.core.heap.Heap)1 EnumMap (java.util.EnumMap)1 CodeCacheProvider (jdk.vm.ci.code.CodeCacheProvider)1 RegisterConfig (jdk.vm.ci.code.RegisterConfig)1 TargetDescription (jdk.vm.ci.code.TargetDescription)1 InitTimer (jdk.vm.ci.common.InitTimer)1 HotSpotCodeCacheProvider (jdk.vm.ci.hotspot.HotSpotCodeCacheProvider)1 HotSpotConstantReflectionProvider (jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider)1