_________ ___ ___ _______ ___ ___ _________ |\___ ___\|\ \|\ \ |\ ___ \ |\ \ |\ \ |\___ ___\ \|___ \ \_|\ \ \\\ \\ \ __/| \ \ \\ \ \\|___ \ \_| \ \ \ \ \ __ \\ \ \_|/__ __ \ \ \\ \ \ \ \ \ \ \ \ \ \ \ \ \\ \ \_|\ \ |\ \\_\ \\ \ \ \ \ \ \ \__\ \ \__\ \__\\ \_______\ \ \________\\ \__\ \ \__\ \|__| \|__|\|__| \|_______| \|________| \|__| \|__|
The JIT Compiler translates Processor (virtual machine) bytecode into x64 instructions and executes them.
Now it can be run on Windows only.
- Clone the repository:
git clone https://github.com/NikitaDzer/JIT.git
- Compile the compiler (← pun):
cd JIT mkdir build cd build cmake .. make
- Call JIT and pass a path to the file with Processor bytecode:
./JIT.exe P:/processor/build/bytecode
- If you haven't passed any path, you will receive the message:
The path to the file with Processor bytecode must be passed.
- Or if there was any error during compiling:
The JIT translation and execution failure.
- In all other cases, the valid Processor bytecode with proper stack handling (it's explained below) will be translated and executed correctly.
- floating-point instructions
- input-output instructions
- console graphics instructions
- RAM
- VRAM (video memory)
- arithmetic instructions
- forwarding instructions
- initial translation of the Processor bytecode into IR
to speed up optimizations and to reuse already translated Processor bytecode
Attention! Processor (virtual machine) has a stack and a callstack but the x64 implementation has only a stack. So the program, written on the Processor assembler, can cause segfaults in the JIT's executer. To prevent such errors you have to write Processor assembler code taking into account the x64 stack implementation.
The program for performance test: 3 000 000 times calculate factorial 9.
Executer | Execution time |
---|---|
Processor | 15235, ms |
JIT | 185, ms |
Acceleration is 82 times.
The JIT Compiler is written by Nikita Dzer.
♥ WITH LOVE