On 05/14/2013 07:05 AM, Claudio Fontana wrote: >> Conditional branch range is +-1MB. You'll never see a TB that large. You >> don't need to emit a branch-across-branch. > > Is there maybe a way to do it right even in the corner case where we have > a huge list of hundreds of thousands of instructions without jumps and then a > conditional jump? > Are we _guaranteed_ to never see that large a TB with some kind of define, > similarly to MAX_CODE_GEN_BUFFER_SIZE?
There are three mechanisms that all limit TB size: (1) OPC_MAX_SIZE, limiting the number of opcodes emitted, (2) CF_COUNT_MASK, limiting the number of instructions translated, (3) Instruction pointer crossing a page boundary, where we end a TB and re-verify the page protection bits of the new page. Nr 1 is probably the most significant, since it most directly relates to the number of output instructions, and thus the resulting TB size. r~