Search in sources :

Example 6 with HotSpotProviders

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

the class StubAVXTest method test.

@Test
public void test() {
    HotSpotProviders providers = (HotSpotProviders) getProviders();
    HotSpotForeignCallsProviderImpl foreignCalls = (HotSpotForeignCallsProviderImpl) providers.getForeignCalls();
    HotSpotForeignCallLinkage linkage = foreignCalls.registerStubCall(TEST_STUB, true, HotSpotForeignCallLinkage.Transition.LEAF_NOFP);
    linkage.setCompiledStub(new TestStub(getInitialOptions(), providers, linkage));
    runTest("testStub");
}
Also used : HotSpotProviders(org.graalvm.compiler.hotspot.meta.HotSpotProviders) HotSpotForeignCallLinkage(org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage) HotSpotForeignCallsProviderImpl(org.graalvm.compiler.hotspot.meta.HotSpotForeignCallsProviderImpl) LIRTest(org.graalvm.compiler.lir.jtt.LIRTest) Test(org.junit.Test)

Example 7 with HotSpotProviders

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

the class HotSpotGraalCompiler method compileHelper.

public CompilationResult compileHelper(CompilationResultBuilderFactory crbf, CompilationResult result, StructuredGraph graph, ResolvedJavaMethod method, int entryBCI, boolean useProfilingInfo, OptionValues options) {
    HotSpotBackend backend = graalRuntime.getHostBackend();
    HotSpotProviders providers = backend.getProviders();
    final boolean isOSR = entryBCI != JVMCICompiler.INVOCATION_ENTRY_BCI;
    Suites suites = getSuites(providers, options);
    LIRSuites lirSuites = getLIRSuites(providers, options);
    ProfilingInfo profilingInfo = useProfilingInfo ? method.getProfilingInfo(!isOSR, isOSR) : DefaultProfilingInfo.get(TriState.FALSE);
    OptimisticOptimizations optimisticOpts = getOptimisticOpts(profilingInfo, options);
    /*
         * Cut off never executed code profiles if there is code, e.g. after the osr loop, that is
         * never executed.
         */
    if (isOSR && !OnStackReplacementPhase.Options.DeoptAfterOSR.getValue(options)) {
        optimisticOpts.remove(Optimization.RemoveNeverExecutedCode);
    }
    result.setEntryBCI(entryBCI);
    boolean shouldDebugNonSafepoints = providers.getCodeCache().shouldDebugNonSafepoints();
    PhaseSuite<HighTierContext> graphBuilderSuite = configGraphBuilderSuite(providers.getSuites().getDefaultGraphBuilderSuite(), shouldDebugNonSafepoints, isOSR);
    GraalCompiler.compileGraph(graph, method, providers, backend, graphBuilderSuite, optimisticOpts, profilingInfo, suites, lirSuites, result, crbf);
    if (!isOSR && useProfilingInfo) {
        ProfilingInfo profile = profilingInfo;
        profile.setCompilerIRSize(StructuredGraph.class, graph.getNodeCount());
    }
    return result;
}
Also used : HotSpotProviders(org.graalvm.compiler.hotspot.meta.HotSpotProviders) DefaultProfilingInfo(jdk.vm.ci.meta.DefaultProfilingInfo) ProfilingInfo(jdk.vm.ci.meta.ProfilingInfo) LIRSuites(org.graalvm.compiler.lir.phases.LIRSuites) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) OptimisticOptimizations(org.graalvm.compiler.phases.OptimisticOptimizations) LIRSuites(org.graalvm.compiler.lir.phases.LIRSuites) Suites(org.graalvm.compiler.phases.tiers.Suites)

Example 8 with HotSpotProviders

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

the class HotSpotGraalCompiler method createGraph.

public StructuredGraph createGraph(ResolvedJavaMethod method, int entryBCI, boolean useProfilingInfo, CompilationIdentifier compilationId, OptionValues options, DebugContext debug) {
    HotSpotBackend backend = graalRuntime.getHostBackend();
    HotSpotProviders providers = backend.getProviders();
    final boolean isOSR = entryBCI != JVMCICompiler.INVOCATION_ENTRY_BCI;
    StructuredGraph graph = method.isNative() || isOSR ? null : getIntrinsicGraph(method, providers, compilationId, options, debug);
    if (graph == null) {
        SpeculationLog speculationLog = method.getSpeculationLog();
        if (speculationLog != null) {
            speculationLog.collectFailedSpeculations();
        }
        graph = new StructuredGraph.Builder(options, debug, AllowAssumptions.ifTrue(OptAssumptions.getValue(options))).method(method).entryBCI(entryBCI).speculationLog(speculationLog).useProfilingInfo(useProfilingInfo).compilationId(compilationId).build();
    }
    return graph;
}
Also used : SpeculationLog(jdk.vm.ci.meta.SpeculationLog) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) HotSpotProviders(org.graalvm.compiler.hotspot.meta.HotSpotProviders)

Example 9 with HotSpotProviders

use of org.graalvm.compiler.hotspot.meta.HotSpotProviders 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)

Example 10 with HotSpotProviders

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

the class CheckGraalIntrinsics method test.

@Test
@SuppressWarnings("try")
public void test() throws ClassNotFoundException {
    HotSpotGraalRuntimeProvider rt = (HotSpotGraalRuntimeProvider) Graal.getRequiredCapability(RuntimeProvider.class);
    HotSpotProviders providers = rt.getHostBackend().getProviders();
    Plugins graphBuilderPlugins = providers.getGraphBuilderPlugins();
    InvocationPlugins invocationPlugins = graphBuilderPlugins.getInvocationPlugins();
    HotSpotVMConfigStore store = rt.getVMConfig().getStore();
    List<VMIntrinsicMethod> intrinsics = store.getIntrinsics();
    List<String> missing = new ArrayList<>();
    EconomicMap<String, List<Binding>> bindings = invocationPlugins.getBindings(true);
    for (VMIntrinsicMethod intrinsic : intrinsics) {
        InvocationPlugin plugin = findPlugin(bindings, intrinsic);
        if (plugin == null) {
            ResolvedJavaMethod method = resolveIntrinsic(providers.getMetaAccess(), intrinsic);
            if (method != null) {
                IntrinsicMethod intrinsicMethod = providers.getConstantReflection().getMethodHandleAccess().lookupMethodHandleIntrinsic(method);
                if (intrinsicMethod != null) {
                    continue;
                }
            }
            String m = String.format("%s.%s%s", intrinsic.declaringClass, intrinsic.name, intrinsic.descriptor);
            if (!TO_BE_INVESTIGATED.contains(m) && !IGNORE.contains(m)) {
                missing.add(m);
            }
        }
    }
    if (!missing.isEmpty()) {
        Collections.sort(missing);
        String missingString = missing.stream().collect(Collectors.joining(String.format("%n    ")));
        fail("missing Graal intrinsics for:%n    %s", missingString);
    }
}
Also used : InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) VMIntrinsicMethod(jdk.vm.ci.hotspot.VMIntrinsicMethod) IntrinsicMethod(jdk.vm.ci.meta.MethodHandleAccessProvider.IntrinsicMethod) RuntimeProvider(org.graalvm.compiler.runtime.RuntimeProvider) HotSpotGraalRuntimeProvider(org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider) HotSpotProviders(org.graalvm.compiler.hotspot.meta.HotSpotProviders) ArrayList(java.util.ArrayList) HotSpotGraalRuntimeProvider(org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider) InvocationPlugin(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin) ArrayList(java.util.ArrayList) List(java.util.List) HotSpotVMConfigStore(jdk.vm.ci.hotspot.HotSpotVMConfigStore) VMIntrinsicMethod(jdk.vm.ci.hotspot.VMIntrinsicMethod) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) Plugins(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins) GraalTest(org.graalvm.compiler.test.GraalTest) Test(org.junit.Test)

Aggregations

HotSpotProviders (org.graalvm.compiler.hotspot.meta.HotSpotProviders)15 Plugins (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)5 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)4 HotSpotLoweringProvider (org.graalvm.compiler.hotspot.meta.HotSpotLoweringProvider)4 Register (jdk.vm.ci.code.Register)3 TargetDescription (jdk.vm.ci.code.TargetDescription)3 ValueUtil.asRegister (jdk.vm.ci.code.ValueUtil.asRegister)3 InitTimer (jdk.vm.ci.common.InitTimer)3 HotSpotCodeCacheProvider (jdk.vm.ci.hotspot.HotSpotCodeCacheProvider)3 HotSpotConstantReflectionProvider (jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider)3 HotSpotMetaAccessProvider (jdk.vm.ci.hotspot.HotSpotMetaAccessProvider)3 Value (jdk.vm.ci.meta.Value)3 JVMCIBackend (jdk.vm.ci.runtime.JVMCIBackend)3 BytecodeProvider (org.graalvm.compiler.bytecode.BytecodeProvider)3 GraalHotSpotVMConfig (org.graalvm.compiler.hotspot.GraalHotSpotVMConfig)3 HotSpotGraalRuntimeProvider (org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider)3 HotSpotReplacementsImpl (org.graalvm.compiler.hotspot.HotSpotReplacementsImpl)3 HotSpotForeignCallsProvider (org.graalvm.compiler.hotspot.meta.HotSpotForeignCallsProvider)3 HotSpotGraalConstantFieldProvider (org.graalvm.compiler.hotspot.meta.HotSpotGraalConstantFieldProvider)3 HotSpotGraphBuilderPlugins (org.graalvm.compiler.hotspot.meta.HotSpotGraphBuilderPlugins)3