Skip to content

Add experimental jit mode integration to cargo #1066

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bjorn3 opened this issue Jul 13, 2020 · 5 comments
Open

Add experimental jit mode integration to cargo #1066

bjorn3 opened this issue Jul 13, 2020 · 5 comments
Labels
A-jit Area: JIT compilation C-enhancement Category: An issue proposing an enhancement or a PR with one. compile-time How fast is the code compiled

Comments

@bjorn3
Copy link
Member

bjorn3 commented Jul 13, 2020

https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/jit.20support

@bjorn3 bjorn3 added C-enhancement Category: An issue proposing an enhancement or a PR with one. compile-time How fast is the code compiled A-jit Area: JIT compilation labels Jul 13, 2020
@m4b
Copy link

m4b commented Sep 29, 2020

So would this mean:

CG_CLIF_JIT=1 cargo build
target/debug/foo

will:

  1. produce a debug binary
  2. the binary when run, will have instrumentation necessary to jit parts of the code in foo that would normally be AOT

@bjorn3
Copy link
Member Author

bjorn3 commented Sep 29, 2020

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.

@m4b
Copy link

m4b commented Sep 29, 2020

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?

@m4b
Copy link

m4b commented Sep 29, 2020

Also, are there any plans to implement 2. I guess it's similar to adding something like a java Rust HotSpot in each binary ; )

@bjorn3
Copy link
Member Author

bjorn3 commented Sep 29, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-jit Area: JIT compilation C-enhancement Category: An issue proposing an enhancement or a PR with one. compile-time How fast is the code compiled
Projects
None yet
Development

No branches or pull requests

2 participants