# HG changeset patch # User Roland Schatz # Date 1392286691 -3600 # Node ID 28b59501c7b228b49a6857d4efbbde9eb1a821a4 # Parent 285d38e44ae5b11e270f6c8413fc5e983014fd73 Documentation for jump emission logic. diff -r 285d38e44ae5 -r 28b59501c7b2 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java Wed Feb 12 23:57:22 2014 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java Thu Feb 13 11:18:11 2014 +0100 @@ -76,6 +76,14 @@ @Override public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { + /* + * The strategy for emitting jumps is: If either trueDestination or falseDestination is + * the successor block, assume the block scheduler did the correct thing and jcc to the + * other. Otherwise, we need a jcc followed by a jmp. Use the branch probability to make + * sure it is more likely to branch on the jcc (= less likely to execute both the jcc + * and the jmp instead of just the jcc). In the case of loops, that means the jcc is the + * back-edge. + */ if (crb.isSuccessorEdge(trueDestination)) { jcc(masm, true, falseDestination); } else if (crb.isSuccessorEdge(falseDestination)) {