Skip to content

Hot code replacement #6381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mictadlo opened this issue May 10, 2013 · 6 comments
Closed

Hot code replacement #6381

mictadlo opened this issue May 10, 2013 · 6 comments
Labels
E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot.

Comments

@mictadlo
Copy link

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.

@alexrp
Copy link

alexrp commented May 10, 2013

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.

@sanxiyn
Copy link
Member

sanxiyn commented May 10, 2013

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.

@pnkfelix
Copy link
Member

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

@catamorphism
Copy link
Contributor

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.

@lilianmoraru
Copy link

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

@tyoc213
Copy link
Contributor

tyoc213 commented Dec 7, 2015

I will add this only for reference http://runtimecompiledcplusplus.blogspot.co.uk/ and the code https://github.com/RuntimeCompiledCPlusPlus/RuntimeCompiledCPlusPlus

and https://bentheelder.github.io/blog/rust-hotswap.html

flip1995 pushed a commit to flip1995/rust that referenced this issue Dec 6, 2020
… r=ebroto

Add lint size_of_in_element_count

Fixes rust-lang#6381
changelog: Add lint to check for using size_of::<T> or size_of_val::<T> in the count parameter to ptr::copy or ptr::copy_nonoverlapping, which take a count of Ts (And not a count of bytes)

- \[X] Followed [lint naming conventions][lint_naming]
- \[X] Added passing UI tests (including committed `.stderr` file)
- \[ ] `cargo test` passes locally
- \[X] Executed `cargo dev update_lints`
- \[X] Added lint documentation
- \[X] Run `cargo dev fmt`

[lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints

Running `cargo test` locally fails with this error:

```
running 1 test
test fmt ... FAILED

failures:

---- fmt stdout ----
status: exit code: 1
stdout:
stderr: error: unable to unlink old fallback exe
error: caused by: Access is denied. (os error 5)

thread 'fmt' panicked at 'Formatting check failed. Run `cargo dev fmt` to update formatting.', tests\fmt.rs:32:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

failures:
    fmt

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
```

But I did run `cargo dev fmt`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot.
Projects
None yet
Development

No branches or pull requests

7 participants