MiJIT is a cross-platform Just-In-Time (JIT) compiler that demonstrates how to generate and execute machine code at runtime. It creates a personalized greeting program on the fly!
MiJIT is an educational JIT compiler that:
- Generates machine code while running - Creates assembly instructions in memory
- Executes generated code - Runs the machine code like a regular function
- Works on multiple platforms - Supports Linux, macOS, Intel, and ARM processors
- Teaches JIT concepts - Shows how runtime code generation works
Linux x86-64 (Intel/AMD processors)
macOS x86-64 (Intel Mac)
Linux ARM64 (ARM processors like Raspberry Pi)
Apple Silicon (M1/M2/M3 Macs)
# Ubuntu/Debian
sudo apt update
sudo apt install xmake
# If xmake is not available in your package manager:
curl -fsSL https://xmake.io/shget.text | bash# Using Homebrew (recommended)
brew install xmake
# Alternative: Direct installation
curl -fsSL https://xmake.io/shget.text | bash# Follow Linux instructions above
curl -fsSL https://xmake.io/shget.text | bash- Clone the repository:
git clone https://github.com/alvarorichard/MiJIT.git
cd MiJIT- Build the project:
xmake build- Run the program:
xmake run MiJIT# Build with g++
g++ -std=c++17 -Wall -Wextra -O2 main.cpp -o mijit
# Run the program
./mijit- Linux/macOS x86-64: Generates full system call to write() function
- Linux ARM64: Generates ARM64 system call instructions
- Apple Silicon: Uses simplified approach due to security restrictions
The machine code output shows the actual processor instructions that MiJIT created!
This project is open source. under the MIT License. See the LICENSE file for details.
Contributions welcome! Feel free to:
- Add support for more platforms
- Improve error handling
- Add more machine code examples
- Enhance documentation
MiJIT - Making JIT compilation simple and accessible!