Search in sources :

Example 71 with Value

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

the class SPARCHotSpotLIRGenerator method emitForeignCall.

@Override
public Variable emitForeignCall(ForeignCallLinkage linkage, LIRFrameState state, Value... args) {
    HotSpotForeignCallLinkage hotspotLinkage = (HotSpotForeignCallLinkage) linkage;
    Variable result;
    LIRFrameState debugInfo = null;
    if (hotspotLinkage.needsDebugInfo()) {
        debugInfo = state;
        assert debugInfo != null || getStub() != null;
    }
    if (linkage.destroysRegisters() || hotspotLinkage.needsJavaFrameAnchor()) {
        HotSpotRegistersProvider registers = getProviders().getRegisters();
        Register thread = registers.getThreadRegister();
        Value threadTemp = newVariable(LIRKind.value(SPARCKind.XWORD));
        Register stackPointer = registers.getStackPointerRegister();
        Variable spScratch = newVariable(LIRKind.value(target().arch.getWordKind()));
        append(new SPARCHotSpotCRuntimeCallPrologueOp(config.threadLastJavaSpOffset(), thread, stackPointer, threadTemp, spScratch));
        result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
        append(new SPARCHotSpotCRuntimeCallEpilogueOp(config.threadLastJavaSpOffset(), config.threadLastJavaPcOffset(), config.threadJavaFrameAnchorFlagsOffset(), thread, threadTemp));
    } else {
        result = super.emitForeignCall(hotspotLinkage, debugInfo, args);
    }
    return result;
}
Also used : LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) Variable(org.graalvm.compiler.lir.Variable) Register(jdk.vm.ci.code.Register) HotSpotRegistersProvider(org.graalvm.compiler.hotspot.meta.HotSpotRegistersProvider) LIRValueUtil.isConstantValue(org.graalvm.compiler.lir.LIRValueUtil.isConstantValue) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) SPARCImmediateAddressValue(org.graalvm.compiler.lir.sparc.SPARCImmediateAddressValue) RegisterValue(jdk.vm.ci.code.RegisterValue) SPARCAddressValue(org.graalvm.compiler.lir.sparc.SPARCAddressValue) HotSpotForeignCallLinkage(org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage)

Example 72 with Value

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

the class SPARCHotSpotLIRGenerator method emitCompare.

@Override
protected boolean emitCompare(SPARCKind cmpKind, Value a, Value b) {
    Value localA = a;
    Value localB = b;
    if (isConstantValue(a)) {
        Constant c = asConstant(a);
        if (HotSpotCompressedNullConstant.COMPRESSED_NULL.equals(c)) {
            localA = SPARC.g0.asValue(LIRKind.value(WORD));
        } else if (c instanceof HotSpotObjectConstant) {
            localA = load(localA);
        }
    }
    if (isConstantValue(b)) {
        Constant c = asConstant(b);
        if (HotSpotCompressedNullConstant.COMPRESSED_NULL.equals(c)) {
            localB = SPARC.g0.asValue(LIRKind.value(WORD));
        } else if (c instanceof HotSpotObjectConstant) {
            localB = load(localB);
        }
    }
    return super.emitCompare(cmpKind, localA, localB);
}
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) SPARCImmediateAddressValue(org.graalvm.compiler.lir.sparc.SPARCImmediateAddressValue) RegisterValue(jdk.vm.ci.code.RegisterValue) SPARCAddressValue(org.graalvm.compiler.lir.sparc.SPARCAddressValue) HotSpotObjectConstant(jdk.vm.ci.hotspot.HotSpotObjectConstant)

Example 73 with Value

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

the class SPARCHotSpotNodeLIRBuilder method emitIndirectCall.

@Override
protected void emitIndirectCall(IndirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState) {
    Value metaspaceMethodSrc = operand(((HotSpotIndirectCallTargetNode) callTarget).metaspaceMethod());
    AllocatableValue metaspaceMethod = g5.asValue(metaspaceMethodSrc.getValueKind());
    gen.emitMove(metaspaceMethod, metaspaceMethodSrc);
    Value targetAddressSrc = operand(callTarget.computedAddress());
    AllocatableValue targetAddress = o7.asValue(targetAddressSrc.getValueKind());
    gen.emitMove(targetAddress, targetAddressSrc);
    append(new SPARCIndirectCallOp(callTarget.targetMethod(), result, parameters, temps, metaspaceMethod, targetAddress, callState, getGen().config));
}
Also used : RegisterValue(jdk.vm.ci.code.RegisterValue) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 74 with Value

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

the class AMD64HotSpotLIRGenerator method emitNullCheck.

@Override
public void emitNullCheck(Value address, LIRFrameState state) {
    if (address.getValueKind().getPlatformKind() == getLIRKindTool().getNarrowOopKind().getPlatformKind()) {
        CompressEncoding encoding = config.getOopEncoding();
        Value uncompressed;
        if (encoding.getShift() <= 3) {
            LIRKind wordKind = LIRKind.unknownReference(target().arch.getWordKind());
            uncompressed = new AMD64AddressValue(wordKind, getProviders().getRegisters().getHeapBaseRegister().asValue(wordKind), asAllocatable(address), Scale.fromInt(1 << encoding.getShift()), 0);
        } else {
            uncompressed = emitUncompress(address, encoding, false);
        }
        append(new AMD64Move.NullCheckOp(asAddressValue(uncompressed), state));
        return;
    }
    super.emitNullCheck(address, state);
}
Also used : AMD64AddressValue(org.graalvm.compiler.lir.amd64.AMD64AddressValue) CompressEncoding(org.graalvm.compiler.core.common.CompressEncoding) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) RegisterValue(jdk.vm.ci.code.RegisterValue) AMD64AddressValue(org.graalvm.compiler.lir.amd64.AMD64AddressValue) LIRKind(org.graalvm.compiler.core.common.LIRKind) AMD64Move(org.graalvm.compiler.lir.amd64.AMD64Move)

Example 75 with Value

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

the class AMD64HotSpotNodeLIRBuilder method emitIndirectCall.

@Override
protected void emitIndirectCall(IndirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState) {
    if (callTarget instanceof HotSpotIndirectCallTargetNode) {
        Value metaspaceMethodSrc = operand(((HotSpotIndirectCallTargetNode) callTarget).metaspaceMethod());
        Value targetAddressSrc = operand(callTarget.computedAddress());
        AllocatableValue metaspaceMethodDst = AMD64.rbx.asValue(metaspaceMethodSrc.getValueKind());
        AllocatableValue targetAddressDst = AMD64.rax.asValue(targetAddressSrc.getValueKind());
        gen.emitMove(metaspaceMethodDst, metaspaceMethodSrc);
        gen.emitMove(targetAddressDst, targetAddressSrc);
        append(new AMD64IndirectCallOp(callTarget.targetMethod(), result, parameters, temps, metaspaceMethodDst, targetAddressDst, callState, getGen().config));
    } else {
        super.emitIndirectCall(callTarget, result, parameters, temps, callState);
    }
}
Also used : HotSpotIndirectCallTargetNode(org.graalvm.compiler.hotspot.nodes.HotSpotIndirectCallTargetNode) RegisterValue(jdk.vm.ci.code.RegisterValue) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

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