Search in sources :

Example 1 with Value

use of jdk.vm.ci.meta.Value 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 Value

use of jdk.vm.ci.meta.Value in project graal by oracle.

the class AArch64HotSpotLIRGenerator method emitNullCheck.

@Override
public void emitNullCheck(Value address, LIRFrameState state) {
    if (address.getValueKind().getPlatformKind() == AArch64Kind.DWORD) {
        CompressEncoding encoding = config.getOopEncoding();
        Value uncompressed = emitUncompress(address, encoding, false);
        append(new AArch64Move.NullCheckOp(asAddressValue(uncompressed), state));
    } else {
        super.emitNullCheck(address, state);
    }
}
Also used : AArch64Move(org.graalvm.compiler.lir.aarch64.AArch64Move) CompressEncoding(org.graalvm.compiler.core.common.CompressEncoding) LIRValueUtil.isConstantValue(org.graalvm.compiler.lir.LIRValueUtil.isConstantValue) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) AArch64AddressValue(org.graalvm.compiler.lir.aarch64.AArch64AddressValue) RegisterValue(jdk.vm.ci.code.RegisterValue)

Example 3 with Value

use of jdk.vm.ci.meta.Value in project graal by oracle.

the class AArch64HotSpotLIRGenerator method emitCompare.

@Override
protected boolean emitCompare(PlatformKind cmpKind, Value a, Value b, Condition condition, boolean unorderedIsTrue) {
    Value localA = a;
    Value localB = b;
    if (isConstantValue(a)) {
        Constant c = asConstant(a);
        if (HotSpotCompressedNullConstant.COMPRESSED_NULL.equals(c)) {
            localA = AArch64.zr.asValue(LIRKind.value(AArch64Kind.DWORD));
        } else if (c instanceof HotSpotObjectConstant) {
            localA = load(localA);
        }
    }
    if (isConstantValue(b)) {
        Constant c = asConstant(b);
        if (HotSpotCompressedNullConstant.COMPRESSED_NULL.equals(c)) {
            localB = AArch64.zr.asValue(LIRKind.value(AArch64Kind.DWORD));
        } else if (c instanceof HotSpotObjectConstant) {
            localB = load(localB);
        }
    }
    return super.emitCompare(cmpKind, localA, localB, condition, unorderedIsTrue);
}
Also used : Constant(jdk.vm.ci.meta.Constant) JavaConstant(jdk.vm.ci.meta.JavaConstant) HotSpotCompressedNullConstant(jdk.vm.ci.hotspot.HotSpotCompressedNullConstant) HotSpotObjectConstant(jdk.vm.ci.hotspot.HotSpotObjectConstant) LIRValueUtil.asConstant(org.graalvm.compiler.lir.LIRValueUtil.asConstant) LIRValueUtil.isConstantValue(org.graalvm.compiler.lir.LIRValueUtil.isConstantValue) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) AArch64AddressValue(org.graalvm.compiler.lir.aarch64.AArch64AddressValue) RegisterValue(jdk.vm.ci.code.RegisterValue) HotSpotObjectConstant(jdk.vm.ci.hotspot.HotSpotObjectConstant)

Example 4 with Value

use of jdk.vm.ci.meta.Value in project graal by oracle.

the class AArch64HotSpotNodeLIRBuilder method emitPrologue.

@Override
protected void emitPrologue(StructuredGraph graph) {
    CallingConvention incomingArguments = gen.getResult().getCallingConvention();
    Value[] params = new Value[incomingArguments.getArgumentCount() + 2];
    for (int i = 0; i < incomingArguments.getArgumentCount(); i++) {
        params[i] = incomingArguments.getArgument(i);
        if (isStackSlot(params[i])) {
            StackSlot slot = ValueUtil.asStackSlot(params[i]);
            if (slot.isInCallerFrame() && !gen.getResult().getLIR().hasArgInCallerFrame()) {
                gen.getResult().getLIR().setHasArgInCallerFrame();
            }
        }
    }
    params[params.length - 2] = fp.asValue(LIRKind.value(AArch64Kind.QWORD));
    params[params.length - 1] = lr.asValue(LIRKind.value(AArch64Kind.QWORD));
    gen.emitIncomingValues(params);
    for (ParameterNode param : graph.getNodes(ParameterNode.TYPE)) {
        Value paramValue = params[param.index()];
        assert paramValue.getValueKind().equals(getLIRGeneratorTool().getLIRKind(param.stamp(NodeView.DEFAULT))) : paramValue.getValueKind() + " != " + param.stamp(NodeView.DEFAULT);
        setResult(param, gen.emitMove(paramValue));
    }
}
Also used : CallingConvention(jdk.vm.ci.code.CallingConvention) ParameterNode(org.graalvm.compiler.nodes.ParameterNode) RegisterValue(jdk.vm.ci.code.RegisterValue) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) ValueUtil.isStackSlot(jdk.vm.ci.code.ValueUtil.isStackSlot) StackSlot(jdk.vm.ci.code.StackSlot)

Example 5 with Value

use of jdk.vm.ci.meta.Value in project graal by oracle.

the class AArch64HotSpotNodeLIRBuilder method visitBreakpointNode.

@Override
public void visitBreakpointNode(BreakpointNode node) {
    JavaType[] sig = new JavaType[node.arguments().size()];
    for (int i = 0; i < sig.length; i++) {
        sig[i] = node.arguments().get(i).stamp(NodeView.DEFAULT).javaType(gen.getMetaAccess());
    }
    Value[] parameters = visitInvokeArguments(gen.getRegisterConfig().getCallingConvention(HotSpotCallingConventionType.JavaCall, null, sig, gen), node.arguments());
    append(new AArch64BreakpointOp(parameters));
}
Also used : JavaType(jdk.vm.ci.meta.JavaType) RegisterValue(jdk.vm.ci.code.RegisterValue) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) AArch64BreakpointOp(org.graalvm.compiler.lir.aarch64.AArch64BreakpointOp)

Aggregations

Value (jdk.vm.ci.meta.Value)151 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)76 RegisterValue (jdk.vm.ci.code.RegisterValue)33 LIRKind (org.graalvm.compiler.core.common.LIRKind)18 LIRInstruction (org.graalvm.compiler.lir.LIRInstruction)14 LIRValueUtil.isConstantValue (org.graalvm.compiler.lir.LIRValueUtil.isConstantValue)14 LIRValueUtil.isStackSlotValue (org.graalvm.compiler.lir.LIRValueUtil.isStackSlotValue)14 OperandMode (org.graalvm.compiler.lir.LIRInstruction.OperandMode)12 Variable (org.graalvm.compiler.lir.Variable)12 ComplexMatchValue (org.graalvm.compiler.core.match.ComplexMatchValue)11 Indent (org.graalvm.compiler.debug.Indent)11 EnumSet (java.util.EnumSet)10 DebugContext (org.graalvm.compiler.debug.DebugContext)10 GraalError (org.graalvm.compiler.debug.GraalError)10 LIRFrameState (org.graalvm.compiler.lir.LIRFrameState)10 BitSet (java.util.BitSet)9 Register (jdk.vm.ci.code.Register)9 ConstantValue (org.graalvm.compiler.lir.ConstantValue)9 SPARCAddressValue (org.graalvm.compiler.lir.sparc.SPARCAddressValue)9 ValueNode (org.graalvm.compiler.nodes.ValueNode)9