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;
}
}
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;
}
}
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;
}
}
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);
}
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));
}
Aggregations