|
15 | 15 | //! Specifically, if an SC load reads from an atomic store of any ordering, then a later SC load cannot read from
|
16 | 16 | //! an earlier store in the location's modification order. This is to prevent creating a backwards S edge from the second
|
17 | 17 | //! load to the first, as a result of C++20's coherence-ordered before rules.
|
| 18 | +//! (This seems to rule out behaviors that were actually permitted by the RC11 model that C++20 |
| 19 | +//! intended to copy (https://plv.mpi-sws.org/scfix/paper.pdf); a change was introduced when |
| 20 | +//! translating the math to English. According to Viktor Vafeiadis, this difference is harmless. So |
| 21 | +//! we stick to what the standard says, and allow fewer behaviors.) |
18 | 22 | //!
|
19 | 23 | //! Rust follows the C++20 memory model (except for the Consume ordering and some operations not performable through C++'s
|
20 | 24 | //! `std::atomic<T>` API). It is therefore possible for this implementation to generate behaviours never observable when the
|
@@ -138,6 +142,7 @@ struct StoreElement {
|
138 | 142 |
|
139 | 143 | /// The timestamp of the storing thread when it performed the store
|
140 | 144 | timestamp: VTimestamp,
|
| 145 | + |
141 | 146 | /// The value of this store. `None` means uninitialized.
|
142 | 147 | // FIXME: Currently, we cannot represent partial initialization.
|
143 | 148 | val: Option<Scalar>,
|
@@ -356,9 +361,9 @@ impl<'tcx> StoreBuffer {
|
356 | 361 | false
|
357 | 362 | } else if is_seqcst && store_elem.load_info.borrow().sc_loaded {
|
358 | 363 | // The current SC load cannot read-before a store that an earlier SC load has observed.
|
359 |
| - // See https://github.com/rust-lang/miri/issues/2301#issuecomment-1222720427 |
| 364 | + // See https://github.com/rust-lang/miri/issues/2301#issuecomment-1222720427. |
360 | 365 | // Consequences of C++20 §31.4 [atomics.order] paragraph 3.1, 3.3 (coherence-ordered before)
|
361 |
| - // and 4.1 (coherence-ordered before between SC makes global total order S) |
| 366 | + // and 4.1 (coherence-ordered before between SC makes global total order S). |
362 | 367 | false
|
363 | 368 | } else {
|
364 | 369 | true
|
|
0 commit comments