Remix.run Logo
anematode 2 hours 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) 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 an hour ago | parent [-]

rust seems alergic to the un-safety required of "i dynamically built this executable code segment just now, please jump into it"

anematode 30 minutes ago | parent [-]

wasmtime exists

jitl 24 minutes ago | parent [-]

yes i love to use a language runtime within another language runtime for a sweet sweet 30% performance penalty

anematode 15 minutes ago | parent [-]

Why 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.