jit 0.9.1

Just-In-Time Compilation in Rust using LibJIT bindings
1
2
3
4
5
6
7
8
9
10
11
12
extern crate jit;
#[no_link] #[macro_use]
extern crate jit_macros;
static TEXT:&'static str = "Hello, world!";

fn main() {
    use jit::*;
    let mut ctx = Context::<()>::new();
    jit_func!(&mut ctx, func, fn() -> &'static str {
        func.insn_return(TEXT.compile(func));
    }, assert_eq!(TEXT, func()));
}