-
Notifications
You must be signed in to change notification settings - Fork 103
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
Make it possible to use this as backend for the rust REPL #817
Comments
Necessary changes
Did I miss something @alexreg? |
Yep, I think mainly right. A few further thoughts:
|
Being able to pass the local <-> address map was the reason to use a custom __rustc_codegen_backend.
Yes, I meant a hash of both the fnsig and mir of all functions, methods and statics (the
If an fnptr is created to a function, it will be assumed to be used. When the function is not changed, the old compilation will be reused. ("prevent duplicate codegen")
I meant the reusing of previous compilation to be handled by cg_clif. As for the hash collision, that would screw the incr cache up anyway, as the same hash used for the incr cache will be used.
We have to handle the case of fn a casted to an fnptr, next time being unused and then being used again.
Yeah
Panics can't be catched yet. And segfaults are indeed problematic.
Yes, but that would only help if it can't call native methods. Emulating those is going to take a lot of time. (even miri supports only a fraction after several years)
Almost everything calls unsafe code. Simply
At leasr it would be nice to recover serializable values. And maybe add a |
Yeah, but I just meant it doesn't need to return anything back to the REPL... I think?
Indeed, it doesn't. I wonder if we should be worried about hash collision though... if we should, I think my memcmp approach works, yes? At a cost of extra computation, but no extra memory (except ephemeral memory usage).
Oh, I was being obtuse. So, the optimisation is basically "don't codegen the same fn/method & body twice", with the caveat that we can't do this optimisation when a fnptr is created to that fn/method.
Fair enough (although I think future versions of incr. comp. may avoid the matter of hashing altogether, in fact). I see no reason not to use in-memory incr. comp. anyway, but that's orthogonal to these issues I suppose.
Okay. I assume you'll work on the former at some point. With the latter, we definitely need to see how C/C++ REPLs do this.
Yeah... I was thinking we could just ignore that, but special-casing probably isn't wise.
Yes, not a bad idea. But again, let's see what existing C/C++ REPLs do. |
Unfortunately the REPL is very likely abandoned before the source was published. |
Sorry @bjorn3, I haven't been involved in Rust at all for about a year now. I've moved on to other languages and other pastures... |
No worries. |
The rust REPL is currently in development: rust-lang/compiler-team#213
Discussion with @alexreg about integration: https://zulip-archive.rust-lang.org/131828tcompiler/81358REPLCraneliftbackend.html
Depends on https://github.com/bytecodealliance/cranelift/issues/1260 to prevent a memory leak.
The text was updated successfully, but these errors were encountered: