-
Notifications
You must be signed in to change notification settings - Fork 243
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
Convert shim-shared-memory to Rust #2462
Conversation
3802858
to
c847455
Compare
Codecov ReportBase: 42.48% // Head: 43.39% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #2462 +/- ##
==========================================
+ Coverage 42.48% 43.39% +0.91%
==========================================
Files 180 185 +5
Lines 26710 27246 +536
Branches 5379 5414 +35
==========================================
+ Hits 11348 11824 +476
- Misses 12736 12762 +26
- Partials 2626 2660 +34
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
1ba3e7b
to
af5d10b
Compare
Just started a benchmark: https://github.com/shadow/benchmark/actions/runs/3237922848 I don't expect this to change performance, but good to double-check since this is somewhat in the hot path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks cool! While I think this approach takes a little more mental effort to make sure everything is safe, I think it's a lot easier to reason about and understand than the rkyv approach.
This is a trait for marking types that are safe to access from other virtual address spaces.
Also some minor tweaks to root Tags
Import
rootedcell
from https://github.com/sporksmith/objgraph/. This is a safe abstraction around the thread safety model used in Shadow, where access to a single Root object (which may be protected at a coarse level, such as by a per-Host lock) is used to prove that non-atomic operations are safe for "child" objects. This is the model used by the current shim shared memory API.Implement the VirtualAddressSpaceIndependent trait and Derive-macro. The former marks types as usable outside of their original virtual address space. The corresponding Derive macro is a safer way of implementing the trait for more-complex structs, by validating that all fields of that struct are VirtualAddressSpaceIndependent.
Convert the shim shared memory structs to Rust. For now this is a fairly direct translation into Rust, using the above to help ensure safety. We'll probably want more safe Rust APIs for accessing these, but for now the focus was just on reimplementing the C APIs.