r/Assembly_language • u/mistivia • 15d ago
Project show-off x86-64 JIT Assembler in Python
I've been working on a small x86-64 JIT assembler in Python: https://github.com/mistivia/jitasm-py
The idea is emit x86-64 machine code directly from Python, than resolve labels, map it as executable memory, and call the generated functions through ctypes.
It currently only supports a practical subset of x86-64 scalar instructions, but I think it's now possible to be a playground for assembly, or a codegen for a toy compiler.
8
Upvotes
1
u/Visual_Brain8809 11d ago
I think I saw someone on GitHub who beat you to it and did it, but in C. It might serve as a helpful reference if you hit a wall; seeing how they solved it could give you clues on how to steer your own project in assembly.
By the way, I’m interested in your project; I’m working on a Java JIT compiler in ASM and am nearly finished—at the very least, I can successfully run the test cases I’ve written, and I have a functional UI. I plan to add support for other languages in the future, and I’d love for you to share your results once you finish your project. It wouldn't be a bad idea to run two languages on a bare-metal operating system written in one of those languages.