Stream: cranelift

Topic: JIT Hot Swapping


view this post on Zulip Dima (Jun 26 2024 at 10:18):

If someone would like to have a hot-reloadable rust functions using cranelift rust backend, how would someone start to implement such a feature? Any links or resources would be appreciated.

view this post on Zulip bjorn3 (Jun 26 2024 at 11:37):

cc https://github.com/rust-lang/rustc_codegen_cranelift/tree/wip_hot_code_swapping Be aware however that it crashes after just a couple of reloads as every reload will recompile all functions and memory fragmentation will quickly cause all jitted code to be spread out over more than 2GB of memory, which cranelift-jit doesn't like.

Cranelift based backend for rustc. Contribute to rust-lang/rustc_codegen_cranelift development by creating an account on GitHub.

view this post on Zulip Dima (Jun 26 2024 at 12:11):

@bjorn3 nice!

2222 commits behind master... any plans to update the branch to current master, any roadmap how to bring functional hot reloading? :)

view this post on Zulip bjorn3 (Jun 26 2024 at 12:14):

I guess I will update it at some point. No plans at all for when though. Don't expect it within the next couple of months at least. There are bigger priorities than hot code swapping.

view this post on Zulip Dima (Jun 26 2024 at 12:18):

I see... thanks for incredible work.. just tried cranelift backend yesterday on m1 and it compiled big project fine 20% faster then llvm backend.. and it felt much lighter compilation (I guess it's due to less CPU time needed for cranelift).


Last updated: Nov 22 2024 at 16:03 UTC