Can we have the same for Go, pretty please?
Subsecond: A runtime hotpatching engine for Rust hot-reloading
21–30 of 41 posts
Re: Subsecond: A runtime hotpatching engine for Rust hot-reloading
#22Interesting, but the documentation makes it sound like you have to preemptively wrap all the code you think you might want to change in a special wrapper "call" function. If true that makes this a lot less appealing than existing solutions for other languages that can modify any function without special annotations.
Re: Subsecond: A runtime hotpatching engine for Rust hot-reloading
#23Neat but I would prefer simply using a dylib for the part of my code that I want to be reloadable.
[1] https://github.com/andreivasiliu/demimud/tree/master/netcore
Re: Subsecond: A runtime hotpatching engine for Rust hot-reloading
#24https://docs.rs/subsecond/0.7.0-alpha.1/subsecond/index.html...
"In practice, frameworks that implement subsecond patching properly will throw out the old state and thus you should never witness a segfault due to misalignment or size changes. Frameworks are encouraged to aggressively dispose of old state that might cause size and alignment changes."
I don't think "throwing out the old state" is a sensible recommendation. "re-instancing" is called "update/upgrade/downgede of internal state" in OTP:https://www.erlang.org/docs/24/man/gen_server#Module:code_ch...
Perhaps I'm missing something, maybe subsecond is a good tool for toy apps or for a developer workflow. But for anything serious, I'd think that managing layout of structs is a primary concern.
Re: Subsecond: A runtime hotpatching engine for Rust hot-reloading
#25Creator here - haven't had a chance to write up a blog post yet! Stay tuned. The gist of it is that we intercept the Rust linking phase and then drive `rustc` manually. There's some diffing logic that compares assembly between compiles and then a linking phase where we patch symbols against the running process. Works across macOS, Windows, Linux, iOS, Android, and WASM. On my m4 I can get 130ms compile-patch times, q…
Re: Subsecond: A runtime hotpatching engine for Rust hot-reloading
#26About structs: https://docs.rs/subsecond/0.7.0-alpha.1/subsecond/index.html... "In practice, frameworks that implement subsecond patching properly will throw out the old state and thus you should never witness a segfault due to misalignment or size changes. Frameworks are encouraged to aggressively dispose of old state that might cause size and alignment changes." I don't think "throwing out the old state" is a sensi…
That being said, bevy is using bevy-reflect to implement proper struct hot-reloading between hot-patches.
Re: Subsecond: A runtime hotpatching engine for Rust hot-reloading
#27About structs: https://docs.rs/subsecond/0.7.0-alpha.1/subsecond/index.html... "In practice, frameworks that implement subsecond patching properly will throw out the old state and thus you should never witness a segfault due to misalignment or size changes. Frameworks are encouraged to aggressively dispose of old state that might cause size and alignment changes." I don't think "throwing out the old state" is a sensi…
debug_assertions is usually only enabled in the development phase (release build default to debug_assertions=false), so yes this is not intended for production workloads
Re: Subsecond: A runtime hotpatching engine for Rust hot-reloading
#28Basically, julia is dynamically typed, but inside a function it acts like a statically type language within a fixed world-age. So that means that based on the input types to a function, the compiler is able to know that the method table is not allowed to change, const-global, and types also can't change.
Between world-ages however, anything goes. You can redefine methods, redefine structs, etc. What's especailly nice is that old data doesn't become invalid, it's just living in an old world, and if you get a Foo struct you can know what world it comes from.
We have an invokelatest and invoke_in_world functions for advancing the world-age inside functions, and users creating something like an event loop just wrap their event loop iterations in an `invokelatest` and suddenly everything hot reloads automatically as you change code in your editor.
Re: Subsecond: A runtime hotpatching engine for Rust hot-reloading
#29Creator here - haven't had a chance to write up a blog post yet! Stay tuned. The gist of it is that we intercept the Rust linking phase and then drive `rustc` manually. There's some diffing logic that compares assembly between compiles and then a linking phase where we patch symbols against the running process. Works across macOS, Windows, Linux, iOS, Android, and WASM. On my m4 I can get 130ms compile-patch times, q…
Edit: or, I guess since this doesn't seem to be something intended for use in prod, maybe that's not necessary. You can just bloat the runtime process more or less indefinitely.
I was curious because IIUC Linux kernel livepatches handle this via something related to RCU, which I guess is not possible in this context.
Re: Subsecond: A runtime hotpatching engine for Rust hot-reloading
#30Creator here - haven't had a chance to write up a blog post yet! Stay tuned. The gist of it is that we intercept the Rust linking phase and then drive `rustc` manually. There's some diffing logic that compares assembly between compiles and then a linking phase where we patch symbols against the running process. Works across macOS, Windows, Linux, iOS, Android, and WASM. On my m4 I can get 130ms compile-patch times, q…