This is a simple JIT-based VM that implements the following instruction set:
0x1— Increment the A register0x2— Increment the B register0x3— Decrement the A register0x4— Decrement the B register
The VM is implemented in vm.c and has both naive and JIT backends. The naive method is pure C and uses a switch statement to determine the appropriate action. The JIT backend compiles a program into x86 machine code using the definitions in the op-x86.s file.
The two vm_run_* functions have a "times" argument that specifies the number of times to repeat the program. This is a simple way of testing the performance increase gained by running JIT code while ignoring the overhead incurred from the JIT process itself. In a real JIT scenario, compiled code sections would be cached.