Search in sources :

Example 1 with LIRKind

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

use of org.graalvm.compiler.core.common.LIRKind 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 3 with LIRKind

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

Example 4 with LIRKind

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

the class LogicCompareAndSwapNode method generate.

@Override
public void generate(NodeLIRBuilderTool gen) {
    assert getNewValue().stamp(NodeView.DEFAULT).isCompatible(getExpectedValue().stamp(NodeView.DEFAULT));
    assert !this.canDeoptimize();
    LIRGeneratorTool tool = gen.getLIRGeneratorTool();
    LIRKind resultKind = tool.getLIRKind(stamp(NodeView.DEFAULT));
    Value trueResult = tool.emitConstant(resultKind, JavaConstant.TRUE);
    Value falseResult = tool.emitConstant(resultKind, JavaConstant.FALSE);
    Value result = tool.emitLogicCompareAndSwap(gen.operand(getAddress()), gen.operand(getExpectedValue()), gen.operand(getNewValue()), trueResult, falseResult);
    gen.setResult(this, result);
}
Also used : Value(jdk.vm.ci.meta.Value) LIRKind(org.graalvm.compiler.core.common.LIRKind) LIRGeneratorTool(org.graalvm.compiler.lir.gen.LIRGeneratorTool)

Example 5 with LIRKind

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

the class VMErrorNode method generate.

@Override
public void generate(NodeLIRBuilderTool gen) {
    String whereString;
    if (stateBefore() != null) {
        String nl = CodeUtil.NEW_LINE;
        StringBuilder sb = new StringBuilder("in compiled code associated with frame state:");
        FrameState fs = stateBefore();
        while (fs != null) {
            Bytecode.appendLocation(sb.append(nl).append("\t"), fs.getCode(), fs.bci);
            fs = fs.outerFrameState();
        }
        whereString = sb.toString();
    } else {
        ResolvedJavaMethod method = graph().method();
        whereString = "in compiled code for " + (method == null ? graph().toString() : method.format("%H.%n(%p)"));
    }
    LIRKind wordKind = gen.getLIRGeneratorTool().getLIRKind(StampFactory.pointer());
    Value whereArg = gen.getLIRGeneratorTool().emitConstant(wordKind, new CStringConstant(whereString));
    Value formatArg = gen.getLIRGeneratorTool().emitConstant(wordKind, new CStringConstant(format));
    ForeignCallLinkage linkage = gen.getLIRGeneratorTool().getForeignCalls().lookupForeignCall(VM_ERROR);
    gen.getLIRGeneratorTool().emitForeignCall(linkage, null, whereArg, formatArg, gen.operand(value));
}
Also used : Value(jdk.vm.ci.meta.Value) LIRKind(org.graalvm.compiler.core.common.LIRKind) ForeignCallLinkage(org.graalvm.compiler.core.common.spi.ForeignCallLinkage) FrameState(org.graalvm.compiler.nodes.FrameState) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) CStringConstant(org.graalvm.compiler.replacements.nodes.CStringConstant)

Aggregations

LIRKind (org.graalvm.compiler.core.common.LIRKind)60 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)20 Variable (org.graalvm.compiler.lir.Variable)19 Value (jdk.vm.ci.meta.Value)15 RegisterValue (jdk.vm.ci.code.RegisterValue)11 TargetDescription (jdk.vm.ci.code.TargetDescription)7 PlatformKind (jdk.vm.ci.meta.PlatformKind)7 LIRGeneratorTool (org.graalvm.compiler.lir.gen.LIRGeneratorTool)7 AMD64Kind (jdk.vm.ci.amd64.AMD64Kind)6 JavaConstant (jdk.vm.ci.meta.JavaConstant)4 SPARCKind (jdk.vm.ci.sparc.SPARCKind)4 ComplexMatchValue (org.graalvm.compiler.core.match.ComplexMatchValue)4 AArch64AddressValue (org.graalvm.compiler.lir.aarch64.AArch64AddressValue)4 AMD64AddressValue (org.graalvm.compiler.lir.amd64.AMD64AddressValue)4 ComplexMatchResult (org.graalvm.compiler.core.match.ComplexMatchResult)3 MatchRule (org.graalvm.compiler.core.match.MatchRule)3 ConstantValue (org.graalvm.compiler.lir.ConstantValue)3 AMD64MulDivOp (org.graalvm.compiler.lir.amd64.AMD64MulDivOp)3 SubstrateRegisterConfig (com.oracle.svm.core.graal.meta.SubstrateRegisterConfig)2 Op3s (org.graalvm.compiler.asm.sparc.SPARCAssembler.Op3s)2