-
Notifications
You must be signed in to change notification settings - Fork 385
Building a REPL on top of miri #511
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
Comments
Why are these crazy hacks involving the promoted necessary and what do they even do? |
Oh I forgot, running the miri evaluator should not pop the final function, but instead "just" create a special allocation that contains all (reachable?) allocations from Before starting the miri evaluator the next time, we make incremental give us the old value (more hacks, yay!) and restore the state from that. |
Wtf... you definitely are crazy.^^ |
I believe a moderately fast Rust REPL would do wonders for the Rust dev experience. @oli-obk how useful and fast would a miri based repl be? Fast enough to provide utility vs eg re-running code in the playground? Are your basic implementation suggestions from above still valid? Also, could miri theoretically be used to build a debugger with breakpoints and the ability to run code at those breakpoints? (printing values, modifying local variables before continuing, ...) |
around 100000 times slower than direct execution. Depends on the kind of things that are happening though.
I has been used to build such a thing practically: https://github.com/oli-obk/priroda We need to update it to the latest master branch though :) |
How fast would it be compared to actually compiling the code, not just the direct execution? |
I'm not sure how close this is to what you were envisioning, @oli-obk, but here's an approach aimed at making Rust usable in Jupyter notebooks: https://github.com/google/evcxr |
And there is going to be rust-lang/compiler-team#213. |
@bjorn3 Very cool! I did not know about that, actually. |
What's the current status of this? Has it been superseded by the possibility of a cranelift backend? |
Would a |
anything |
I don't see why a repl would have lots of code in common with Miri? |
well, if you do the interpretation on the MIR level, then you will end up with some sort of mir interpreter similar to the miri-engine. It could be implemented on something different (e.g. LLVM-IR) or just JIT the code, but then all the OS stuff still needs to get handled somehow, and that will probably be similar to what miri is doing. |
Right but I don't see why a REPL would be based on interpretation, TBH.^^ |
True... So I guess we stop tracking this here and close this issue? |
The advantage of building a repl on top of miri is that it could run in the browser. Rustc can successfully be compiled to wasm32-wasi with a few small changes. |
The playground can also run in the browser though... and honestly compiling and running this on a server will likely still be faster than running Miri in Wasm.^^ |
I'm going to go ahead and close this. Even if a REPL will be miri based, it's not necessary to track this here. |
@oli-obk is this being tracked anywhere else tho? I would love a Rust REPL, where y'all at? One idea is we could create a project, or zulip channel |
Have you seen evcxr? It has both support for jupyter notebooks as well as a regular repl. |
Uh oh!
There was an error while loading. Please reload this page.
@technetos so the steps are essentially
loop
around the main miri code in the miri binaryformat!("fn main() { let _: &'static *const () = &std::ptr::null(); {}}}", mut_string)
to create the "main.rs
" that you feed to the rust evaluatorconst_eval_provider
is used and follow the call stack up until you see how to do the overriding thing in miri)The text was updated successfully, but these errors were encountered: