Search in sources :

Example 6 with GraalHotSpotVMConfig

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

the class SPARCHotSpotForeignCallsProvider method initialize.

@Override
public void initialize(HotSpotProviders providers, OptionValues options) {
    GraalHotSpotVMConfig config = runtime.getVMConfig();
    TargetDescription target = providers.getCodeCache().getTarget();
    PlatformKind word = target.arch.getWordKind();
    // The calling convention for the exception handler stub is (only?) defined in
    // TemplateInterpreterGenerator::generate_throw_exception()
    // in templateInterpreter_sparc.cpp around line 1925
    RegisterValue outgoingException = o0.asValue(LIRKind.fromJavaKind(target.arch, JavaKind.Object));
    RegisterValue outgoingExceptionPc = o1.asValue(LIRKind.value(word));
    RegisterValue incomingException = i0.asValue(LIRKind.fromJavaKind(target.arch, JavaKind.Object));
    RegisterValue incomingExceptionPc = i1.asValue(LIRKind.value(word));
    CallingConvention outgoingExceptionCc = new CallingConvention(0, ILLEGAL, outgoingException, outgoingExceptionPc);
    CallingConvention incomingExceptionCc = new CallingConvention(0, ILLEGAL, incomingException, incomingExceptionPc);
    register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER, 0L, PRESERVES_REGISTERS, LEAF_NOFP, outgoingExceptionCc, incomingExceptionCc, NOT_REEXECUTABLE, any()));
    register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, PRESERVES_REGISTERS, LEAF_NOFP, outgoingExceptionCc, incomingExceptionCc, NOT_REEXECUTABLE, any()));
    if (config.useCRC32Intrinsics) {
        // This stub does callee saving
        registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, any());
    }
    if (config.useCRC32CIntrinsics) {
        registerForeignCall(UPDATE_BYTES_CRC32C, config.updateBytesCRC32C, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, any());
    }
    super.initialize(providers, options);
}
Also used : CallingConvention(jdk.vm.ci.code.CallingConvention) RegisterValue(jdk.vm.ci.code.RegisterValue) HotSpotForeignCallLinkageImpl(org.graalvm.compiler.hotspot.HotSpotForeignCallLinkageImpl) TargetDescription(jdk.vm.ci.code.TargetDescription) PlatformKind(jdk.vm.ci.meta.PlatformKind) GraalHotSpotVMConfig(org.graalvm.compiler.hotspot.GraalHotSpotVMConfig)

Example 7 with GraalHotSpotVMConfig

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

the class GraalOSRTestBase method compile.

protected static void compile(DebugContext debug, ResolvedJavaMethod method, int bci) {
    HotSpotJVMCIRuntimeProvider runtime = HotSpotJVMCIRuntime.runtime();
    long jvmciEnv = 0L;
    HotSpotCompilationRequest request = new HotSpotCompilationRequest((HotSpotResolvedJavaMethod) method, bci, jvmciEnv);
    HotSpotGraalCompiler compiler = (HotSpotGraalCompiler) runtime.getCompiler();
    CompilationTask task = new CompilationTask(runtime, compiler, request, true, true, debug.getOptions());
    if (method instanceof HotSpotResolvedJavaMethod) {
        HotSpotGraalRuntimeProvider graalRuntime = compiler.getGraalRuntime();
        GraalHotSpotVMConfig config = graalRuntime.getVMConfig();
        if (((HotSpotResolvedJavaMethod) method).hasCodeAtLevel(bci, config.compilationLevelFullOptimization)) {
            return;
        }
    }
    HotSpotCompilationRequestResult result = task.runCompilation(debug);
    if (result.getFailure() != null) {
        throw new GraalError(result.getFailureMessage());
    }
}
Also used : HotSpotGraalCompiler(org.graalvm.compiler.hotspot.HotSpotGraalCompiler) HotSpotResolvedJavaMethod(jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod) GraalError(org.graalvm.compiler.debug.GraalError) HotSpotCompilationRequestResult(jdk.vm.ci.hotspot.HotSpotCompilationRequestResult) HotSpotGraalRuntimeProvider(org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider) HotSpotCompilationRequest(jdk.vm.ci.hotspot.HotSpotCompilationRequest) CompilationTask(org.graalvm.compiler.hotspot.CompilationTask) GraalHotSpotVMConfig(org.graalvm.compiler.hotspot.GraalHotSpotVMConfig) HotSpotJVMCIRuntimeProvider(jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider)

Example 8 with GraalHotSpotVMConfig

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

the class SPARCHotSpotBackendFactory method createBackend.

@Override
public HotSpotBackend createBackend(HotSpotGraalRuntimeProvider runtime, CompilerConfiguration compilerConfiguration, HotSpotJVMCIRuntimeProvider jvmciRuntime, HotSpotBackend host) {
    assert host == null;
    GraalHotSpotVMConfig config = runtime.getVMConfig();
    JVMCIBackend jvmci = jvmciRuntime.getHostJVMCIBackend();
    HotSpotRegistersProvider registers = createRegisters();
    HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) jvmci.getMetaAccess();
    HotSpotCodeCacheProvider codeCache = (HotSpotCodeCacheProvider) jvmci.getCodeCache();
    TargetDescription target = codeCache.getTarget();
    HotSpotConstantReflectionProvider constantReflection = (HotSpotConstantReflectionProvider) jvmci.getConstantReflection();
    HotSpotConstantFieldProvider constantFieldProvider = new HotSpotGraalConstantFieldProvider(config, metaAccess);
    Value[] nativeABICallerSaveRegisters = createNativeABICallerSaveRegisters(config, codeCache.getRegisterConfig());
    HotSpotWordTypes wordTypes = new HotSpotWordTypes(metaAccess, target.wordJavaKind);
    HotSpotForeignCallsProvider foreignCalls = new SPARCHotSpotForeignCallsProvider(jvmciRuntime, runtime, metaAccess, codeCache, wordTypes, nativeABICallerSaveRegisters);
    LoweringProvider lowerer = createLowerer(runtime, metaAccess, foreignCalls, registers, constantReflection, target);
    HotSpotStampProvider stampProvider = new HotSpotStampProvider();
    Providers p = new Providers(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, null, stampProvider);
    HotSpotSnippetReflectionProvider snippetReflection = new HotSpotSnippetReflectionProvider(runtime, constantReflection, wordTypes);
    BytecodeProvider bytecodeProvider = new ClassfileBytecodeProvider(metaAccess, snippetReflection);
    HotSpotReplacementsImpl replacements = new HotSpotReplacementsImpl(runtime.getOptions(), p, snippetReflection, bytecodeProvider, target);
    Plugins plugins = createGraphBuilderPlugins(compilerConfiguration, config, metaAccess, constantReflection, foreignCalls, lowerer, stampProvider, snippetReflection, replacements, wordTypes);
    replacements.setGraphBuilderPlugins(plugins);
    HotSpotSuitesProvider suites = createSuites(config, runtime, compilerConfiguration, plugins, replacements);
    HotSpotProviders providers = new HotSpotProviders(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, replacements, suites, registers, snippetReflection, wordTypes, plugins);
    return createBackend(config, runtime, providers);
}
Also used : ClassfileBytecodeProvider(org.graalvm.compiler.replacements.classfile.ClassfileBytecodeProvider) HotSpotCodeCacheProvider(jdk.vm.ci.hotspot.HotSpotCodeCacheProvider) JVMCIBackend(jdk.vm.ci.runtime.JVMCIBackend) TargetDescription(jdk.vm.ci.code.TargetDescription) HotSpotProviders(org.graalvm.compiler.hotspot.meta.HotSpotProviders) BytecodeProvider(org.graalvm.compiler.bytecode.BytecodeProvider) ClassfileBytecodeProvider(org.graalvm.compiler.replacements.classfile.ClassfileBytecodeProvider) HotSpotConstantFieldProvider(org.graalvm.compiler.hotspot.meta.HotSpotConstantFieldProvider) LoweringProvider(org.graalvm.compiler.nodes.spi.LoweringProvider) HotSpotLoweringProvider(org.graalvm.compiler.hotspot.meta.HotSpotLoweringProvider) 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) HotSpotWordTypes(org.graalvm.compiler.hotspot.word.HotSpotWordTypes) HotSpotRegistersProvider(org.graalvm.compiler.hotspot.meta.HotSpotRegistersProvider) HotSpotSuitesProvider(org.graalvm.compiler.hotspot.meta.HotSpotSuitesProvider) AddressLoweringHotSpotSuitesProvider(org.graalvm.compiler.hotspot.meta.AddressLoweringHotSpotSuitesProvider) Value(jdk.vm.ci.meta.Value) HotSpotConstantReflectionProvider(jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider) HotSpotGraalConstantFieldProvider(org.graalvm.compiler.hotspot.meta.HotSpotGraalConstantFieldProvider) HotSpotForeignCallsProvider(org.graalvm.compiler.hotspot.meta.HotSpotForeignCallsProvider) GraalHotSpotVMConfig(org.graalvm.compiler.hotspot.GraalHotSpotVMConfig) HotSpotStampProvider(org.graalvm.compiler.hotspot.meta.HotSpotStampProvider) SPARCGraphBuilderPlugins(org.graalvm.compiler.replacements.sparc.SPARCGraphBuilderPlugins) HotSpotGraphBuilderPlugins(org.graalvm.compiler.hotspot.meta.HotSpotGraphBuilderPlugins) Plugins(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)

Example 9 with GraalHotSpotVMConfig

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

the class AMD64HotSpotForeignCallsProvider method initialize.

@Override
public void initialize(HotSpotProviders providers, OptionValues options) {
    GraalHotSpotVMConfig config = runtime.getVMConfig();
    TargetDescription target = providers.getCodeCache().getTarget();
    PlatformKind word = target.arch.getWordKind();
    // The calling convention for the exception handler stub is (only?) defined in
    // TemplateInterpreterGenerator::generate_throw_exception()
    // in templateInterpreter_x86_64.cpp around line 1923
    RegisterValue exception = rax.asValue(LIRKind.reference(word));
    RegisterValue exceptionPc = rdx.asValue(LIRKind.value(word));
    CallingConvention exceptionCc = new CallingConvention(0, ILLEGAL, exception, exceptionPc);
    register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER, 0L, PRESERVES_REGISTERS, LEAF_NOFP, exceptionCc, null, NOT_REEXECUTABLE, any()));
    register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, PRESERVES_REGISTERS, LEAF_NOFP, exceptionCc, null, NOT_REEXECUTABLE, any()));
    link(new AMD64MathStub(ARITHMETIC_LOG_STUB, options, providers, registerStubCall(ARITHMETIC_LOG_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
    link(new AMD64MathStub(ARITHMETIC_LOG10_STUB, options, providers, registerStubCall(ARITHMETIC_LOG10_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
    link(new AMD64MathStub(ARITHMETIC_SIN_STUB, options, providers, registerStubCall(ARITHMETIC_SIN_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
    link(new AMD64MathStub(ARITHMETIC_COS_STUB, options, providers, registerStubCall(ARITHMETIC_COS_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
    link(new AMD64MathStub(ARITHMETIC_TAN_STUB, options, providers, registerStubCall(ARITHMETIC_TAN_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
    link(new AMD64MathStub(ARITHMETIC_EXP_STUB, options, providers, registerStubCall(ARITHMETIC_EXP_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
    link(new AMD64MathStub(ARITHMETIC_POW_STUB, options, providers, registerStubCall(ARITHMETIC_POW_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
    if (config.useCRC32Intrinsics) {
        // This stub does callee saving
        registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, any());
    }
    if (config.useCRC32CIntrinsics) {
        registerForeignCall(UPDATE_BYTES_CRC32C, config.updateBytesCRC32C, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, any());
    }
    super.initialize(providers, options);
}
Also used : CallingConvention(jdk.vm.ci.code.CallingConvention) RegisterValue(jdk.vm.ci.code.RegisterValue) HotSpotForeignCallLinkageImpl(org.graalvm.compiler.hotspot.HotSpotForeignCallLinkageImpl) TargetDescription(jdk.vm.ci.code.TargetDescription) PlatformKind(jdk.vm.ci.meta.PlatformKind) GraalHotSpotVMConfig(org.graalvm.compiler.hotspot.GraalHotSpotVMConfig)

Example 10 with GraalHotSpotVMConfig

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

the class AArch64HotSpotForeignCallsProvider method initialize.

@Override
public void initialize(HotSpotProviders providers, OptionValues options) {
    GraalHotSpotVMConfig config = runtime.getVMConfig();
    TargetDescription target = providers.getCodeCache().getTarget();
    PlatformKind word = target.arch.getWordKind();
    // The calling convention for the exception handler stub is (only?) defined in
    // TemplateInterpreterGenerator::generate_throw_exception()
    RegisterValue exception = r0.asValue(LIRKind.reference(word));
    RegisterValue exceptionPc = r3.asValue(LIRKind.value(word));
    CallingConvention exceptionCc = new CallingConvention(0, ILLEGAL, exception, exceptionPc);
    register(new HotSpotForeignCallLinkageImpl(HotSpotBackend.EXCEPTION_HANDLER, 0L, PRESERVES_REGISTERS, LEAF, exceptionCc, null, NOT_REEXECUTABLE, any()));
    register(new HotSpotForeignCallLinkageImpl(HotSpotBackend.EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, PRESERVES_REGISTERS, LEAF, exceptionCc, null, NOT_REEXECUTABLE, any()));
    // These stubs do callee saving
    if (config.useCRC32Intrinsics) {
        registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, any());
    }
    if (config.useCRC32CIntrinsics) {
        registerForeignCall(UPDATE_BYTES_CRC32C, config.updateBytesCRC32C, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, any());
    }
    super.initialize(providers, options);
}
Also used : CallingConvention(jdk.vm.ci.code.CallingConvention) RegisterValue(jdk.vm.ci.code.RegisterValue) HotSpotForeignCallLinkageImpl(org.graalvm.compiler.hotspot.HotSpotForeignCallLinkageImpl) TargetDescription(jdk.vm.ci.code.TargetDescription) PlatformKind(jdk.vm.ci.meta.PlatformKind) GraalHotSpotVMConfig(org.graalvm.compiler.hotspot.GraalHotSpotVMConfig)

Aggregations

GraalHotSpotVMConfig (org.graalvm.compiler.hotspot.GraalHotSpotVMConfig)13 TargetDescription (jdk.vm.ci.code.TargetDescription)6 CallingConvention (jdk.vm.ci.code.CallingConvention)3 RegisterValue (jdk.vm.ci.code.RegisterValue)3 HotSpotCodeCacheProvider (jdk.vm.ci.hotspot.HotSpotCodeCacheProvider)3 HotSpotConstantReflectionProvider (jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider)3 HotSpotMetaAccessProvider (jdk.vm.ci.hotspot.HotSpotMetaAccessProvider)3 PlatformKind (jdk.vm.ci.meta.PlatformKind)3 Value (jdk.vm.ci.meta.Value)3 JVMCIBackend (jdk.vm.ci.runtime.JVMCIBackend)3 BytecodeProvider (org.graalvm.compiler.bytecode.BytecodeProvider)3 HotSpotForeignCallLinkageImpl (org.graalvm.compiler.hotspot.HotSpotForeignCallLinkageImpl)3 HotSpotReplacementsImpl (org.graalvm.compiler.hotspot.HotSpotReplacementsImpl)3 HotSpotGraalConstantFieldProvider (org.graalvm.compiler.hotspot.meta.HotSpotGraalConstantFieldProvider)3 HotSpotGraphBuilderPlugins (org.graalvm.compiler.hotspot.meta.HotSpotGraphBuilderPlugins)3 HotSpotLoweringProvider (org.graalvm.compiler.hotspot.meta.HotSpotLoweringProvider)3 HotSpotProviders (org.graalvm.compiler.hotspot.meta.HotSpotProviders)3 HotSpotRegistersProvider (org.graalvm.compiler.hotspot.meta.HotSpotRegistersProvider)3 HotSpotSnippetReflectionProvider (org.graalvm.compiler.hotspot.meta.HotSpotSnippetReflectionProvider)3 HotSpotStampProvider (org.graalvm.compiler.hotspot.meta.HotSpotStampProvider)3