#jit #jit-compiler #interpreter #compiler

bin+lib jit_rs

jit.rs is a library for generating, optimizing and running executable code at runtime

4 releases

0.1.3 Jul 2, 2021
0.1.2 Jul 2, 2021
0.1.1 Jul 2, 2021
0.1.0 Jul 2, 2021

#967 in Programming languages

MIT license

9KB
108 lines

jit.rs

jit.rs is a library for generating, optimizing and running executable code at runtime.

fn main() {
    // Machine code that returns int value 13
    let bytes = [0xb8, 0x0d, 0x00, 0x00, 0x00, 0xc3];

    // Execute code stored in `bytes`
    let r = unsafe { jit_rs::execute_bytes::<i32>(&bytes) };

    // Prints 13
    println!("Hello, world! {}", r);
}

Dependencies

~123MB
~2M SLoC