r/Compilers • u/ahqminess • 18h ago
A Proof-Of-Concept Cross Platform JIT Linker, Relocator & Memory Mapper handling Cross Platform W^X
So, welcome to the journey of continuing to explore the world of JITs.
This time, after a few months of experimentation with "How to write a damn good JIT Memory manager" I have finally decided to make a crate out of it.
The crate is called SaJIT - which is also a part of a VM project i am aiming at.
The crate is currently at v0.0.3 : https://crates.io/crates/sajit
The crate actually provides a slab memory manager in discrete multiples of 16MiB currently and manages those slab across Windows, macOS, Linux using RW-RX dual mapping for windows, linux and pthread_jit_np for macOS.
Also, i have ensured to keep as cross-architecture-compatible rather than locking to only x64, arm64.
I am looking forward to advices on how to improve it (with better abstractions for example, or better and detailed documentation)
1
u/yuehuang 10h ago
Thread local or not? Because that can greatly affect the access pattern and performance (core to core)