--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64Move.java Fri Feb 02 10:37:48 2018 -0500
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64Move.java Fri Feb 02 17:28:17 2018 -0800
@@ -25,6 +25,7 @@
import static org.graalvm.compiler.asm.amd64.AMD64Assembler.ConditionFlag.Equal;
import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC;
import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.COMPOSITE;
+import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.CONST;
import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.HINT;
import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.ILLEGAL;
import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.REG;
@@ -755,17 +756,18 @@
}
}
- public abstract static class Pointer extends AMD64LIRInstruction {
+ public abstract static class PointerCompressionOp extends AMD64LIRInstruction {
protected final LIRKindTool lirKindTool;
protected final CompressEncoding encoding;
protected final boolean nonNull;
@Def({REG, HINT}) private AllocatableValue result;
- @Use({REG}) private AllocatableValue input;
+ @Use({REG, CONST}) private Value input;
@Alive({REG, ILLEGAL}) private AllocatableValue baseRegister;
- protected Pointer(LIRInstructionClass<? extends Pointer> type, AllocatableValue result, AllocatableValue input, AllocatableValue baseRegister, CompressEncoding encoding, boolean nonNull,
- LIRKindTool lirKindTool) {
+ protected PointerCompressionOp(LIRInstructionClass<? extends PointerCompressionOp> type, AllocatableValue result, Value input,
+ AllocatableValue baseRegister, CompressEncoding encoding, boolean nonNull, LIRKindTool lirKindTool) {
+
super(type);
this.result = result;
this.input = input;
@@ -779,8 +781,12 @@
return GeneratePIC.getValue(crb.getOptions()) || encoding.hasBase();
}
- protected final Register getResultRegister() {
- return asRegister(result);
+ public final Value getInput() {
+ return input;
+ }
+
+ public final AllocatableValue getResult() {
+ return result;
}
protected final Register getBaseRegister() {
@@ -796,18 +802,24 @@
}
}
- public static final class CompressPointer extends Pointer {
- public static final LIRInstructionClass<CompressPointer> TYPE = LIRInstructionClass.create(CompressPointer.class);
+ public static class CompressPointerOp extends PointerCompressionOp {
+ public static final LIRInstructionClass<CompressPointerOp> TYPE = LIRInstructionClass.create(CompressPointerOp.class);
- public CompressPointer(AllocatableValue result, AllocatableValue input, AllocatableValue baseRegister, CompressEncoding encoding, boolean nonNull, LIRKindTool lirKindTool) {
- super(TYPE, result, input, baseRegister, encoding, nonNull, lirKindTool);
+ public CompressPointerOp(AllocatableValue result, Value input, AllocatableValue baseRegister, CompressEncoding encoding, boolean nonNull, LIRKindTool lirKindTool) {
+ this(TYPE, result, input, baseRegister, encoding, nonNull, lirKindTool);
+ }
+
+ protected CompressPointerOp(LIRInstructionClass<? extends PointerCompressionOp> type, AllocatableValue result, Value input,
+ AllocatableValue baseRegister, CompressEncoding encoding, boolean nonNull, LIRKindTool lirKindTool) {
+
+ super(type, result, input, baseRegister, encoding, nonNull, lirKindTool);
}
@Override
public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) {
move(lirKindTool.getObjectKind(), crb, masm);
- Register resReg = getResultRegister();
+ Register resReg = asRegister(getResult());
if (hasBase(crb)) {
Register baseReg = getBaseRegister();
if (!nonNull) {
@@ -824,18 +836,24 @@
}
}
- public static final class UncompressPointer extends Pointer {
- public static final LIRInstructionClass<UncompressPointer> TYPE = LIRInstructionClass.create(UncompressPointer.class);
+ public static class UncompressPointerOp extends PointerCompressionOp {
+ public static final LIRInstructionClass<UncompressPointerOp> TYPE = LIRInstructionClass.create(UncompressPointerOp.class);
- public UncompressPointer(AllocatableValue result, AllocatableValue input, AllocatableValue baseRegister, CompressEncoding encoding, boolean nonNull, LIRKindTool lirKindTool) {
- super(TYPE, result, input, baseRegister, encoding, nonNull, lirKindTool);
+ public UncompressPointerOp(AllocatableValue result, Value input, AllocatableValue baseRegister, CompressEncoding encoding, boolean nonNull, LIRKindTool lirKindTool) {
+ this(TYPE, result, input, baseRegister, encoding, nonNull, lirKindTool);
+ }
+
+ protected UncompressPointerOp(LIRInstructionClass<? extends PointerCompressionOp> type, AllocatableValue result, Value input,
+ AllocatableValue baseRegister, CompressEncoding encoding, boolean nonNull, LIRKindTool lirKindTool) {
+
+ super(type, result, input, baseRegister, encoding, nonNull, lirKindTool);
}
@Override
public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) {
move(lirKindTool.getNarrowOopKind(), crb, masm);
- Register resReg = getResultRegister();
+ Register resReg = asRegister(getResult());
int shift = getShift();
if (shift != 0) {
masm.shlq(resReg, shift);