Search in sources :

Example 1 with LIRKindTool

use of org.graalvm.compiler.core.common.spi.LIRKindTool 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)

Example 2 with LIRKindTool

use of org.graalvm.compiler.core.common.spi.LIRKindTool in project graal by oracle.

the class AMD64HotSpotLIRGenerator method emitCompress.

@Override
public Value emitCompress(Value pointer, CompressEncoding encoding, boolean nonNull) {
    LIRKind inputKind = pointer.getValueKind(LIRKind.class);
    LIRKindTool lirKindTool = getLIRKindTool();
    assert inputKind.getPlatformKind() == lirKindTool.getObjectKind().getPlatformKind();
    if (inputKind.isReference(0)) {
        // oop
        Variable result = newVariable(lirKindTool.getNarrowOopKind());
        append(new AMD64Move.CompressPointerOp(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull, getLIRKindTool()));
        return result;
    } else {
        // metaspace pointer
        Variable result = newVariable(lirKindTool.getNarrowPointerKind());
        AllocatableValue base = Value.ILLEGAL;
        OptionValues options = getResult().getLIR().getOptions();
        if (encoding.hasBase() || GeneratePIC.getValue(options)) {
            if (GeneratePIC.getValue(options)) {
                Variable baseAddress = newVariable(lirKindTool.getWordKind());
                AMD64HotSpotMove.BaseMove move = new AMD64HotSpotMove.BaseMove(baseAddress, config);
                append(move);
                base = baseAddress;
            } else {
                base = emitLoadConstant(lirKindTool.getWordKind(), JavaConstant.forLong(encoding.getBase()));
            }
        }
        append(new AMD64Move.CompressPointerOp(result, asAllocatable(pointer), base, encoding, nonNull, getLIRKindTool()));
        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)2 LIRKind (org.graalvm.compiler.core.common.LIRKind)2 LIRKindTool (org.graalvm.compiler.core.common.spi.LIRKindTool)2 Variable (org.graalvm.compiler.lir.Variable)2 AMD64Move (org.graalvm.compiler.lir.amd64.AMD64Move)2 OptionValues (org.graalvm.compiler.options.OptionValues)2