# HG changeset patch # User Tom Rodriguez # Date 1387224610 28800 # Node ID cd22c6bb4a3576a83bcb9b933c26b55e2edf2b5f # Parent 7345e9672dc33e3cd40f589edc38ad7d23dbd629 use test instead of mov for poll diff -r 7345e9672dc3 -r cd22c6bb4a35 graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotSafepointOp.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotSafepointOp.java Mon Dec 16 10:22:17 2013 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotSafepointOp.java Mon Dec 16 12:10:10 2013 -0800 @@ -42,20 +42,24 @@ public class AMD64HotSpotSafepointOp extends AMD64LIRInstruction { @State protected LIRFrameState state; - @Temp({OperandFlag.REG}) private AllocatableValue temp; + @Temp({OperandFlag.REG, OperandFlag.ILLEGAL}) private AllocatableValue temp; private final HotSpotVMConfig config; public AMD64HotSpotSafepointOp(LIRFrameState state, HotSpotVMConfig config, LIRGeneratorTool tool) { this.state = state; this.config = config; - temp = tool.newVariable(tool.target().wordKind); + if (isPollingPageFar(config)) { + temp = tool.newVariable(tool.target().wordKind); + } else { + // Don't waste a register if it's unneeded + temp = Value.ILLEGAL; + } } @Override public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler asm) { - RegisterValue scratch = (RegisterValue) temp; - emitCode(crb, asm, config, false, state, scratch.getRegister()); + emitCode(crb, asm, config, false, state, temp instanceof RegisterValue ? ((RegisterValue) temp).getRegister() : null); } /** @@ -76,7 +80,7 @@ if (state != null) { crb.recordInfopoint(pos, state, InfopointReason.SAFEPOINT); } - asm.movq(scratch, new AMD64Address(scratch)); + asm.testl(rax, new AMD64Address(scratch)); } else { crb.recordMark(atReturn ? MARK_POLL_RETURN_NEAR : MARK_POLL_NEAR); if (state != null) { @@ -84,7 +88,7 @@ } // The C++ code transforms the polling page offset into an RIP displacement // to the real address at that offset in the polling page. - asm.movq(scratch, new AMD64Address(rip, 0)); + asm.testl(rax, new AMD64Address(rip, 0)); } } }