Static recompilation is a promising way to transfer binary files from a foreign architecture to another target architecture. This will be faster than Just-In-Time (JIT) because it does not need to compile the code before running, and because the extra compilation time it may take is useful for optimizing the generation code.
However, JIT compilation uses dynamic program analysis, and static recompilation is based on static program analysis (hence the name).
In static analysis, you do not have runtime information at runtime.
. , switch, (, ).
:
JMP reg_A
, , . , , . , , .
reg_A .
. , , , reg_A. , reg_A , , . , , reg_A , .
( switch, - ), .
, , , !
, , .
, .
, , - , , .
, A:
41 xx (size 2): Add xx to `A`.
42 (size 1): Increment `A` by one.
:
41 42
, - 41.
:
41 42 (size 2): Add 42 to `A`.
, 41 - ? :
42 (size 1): Increment `A` by one.
, , , , , !
, ! JIT-. - , , . , , !
- ( , , ), NES, .
.
JIT , , , .