Rust: Hot code replacement

Created on 10 May 2013  ·  6Comments  ·  Source: rust-lang/rust

Hi I watched this http://www.youtube.com/watch?v=apZYqHPqzYo and thought it would be nice to have hot code replacement in Rust as well.

In Java, you have the OSGi project ( http://www.osgi.org/Main/HomePage ) and hotswap ( http://code.google.com/p/hotswap/ ), which facilitates upgrading and changing modules of your application without touching other modules.

E-hard

All 6 comments

It is really, extremely hard to do this with native code, especially in a cross-platform fashion. VMs have an easier time because they have full control over bytecode loading, code generation, code placement, etc.

I am not up-to-date on the latest research on the topic, but I found Kitsune: Efficient, General-purpose Dynamic Software Updating for C (OOPSLA 2012) interesting.

visited for triage, 17 July 2013. Hot-swapping is indeed tricky, though some of the things necessary to support it (e.g. marking pages as executable; I-cache flushing, etc) would also be necessary to support a JIT compiler.

I suspect we'd also need position-independent code (PIC). The Kitsune paper actually covers even more aggressive transformations, e.g. migrating the data layouts between versions. (I have only skimmed that paper at this point.)

This would be cool, but I feel comfortable saying it's probably not going to happen. I think there are many other difficult problems that are more compelling.

It was done a few times with compiled code through LLVM and its JIT. Which throws it into a VM and allows to do the same stuff Erlang can do inside its VM...
Inspiration: http://vimeo.com/36579366
Examples with C++:

If somebody wants to use a Low Level VM I guess they can do it in Rust too... For something like that to work you need to add the VM behavior anyway...

Was this page helpful?
0 / 5 - 0 ratings