Link 4KB Blocks


The purpose of jumps and branches in MIPS code is to jump to a different area of code. The easiest way to emulate one of these jumps in native machine code is to do it indirectly by first returning to the main compiler loop and then by calling the machine code target location from within this loop. This way, the compiler can determine if the target code exists first. If it does not yet exist, meaning that the target has not yet been compiled, it will first compile the code and then call it. This is exactly what happens when Link Code Blocks is set to No.

Of course, it is slow to return to the compiler every time a jump or a branch is encountered. The solution is what the author refers to as Just-In-Time linking. The first time a jump is encountered, it is set to jump to a compiler loop. Then when the target code is compiled, if it doesn't already exist, the jump instruction is rewritten to directly jump to the start address of the target machine code. In other words, the first time a jump is encountered, it jumps to the compiler. The next time the same jump is encountered, it jumps directly to its target. This is what happens when Link Code Blocks is set to Yes. Yes is the default value. One condition is that only those jump targets within a 4KB aligned boundary can be linked. Other targets will return to the compiler.


Link 4KB Blocks = int(0, 1, 2)


Link 4KB Blocks=1


Value Result
0 Default
1 Yes [Default]
2 No


  • This method will link together blocks of native x86 compiled code within a 4KB page of the VM's code. This means that when a MIPS jump, branch or return from exception is encountered whose target is in the same 4KB-aligned boundary, it does not need to return to the main engine loop to fetch the next block.

See Also

  • None
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License