rustc_codegen_cranelift
rustc_codegen_cranelift copied to clipboard
Add experimental jit mode integration to cargo
https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/jit.20support
So would this mean:
CG_CLIF_JIT=1 cargo build
target/debug/foo
will:
- produce a debug binary
- the binary when run, will have instrumentation necessary to jit parts of the code in foo that would normally be AOT
No, in the JIT mode the rustc invocation that "builds" the executable actually JITs it and then immediately runs it. No executable is written to the disk. I did imagine that the cargo command would be cargo run --jit.
Oh interesting, is it possible to share the majority of the dep tree (e.g., i have 400 crates) when jitting, so a modify source, cargo jit loop would be faster?
And today, if i pass this flag to cargo cranelift and do cargo run, this won't do as you say above, right? It only currently works with explicit invocations of the cranelift using rustc, yes?
Also, are there any plans to implement 2. I guess it's similar to adding something like a ~~java~~ Rust HotSpot in each binary ; )
Oh interesting, is it possible to share the majority of the dep tree (e.g., i have 400 crates) when jitting, so a modify source, cargo jit loop would be faster?
Currently only dylibs can be loaded by the JIT. I want to also make it work with rlibs though.
And today, if i pass this flag to cargo cranelift and do cargo run, this won't do as you say above, right? It only currently works with explicit invocations of the cranelift using rustc, yes?
It will kinda work if you use your cargo build command, but build scripts will also be JITed, causing cargo to fail to run the executable it expects to be created.
Also, are there any plans to implement 2. I guess it's similar to adding something like a java Rust HotSpot in each binary ; )
I may attempt to integrate the Yorick meta tracer in the future. It does require explicit annotations about when to JIT what. It is also only meant to optimize language interpreters, not your average program.