Improve comments from #72617, as suggested by RalfJung#73925
Improve comments from #72617, as suggested by RalfJung#73925bors merged 2 commits intorust-lang:masterfrom eduardosm:improve-pr72617-comments
Conversation
src/libstd/panicking.rs
Outdated
| // equal to zero, so TLS access can be avoided. | ||
| // | ||
| // A relaxed atomic load is equivalent to a normal aligned memory read | ||
| // (e.g., a `mov` instruction in x86), while a TLS access might require |
There was a problem hiding this comment.
It is not equivalent. The compiler can optimize relaxed less than it can optimize normal reads.
Another way to see that they are not equivalent: replacing this relaxed access by a normal aligned read would result in Undefined Behavior. If two things are truly equivalent, then replacing one by the other changes nothing.
There was a problem hiding this comment.
What about "In terms of performance, a relaxed atomic load is similar to a normal aligned memory read (e.g., a mov instruction in x86), but with some compiler optimization restrictions."?
|
Thanks. :) |
|
📌 Commit 0f1adc8 has been approved by |
|
⌛ Testing commit 0f1adc8 with merge c37547168f1b0b298cbb96aedbbf9fc1b46dc209... |
|
💔 Test failed - checks-actions |
|
@bors retry |
…arth Rollup of 12 pull requests Successful merges: - rust-lang#73140 (Fallback to xml.etree.ElementTree) - rust-lang#73670 (Add `format_args_capture` feature) - rust-lang#73693 (Use exhaustive match in const_prop.rs) - rust-lang#73845 (Use &raw in A|Rc::as_ptr) - rust-lang#73861 (Create E0768) - rust-lang#73881 (Standardize bibliographic citations in rustc API docs) - rust-lang#73925 (Improve comments from rust-lang#72617, as suggested by RalfJung) - rust-lang#73949 ([mir-opt] Fix mis-optimization and other issues with the SimplifyArmIdentity pass) - rust-lang#73984 (Edit docs for rustc_data_structures::graph::scc) - rust-lang#73985 (Fix "getting started" link) - rust-lang#73997 (fix typo) - rust-lang#73999 (Bump mingw-check CI image from Ubuntu 16.04 to 18.04.) Failed merges: - rust-lang#74000 (add `lazy_normalization_consts` feature gate) r? @ghost
r? @RalfJung