-
Notifications
You must be signed in to change notification settings - Fork 105
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
Fix unaligned dereferencing (preparation for Rust upgrade) #3981
Conversation
and a few deps too needs patched toolset from mozilla (PRs submitted: mozilla/nixpkgs-mozilla#309)
Update: I also resolved an issue with the |
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.
LGTM
We'll need to be careful that @matthewhammer's regions PR doesn't introduce more 64-bit object fields.
Co-authored-by: Claudio Russo <claudio@dfinity.org>
Co-authored-by: Claudio Russo <claudio@dfinity.org>
Keep the current version and prepare upgrade for later
rustc
upgraderustc
upgrade
The performance of this PR without Rust compiler upgrade has been remeasured in #3999. No difference compared to master. |
rustc
upgradeThere 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.
I like how you divide the 64-bit members into two consecutive 32-bit ones, and how that avoids padding. Thanks for doing this!
Thank you also very much for reviewing! |
Thank you very much for the review. Yes, we need to be careful about future inserts of 64-bit fields. Once we have moved to new Rust version, the error would probably be reported at runtime. |
and a few deps too: - `wasi-libc` needs patched toolset from mozilla (PRs submitted: mozilla/nixpkgs-mozilla#309) TODO: - [x] `motoko-rts-test` fails in `stream flushing` with unaligned memory access — see #3981
Analysis:
64-bit
fields in a struct implies that the struct is also 64-bit-aligned. This is however not guaranteed in our heap as objects are only 32-bit aligned.Stream.rs
and inBitmapIterator.rs
for the Compacting GC. However, it is correctly aligned in the incremental GC.Intended as a fix for the build errors in #3947.