Skip to content

Commit 22a1674

Browse files
committed
Update README
1 parent 55f938c commit 22a1674

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

README.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ for example:
2020
or an invalid enum discriminant)
2121
* **Experimental**: Violations of the [Stacked Borrows] rules governing aliasing
2222
for reference types
23-
* **Experimental**: Data races (but no weak memory effects)
23+
* **Experimental**: Data races
24+
* **Experimental**: Weak memory emulation
2425

2526
On top of that, Miri will also tell you about memory leaks: when there is memory
2627
still allocated at the end of the execution, and that memory is not reachable
@@ -62,9 +63,11 @@ in your program, and cannot run all programs:
6263
not support networking. System API support varies between targets; if you run
6364
on Windows it is a good idea to use `--target x86_64-unknown-linux-gnu` to get
6465
better support.
65-
* Threading support is not finished yet. E.g., weak memory effects are not
66-
emulated and spin loops (without syscalls) just loop forever. There is no
67-
threading support on Windows.
66+
* Threading support is not finished yet. E.g. spin loops (without syscalls) just
67+
loop forever. There is no threading support on Windows.
68+
* Weak memory emulation may produce weak behaivours unobservable by compiled
69+
programs running on real hardware when `SeqCst` fences are used, and it cannot
70+
produce all behaviors possibly observable on real hardware.
6871

6972
[rust]: https://www.rust-lang.org/
7073
[mir]: https://github.com/rust-lang/rfcs/blob/master/text/1211-mir.md
@@ -253,20 +256,20 @@ environment variable:
253256
Using this flag is **unsound**.
254257
* `-Zmiri-disable-data-race-detector` disables checking for data races. Using
255258
this flag is **unsound**. This implies `-Zmiri-disable-weak-memory-emulation`.
259+
* `-Zmiri-disable-isolation` disables host isolation. As a consequence,
260+
the program has access to host resources such as environment variables, file
261+
systems, and randomness.
256262
* `-Zmiri-disable-stacked-borrows` disables checking the experimental
257263
[Stacked Borrows] aliasing rules. This can make Miri run faster, but it also
258264
means no aliasing violations will be detected. Using this flag is **unsound**
259265
(but the affected soundness rules are experimental).
260-
* `-Zmiri-disable-weak-memory-emulation` disables the emulation of some C++11 weak
261-
memory effects.
262266
* `-Zmiri-disable-validation` disables enforcing validity invariants, which are
263267
enforced by default. This is mostly useful to focus on other failures (such
264268
as out-of-bounds accesses) first. Setting this flag means Miri can miss bugs
265269
in your program. However, this can also help to make Miri run faster. Using
266270
this flag is **unsound**.
267-
* `-Zmiri-disable-isolation` disables host isolation. As a consequence,
268-
the program has access to host resources such as environment variables, file
269-
systems, and randomness.
271+
* `-Zmiri-disable-weak-memory-emulation` disables the emulation of some C++11 weak
272+
memory effects.
270273
* `-Zmiri-isolation-error=<action>` configures Miri's response to operations
271274
requiring host access while isolation is enabled. `abort`, `hide`, `warn`,
272275
and `warn-nobacktrace` are the supported actions. The default is to `abort`,

src/weak_memory.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
//! Implementation of C++11-consistent weak memory emulation using store buffers
22
//! based on Dynamic Race Detection for C++ ("the paper"):
33
//! https://www.doc.ic.ac.uk/~afd/homepages/papers/pdfs/2017/POPL.pdf
4-
//!
4+
//!
55
//! This implementation will never generate weak memory behaviours forbidden by the C++11 model,
66
//! but it is incapable of producing all possible weak behaviours allowed by the model. There are
77
//! certain weak behaviours observable on real hardware but not while using this.
8-
//!
8+
//!
99
//! Note that this implementation does not take into account of C++20's memory model revision to SC accesses
1010
//! and fences introduced by P0668 (https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0668r5.html).
1111
//! This implementation is not fully correct under the revised C++20 model and may generate behaviours C++20
1212
//! disallows.
13-
//!
13+
//!
1414
//! Rust follows the full C++20 memory model (except for the Consume ordering). It is therefore
1515
//! possible for this implementation to generate behaviours never observable when the same program is compiled and
1616
//! run natively. Unfortunately, no literature exists at the time of writing which proposes an implementable and C++20-compatible
1717
//! relaxed memory model that supports all atomic operation existing in Rust. The closest one is
1818
//! A Promising Semantics for Relaxed-Memory Concurrency by Jeehoon Kang et al. (https://www.cs.tau.ac.il/~orilahav/papers/popl17.pdf)
1919
//! However, this model lacks SC accesses and is therefore unusable by Miri (SC accesses are everywhere in library code).
20-
//!
20+
//!
2121
//! If you find anything that proposes a relaxed memory model that is C++20-consistent, supports all orderings Rust's atomic accesses
2222
//! and fences accept, and is implementable (with operational semanitcs), please open a GitHub issue!
23-
//!
23+
//!
2424
//! One characteristic of this implementation, in contrast to some other notable operational models such as ones proposed in
2525
//! Taming Release-Acquire Consistency by Ori Lahav et al. (https://plv.mpi-sws.org/sra/paper.pdf) or Promising Semantics noted above,
2626
//! is that this implementation does not require each thread to hold an isolated view of the entire memory. Here, store buffers are per-location

0 commit comments

Comments
 (0)