3 ms·
I'd actually love to see a relatively high-performance (i.e., including a decent JIT) runtime for a dynamic language that's written in Rust. There's a lot of im
by anematode 4mo ago
I'd actually love to see a relatively high-performance (i.e., including a decent JIT) runtime for a dynamic language that's written in Rust. There's a lot of implementations like Rust Python, the Boa JS engine, etc. that are purely interpreted – and fun! – but I haven't seen a proper, high-performance VM yet.
I considered writing such a JVM in Rust, following writing one in C (https://github.com/anematode/b-jvm https://github.com/anematode/b-jvm) that could JIT WebAssembly code and run in the browser, but decided it would be too time-consuming.
Obviously such a VM would involve a lot of unsafe, but I'm wondering if you could establish some proper, compile-time-checked invariants that make things a lot safer, without the complicated sandboxing that modern JS runtimes use to make it harder for JIT bugs to escalate into full blown RCE.
- jitl 4mo agorust seems alergic to the un-safety required of "i dynamically built this executable code segment just now, please jump into it"
- anematode 4mo agowasmtime exists
- jitl 4mo agoyes i love to use a language runtime within another language runtime for a sweet sweet 30% performance penalty
- anematode 4mo agoWhy the snark? wasmtime is a (pretty popular) Rust project which uses a JIT, demonstrating that it's not incompatible with Rust. Obviously a proper VM wouldn't depend on wasmtime, but implement its own JIT and paraphernalia.
- jitl 4mo agofair. i guess i used “rust” in collective noun sense for “rust the ecosystem and community”; from my armchair experience there’s a big contingent of that community that abhors unsafe and software that uses it, and it’s that community/ecosystem aspect that prohibits unsafe since of course the language and compiler support it just fine.
- tomjakubowski 4mo agoThe community does not abhor use of unsafe. The community abhors bad usage of unsafe: unsafe code should be used only when necessary, and ideally to build safe abstractions.
- tomjakubowski 4mo agoThis is wrong, demonstrably. There are multiple OS kernels written in Rust (with small amounts of ASM glue, as is required in any kernel project).