Search in sources :

Example 1 with HotSpotLoweringProvider

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

the class AMD64HotSpotBackendFactory method createBackend.

@Override
@SuppressWarnings("try")
public HotSpotBackend createBackend(HotSpotGraalRuntimeProvider graalRuntime, CompilerConfiguration compilerConfiguration, HotSpotJVMCIRuntimeProvider jvmciRuntime, HotSpotBackend host) {
    assert host == null;
    OptionValues options = graalRuntime.getOptions();
    JVMCIBackend jvmci = jvmciRuntime.getHostJVMCIBackend();
    GraalHotSpotVMConfig config = graalRuntime.getVMConfig();
    HotSpotProviders providers;
    HotSpotRegistersProvider registers;
    HotSpotCodeCacheProvider codeCache = (HotSpotCodeCacheProvider) jvmci.getCodeCache();
    TargetDescription target = codeCache.getTarget();
    HotSpotHostForeignCallsProvider foreignCalls;
    Value[] nativeABICallerSaveRegisters;
    HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) jvmci.getMetaAccess();
    HotSpotConstantReflectionProvider constantReflection = (HotSpotConstantReflectionProvider) jvmci.getConstantReflection();
    ConstantFieldProvider constantFieldProvider = new HotSpotGraalConstantFieldProvider(config, metaAccess);
    HotSpotLoweringProvider lowerer;
    HotSpotSnippetReflectionProvider snippetReflection;
    HotSpotReplacementsImpl replacements;
    HotSpotSuitesProvider suites;
    HotSpotWordTypes wordTypes;
    Plugins plugins;
    BytecodeProvider bytecodeProvider;
    try (InitTimer t = timer("create providers")) {
        try (InitTimer rt = timer("create HotSpotRegisters provider")) {
            registers = createRegisters();
        }
        try (InitTimer rt = timer("create NativeABICallerSaveRegisters")) {
            nativeABICallerSaveRegisters = createNativeABICallerSaveRegisters(config, codeCache.getRegisterConfig());
        }
        try (InitTimer rt = timer("create WordTypes")) {
            wordTypes = new HotSpotWordTypes(metaAccess, target.wordJavaKind);
        }
        try (InitTimer rt = timer("create ForeignCalls provider")) {
            foreignCalls = createForeignCalls(jvmciRuntime, graalRuntime, metaAccess, codeCache, wordTypes, nativeABICallerSaveRegisters);
        }
        try (InitTimer rt = timer("create Lowerer provider")) {
            lowerer = createLowerer(graalRuntime, metaAccess, foreignCalls, registers, constantReflection, target);
        }
        HotSpotStampProvider stampProvider = new HotSpotStampProvider();
        Providers p = new Providers(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, null, stampProvider);
        try (InitTimer rt = timer("create SnippetReflection provider")) {
            snippetReflection = createSnippetReflection(graalRuntime, constantReflection, wordTypes);
        }
        try (InitTimer rt = timer("create Bytecode provider")) {
            bytecodeProvider = new ClassfileBytecodeProvider(metaAccess, snippetReflection);
        }
        try (InitTimer rt = timer("create Replacements provider")) {
            replacements = createReplacements(options, p, snippetReflection, bytecodeProvider);
        }
        try (InitTimer rt = timer("create GraphBuilderPhase plugins")) {
            plugins = createGraphBuilderPlugins(compilerConfiguration, config, options, target, constantReflection, foreignCalls, lowerer, metaAccess, snippetReflection, replacements, wordTypes, stampProvider);
            replacements.setGraphBuilderPlugins(plugins);
        }
        try (InitTimer rt = timer("create Suites provider")) {
            suites = createSuites(config, graalRuntime, compilerConfiguration, plugins, registers, replacements, options);
        }
        providers = new HotSpotProviders(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, replacements, suites, registers, snippetReflection, wordTypes, 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) HotSpotProviders(org.graalvm.compiler.hotspot.meta.HotSpotProviders) TargetDescription(jdk.vm.ci.code.TargetDescription) HotSpotProviders(org.graalvm.compiler.hotspot.meta.HotSpotProviders) Providers(org.graalvm.compiler.phases.util.Providers) HotSpotReplacementsImpl(org.graalvm.compiler.hotspot.HotSpotReplacementsImpl) HotSpotRegistersProvider(org.graalvm.compiler.hotspot.meta.HotSpotRegistersProvider) HotSpotSuitesProvider(org.graalvm.compiler.hotspot.meta.HotSpotSuitesProvider) AddressLoweringHotSpotSuitesProvider(org.graalvm.compiler.hotspot.meta.AddressLoweringHotSpotSuitesProvider) GraalHotSpotVMConfig(org.graalvm.compiler.hotspot.GraalHotSpotVMConfig) HotSpotStampProvider(org.graalvm.compiler.hotspot.meta.HotSpotStampProvider) HotSpotGraphBuilderPlugins(org.graalvm.compiler.hotspot.meta.HotSpotGraphBuilderPlugins) Plugins(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins) AMD64GraphBuilderPlugins(org.graalvm.compiler.replacements.amd64.AMD64GraphBuilderPlugins) ClassfileBytecodeProvider(org.graalvm.compiler.replacements.classfile.ClassfileBytecodeProvider) HotSpotHostForeignCallsProvider(org.graalvm.compiler.hotspot.meta.HotSpotHostForeignCallsProvider) HotSpotCodeCacheProvider(jdk.vm.ci.hotspot.HotSpotCodeCacheProvider) BytecodeProvider(org.graalvm.compiler.bytecode.BytecodeProvider) ClassfileBytecodeProvider(org.graalvm.compiler.replacements.classfile.ClassfileBytecodeProvider) HotSpotMetaAccessProvider(jdk.vm.ci.hotspot.HotSpotMetaAccessProvider) HotSpotSnippetReflectionProvider(org.graalvm.compiler.hotspot.meta.HotSpotSnippetReflectionProvider) HotSpotLoweringProvider(org.graalvm.compiler.hotspot.meta.HotSpotLoweringProvider) HotSpotWordTypes(org.graalvm.compiler.hotspot.word.HotSpotWordTypes) Value(jdk.vm.ci.meta.Value) HotSpotConstantReflectionProvider(jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider) HotSpotGraalConstantFieldProvider(org.graalvm.compiler.hotspot.meta.HotSpotGraalConstantFieldProvider) HotSpotGraalConstantFieldProvider(org.graalvm.compiler.hotspot.meta.HotSpotGraalConstantFieldProvider) ConstantFieldProvider(org.graalvm.compiler.core.common.spi.ConstantFieldProvider)

Example 2 with HotSpotLoweringProvider

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

the class AArch64HotSpotBackendFactory method createBackend.

@Override
@SuppressWarnings("try")
public HotSpotBackend createBackend(HotSpotGraalRuntimeProvider graalRuntime, CompilerConfiguration compilerConfiguration, HotSpotJVMCIRuntimeProvider jvmciRuntime, HotSpotBackend host) {
    assert host == null;
    JVMCIBackend jvmci = jvmciRuntime.getHostJVMCIBackend();
    GraalHotSpotVMConfig config = graalRuntime.getVMConfig();
    HotSpotProviders providers;
    HotSpotRegistersProvider registers;
    HotSpotCodeCacheProvider codeCache = (HotSpotCodeCacheProvider) jvmci.getCodeCache();
    TargetDescription target = codeCache.getTarget();
    HotSpotHostForeignCallsProvider foreignCalls;
    Value[] nativeABICallerSaveRegisters;
    HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) jvmci.getMetaAccess();
    HotSpotConstantReflectionProvider constantReflection = (HotSpotConstantReflectionProvider) jvmci.getConstantReflection();
    HotSpotConstantFieldProvider constantFieldProvider = new HotSpotGraalConstantFieldProvider(config, metaAccess);
    HotSpotLoweringProvider lowerer;
    HotSpotSnippetReflectionProvider snippetReflection;
    HotSpotReplacementsImpl replacements;
    HotSpotSuitesProvider suites;
    HotSpotWordTypes wordTypes;
    Plugins plugins;
    BytecodeProvider bytecodeProvider;
    try (InitTimer t = timer("create providers")) {
        try (InitTimer rt = timer("create HotSpotRegisters provider")) {
            registers = createRegisters();
        }
        try (InitTimer rt = timer("create NativeABICallerSaveRegisters")) {
            nativeABICallerSaveRegisters = createNativeABICallerSaveRegisters(config, codeCache.getRegisterConfig());
        }
        try (InitTimer rt = timer("create WordTypes")) {
            wordTypes = new HotSpotWordTypes(metaAccess, target.wordJavaKind);
        }
        try (InitTimer rt = timer("create ForeignCalls provider")) {
            foreignCalls = createForeignCalls(jvmciRuntime, graalRuntime, metaAccess, codeCache, wordTypes, nativeABICallerSaveRegisters);
        }
        try (InitTimer rt = timer("create Lowerer provider")) {
            lowerer = createLowerer(graalRuntime, metaAccess, foreignCalls, registers, constantReflection, target);
        }
        HotSpotStampProvider stampProvider = new HotSpotStampProvider();
        Providers p = new Providers(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, null, stampProvider);
        try (InitTimer rt = timer("create SnippetReflection provider")) {
            snippetReflection = createSnippetReflection(graalRuntime, constantReflection, wordTypes);
        }
        try (InitTimer rt = timer("create Bytecode provider")) {
            bytecodeProvider = new ClassfileBytecodeProvider(metaAccess, snippetReflection);
        }
        try (InitTimer rt = timer("create Replacements provider")) {
            replacements = createReplacements(graalRuntime.getOptions(), p, snippetReflection, bytecodeProvider);
        }
        try (InitTimer rt = timer("create GraphBuilderPhase plugins")) {
            plugins = createGraphBuilderPlugins(compilerConfiguration, config, constantReflection, foreignCalls, lowerer, metaAccess, snippetReflection, replacements, wordTypes, stampProvider);
            replacements.setGraphBuilderPlugins(plugins);
        }
        try (InitTimer rt = timer("create Suites provider")) {
            suites = createSuites(config, graalRuntime, compilerConfiguration, plugins);
        }
        providers = new HotSpotProviders(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, replacements, suites, registers, snippetReflection, wordTypes, plugins);
    }
    try (InitTimer rt = timer("instantiate backend")) {
        return createBackend(config, graalRuntime, providers);
    }
}
Also used : ClassfileBytecodeProvider(org.graalvm.compiler.replacements.classfile.ClassfileBytecodeProvider) HotSpotHostForeignCallsProvider(org.graalvm.compiler.hotspot.meta.HotSpotHostForeignCallsProvider) HotSpotCodeCacheProvider(jdk.vm.ci.hotspot.HotSpotCodeCacheProvider) InitTimer(jdk.vm.ci.common.InitTimer) JVMCIBackend(jdk.vm.ci.runtime.JVMCIBackend) HotSpotProviders(org.graalvm.compiler.hotspot.meta.HotSpotProviders) TargetDescription(jdk.vm.ci.code.TargetDescription) BytecodeProvider(org.graalvm.compiler.bytecode.BytecodeProvider) ClassfileBytecodeProvider(org.graalvm.compiler.replacements.classfile.ClassfileBytecodeProvider) HotSpotConstantFieldProvider(org.graalvm.compiler.hotspot.meta.HotSpotConstantFieldProvider) HotSpotProviders(org.graalvm.compiler.hotspot.meta.HotSpotProviders) Providers(org.graalvm.compiler.phases.util.Providers) HotSpotMetaAccessProvider(jdk.vm.ci.hotspot.HotSpotMetaAccessProvider) HotSpotSnippetReflectionProvider(org.graalvm.compiler.hotspot.meta.HotSpotSnippetReflectionProvider) HotSpotReplacementsImpl(org.graalvm.compiler.hotspot.HotSpotReplacementsImpl) HotSpotLoweringProvider(org.graalvm.compiler.hotspot.meta.HotSpotLoweringProvider) HotSpotWordTypes(org.graalvm.compiler.hotspot.word.HotSpotWordTypes) HotSpotRegistersProvider(org.graalvm.compiler.hotspot.meta.HotSpotRegistersProvider) HotSpotSuitesProvider(org.graalvm.compiler.hotspot.meta.HotSpotSuitesProvider) Value(jdk.vm.ci.meta.Value) HotSpotConstantReflectionProvider(jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider) HotSpotGraalConstantFieldProvider(org.graalvm.compiler.hotspot.meta.HotSpotGraalConstantFieldProvider) GraalHotSpotVMConfig(org.graalvm.compiler.hotspot.GraalHotSpotVMConfig) HotSpotStampProvider(org.graalvm.compiler.hotspot.meta.HotSpotStampProvider) AArch64GraphBuilderPlugins(org.graalvm.compiler.replacements.aarch64.AArch64GraphBuilderPlugins) HotSpotGraphBuilderPlugins(org.graalvm.compiler.hotspot.meta.HotSpotGraphBuilderPlugins) Plugins(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)

Example 3 with HotSpotLoweringProvider

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

the class HotSpotHostBackend method completeInitialization.

@Override
@SuppressWarnings("try")
public void completeInitialization(HotSpotJVMCIRuntime jvmciRuntime, OptionValues options) {
    final HotSpotProviders providers = getProviders();
    HotSpotHostForeignCallsProvider foreignCalls = (HotSpotHostForeignCallsProvider) providers.getForeignCalls();
    final HotSpotLoweringProvider lowerer = (HotSpotLoweringProvider) providers.getLowerer();
    try (InitTimer st = timer("foreignCalls.initialize")) {
        foreignCalls.initialize(providers, options);
    }
    try (InitTimer st = timer("lowerer.initialize")) {
        Iterable<DebugHandlersFactory> factories = Collections.singletonList(new GraalDebugHandlersFactory(providers.getSnippetReflection()));
        lowerer.initialize(options, factories, providers, config);
    }
}
Also used : HotSpotHostForeignCallsProvider(org.graalvm.compiler.hotspot.meta.HotSpotHostForeignCallsProvider) InitTimer(jdk.vm.ci.common.InitTimer) HotSpotLoweringProvider(org.graalvm.compiler.hotspot.meta.HotSpotLoweringProvider) DebugHandlersFactory(org.graalvm.compiler.debug.DebugHandlersFactory) GraalDebugHandlersFactory(org.graalvm.compiler.printer.GraalDebugHandlersFactory) HotSpotProviders(org.graalvm.compiler.hotspot.meta.HotSpotProviders) GraalDebugHandlersFactory(org.graalvm.compiler.printer.GraalDebugHandlersFactory)

Aggregations

InitTimer (jdk.vm.ci.common.InitTimer)3 HotSpotHostForeignCallsProvider (org.graalvm.compiler.hotspot.meta.HotSpotHostForeignCallsProvider)3 HotSpotLoweringProvider (org.graalvm.compiler.hotspot.meta.HotSpotLoweringProvider)3 HotSpotProviders (org.graalvm.compiler.hotspot.meta.HotSpotProviders)3 TargetDescription (jdk.vm.ci.code.TargetDescription)2 HotSpotCodeCacheProvider (jdk.vm.ci.hotspot.HotSpotCodeCacheProvider)2 HotSpotConstantReflectionProvider (jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider)2 HotSpotMetaAccessProvider (jdk.vm.ci.hotspot.HotSpotMetaAccessProvider)2 Value (jdk.vm.ci.meta.Value)2 JVMCIBackend (jdk.vm.ci.runtime.JVMCIBackend)2 BytecodeProvider (org.graalvm.compiler.bytecode.BytecodeProvider)2 GraalHotSpotVMConfig (org.graalvm.compiler.hotspot.GraalHotSpotVMConfig)2 HotSpotReplacementsImpl (org.graalvm.compiler.hotspot.HotSpotReplacementsImpl)2 HotSpotGraalConstantFieldProvider (org.graalvm.compiler.hotspot.meta.HotSpotGraalConstantFieldProvider)2 HotSpotGraphBuilderPlugins (org.graalvm.compiler.hotspot.meta.HotSpotGraphBuilderPlugins)2 HotSpotRegistersProvider (org.graalvm.compiler.hotspot.meta.HotSpotRegistersProvider)2 HotSpotSnippetReflectionProvider (org.graalvm.compiler.hotspot.meta.HotSpotSnippetReflectionProvider)2 HotSpotStampProvider (org.graalvm.compiler.hotspot.meta.HotSpotStampProvider)2 HotSpotSuitesProvider (org.graalvm.compiler.hotspot.meta.HotSpotSuitesProvider)2 HotSpotWordTypes (org.graalvm.compiler.hotspot.word.HotSpotWordTypes)2