Search in sources :

Example 1 with AllocatableValue

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

the class AArch64HotSpotLIRGenerator method emitCompress.

@Override
public Value emitCompress(Value pointer, CompressEncoding encoding, boolean nonNull) {
    LIRKind inputKind = pointer.getValueKind(LIRKind.class);
    assert inputKind.getPlatformKind() == AArch64Kind.QWORD;
    if (inputKind.isReference(0)) {
        // oop
        Variable result = newVariable(LIRKind.compressedReference(AArch64Kind.DWORD));
        append(new AArch64HotSpotMove.CompressPointer(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull));
        return result;
    } else {
        // metaspace pointer
        Variable result = newVariable(LIRKind.value(AArch64Kind.DWORD));
        AllocatableValue base = Value.ILLEGAL;
        if (encoding.hasBase()) {
            base = emitLoadConstant(LIRKind.value(AArch64Kind.QWORD), JavaConstant.forLong(encoding.getBase()));
        }
        append(new AArch64HotSpotMove.CompressPointer(result, asAllocatable(pointer), base, encoding, nonNull));
        return result;
    }
}
Also used : Variable(org.graalvm.compiler.lir.Variable) LIRKind(org.graalvm.compiler.core.common.LIRKind) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 2 with AllocatableValue

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

the class AArch64HotSpotLIRGenerator method emitReturn.

@Override
public void emitReturn(JavaKind kind, Value input) {
    AllocatableValue operand = Value.ILLEGAL;
    if (input != null) {
        operand = resultOperandFor(kind, input.getValueKind());
        emitMove(operand, input);
    }
    Register thread = getProviders().getRegisters().getThreadRegister();
    append(new AArch64HotSpotReturnOp(operand, getStub() != null, config, thread));
}
Also used : Register(jdk.vm.ci.code.Register) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 3 with AllocatableValue

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

the class AMD64HotSpotLIRGenerator method emitConstantRetrieval.

private Value emitConstantRetrieval(ForeignCallDescriptor foreignCall, Object[] notes, Constant[] constants, AllocatableValue[] constantDescriptions, LIRFrameState frameState) {
    ForeignCallLinkage linkage = getForeignCalls().lookupForeignCall(foreignCall);
    append(new AMD64HotSpotConstantRetrievalOp(constants, constantDescriptions, frameState, linkage, notes));
    AllocatableValue result = linkage.getOutgoingCallingConvention().getReturn();
    return emitMove(result);
}
Also used : ForeignCallLinkage(org.graalvm.compiler.core.common.spi.ForeignCallLinkage) HotSpotForeignCallLinkage(org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 4 with AllocatableValue

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

the class AMD64HotSpotLIRGenerator method emitCCall.

@Override
public void emitCCall(long address, CallingConvention nativeCallingConvention, Value[] args, int numberOfFloatingPointArguments) {
    Value[] argLocations = new Value[args.length];
    getResult().getFrameMapBuilder().callsMethod(nativeCallingConvention);
    // TODO(mg): in case a native function uses floating point varargs, the ABI requires that
    // RAX contains the length of the varargs
    PrimitiveConstant intConst = JavaConstant.forInt(numberOfFloatingPointArguments);
    AllocatableValue numberOfFloatingPointArgumentsRegister = AMD64.rax.asValue(LIRKind.value(AMD64Kind.DWORD));
    emitMoveConstant(numberOfFloatingPointArgumentsRegister, intConst);
    for (int i = 0; i < args.length; i++) {
        Value arg = args[i];
        AllocatableValue loc = nativeCallingConvention.getArgument(i);
        emitMove(loc, arg);
        argLocations[i] = loc;
    }
    Value ptr = emitLoadConstant(LIRKind.value(AMD64Kind.QWORD), JavaConstant.forLong(address));
    append(new AMD64CCall(nativeCallingConvention.getReturn(), ptr, numberOfFloatingPointArgumentsRegister, argLocations));
}
Also used : PrimitiveConstant(jdk.vm.ci.meta.PrimitiveConstant) 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) AMD64CCall(org.graalvm.compiler.lir.amd64.AMD64CCall) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 5 with AllocatableValue

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

the class AMD64HotSpotLIRGenerator method emitUncompress.

@Override
public Value emitUncompress(Value pointer, CompressEncoding encoding, boolean nonNull) {
    LIRKind inputKind = pointer.getValueKind(LIRKind.class);
    LIRKindTool lirKindTool = getLIRKindTool();
    assert inputKind.getPlatformKind() == lirKindTool.getNarrowOopKind().getPlatformKind();
    if (inputKind.isReference(0)) {
        // oop
        Variable result = newVariable(lirKindTool.getObjectKind());
        append(new AMD64Move.UncompressPointerOp(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull, lirKindTool));
        return result;
    } else {
        // metaspace pointer
        LIRKind uncompressedKind = lirKindTool.getWordKind();
        Variable result = newVariable(uncompressedKind);
        AllocatableValue base = Value.ILLEGAL;
        OptionValues options = getResult().getLIR().getOptions();
        if (encoding.hasBase() || GeneratePIC.getValue(options)) {
            if (GeneratePIC.getValue(options)) {
                Variable baseAddress = newVariable(uncompressedKind);
                AMD64HotSpotMove.BaseMove move = new AMD64HotSpotMove.BaseMove(baseAddress, config);
                append(move);
                base = baseAddress;
            } else {
                base = emitLoadConstant(uncompressedKind, JavaConstant.forLong(encoding.getBase()));
            }
        }
        append(new AMD64Move.UncompressPointerOp(result, asAllocatable(pointer), base, encoding, nonNull, lirKindTool));
        return result;
    }
}
Also used : Variable(org.graalvm.compiler.lir.Variable) OptionValues(org.graalvm.compiler.options.OptionValues) LIRKindTool(org.graalvm.compiler.core.common.spi.LIRKindTool) LIRKind(org.graalvm.compiler.core.common.LIRKind) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) AMD64Move(org.graalvm.compiler.lir.amd64.AMD64Move)

Aggregations

AllocatableValue (jdk.vm.ci.meta.AllocatableValue)87 Value (jdk.vm.ci.meta.Value)22 Variable (org.graalvm.compiler.lir.Variable)20 LIRKind (org.graalvm.compiler.core.common.LIRKind)13 LIRInstruction (org.graalvm.compiler.lir.LIRInstruction)11 Indent (org.graalvm.compiler.debug.Indent)10 RegisterValue (jdk.vm.ci.code.RegisterValue)9 ValueUtil.asAllocatableValue (jdk.vm.ci.code.ValueUtil.asAllocatableValue)8 DebugContext (org.graalvm.compiler.debug.DebugContext)8 Register (jdk.vm.ci.code.Register)6 JavaConstant (jdk.vm.ci.meta.JavaConstant)6 AMD64MathIntrinsicUnaryOp (org.graalvm.compiler.lir.amd64.AMD64MathIntrinsicUnaryOp)5 LIRValueUtil.asJavaConstant (org.graalvm.compiler.lir.LIRValueUtil.asJavaConstant)4 LIRValueUtil.isJavaConstant (org.graalvm.compiler.lir.LIRValueUtil.isJavaConstant)4 ValueMoveOp (org.graalvm.compiler.lir.StandardOp.ValueMoveOp)4 ArithmeticLIRGenerator (org.graalvm.compiler.lir.gen.ArithmeticLIRGenerator)4 LIRGenerator (org.graalvm.compiler.lir.gen.LIRGenerator)4 SPARCAddressValue (org.graalvm.compiler.lir.sparc.SPARCAddressValue)4 AMD64Kind (jdk.vm.ci.amd64.AMD64Kind)3 ValueUtil.isAllocatableValue (jdk.vm.ci.code.ValueUtil.isAllocatableValue)3