Skip to content

Commit 687faf9

Browse files
authored
Merge pull request #1598 from lukas-code/asm-mem
`asm!`: clarify that `nomem` / `readonly` can access private memory
2 parents e7345c9 + 0ca4906 commit 687faf9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/inline-assembly.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -505,12 +505,12 @@ r[asm.options.supported-options.pure]
505505
The `pure` option must be combined with either the `nomem` or `readonly` options, otherwise a compile-time error is emitted.
506506

507507
r[asm.options.supported-options.nomem]
508-
- `nomem`: The `asm!` blocks does not read or write to any memory.
508+
- `nomem`: The `asm!` block does not read from or write to any memory accessible outside of the `asm!` block.
509509
This allows the compiler to cache the values of modified global variables in registers across the `asm!` block since it knows that they are not read or written to by the `asm!`.
510510
The compiler also assumes that this `asm!` block does not perform any kind of synchronization with other threads, e.g. via fences.
511511

512512
r[asm.options.supported-options.readonly]
513-
- `readonly`: The `asm!` block does not write to any memory.
513+
- `readonly`: The `asm!` block does not write to any memory accessible outside of the `asm!` block.
514514
This allows the compiler to cache the values of unmodified global variables in registers across the `asm!` block since it knows that they are not written to by the `asm!`.
515515
The compiler also assumes that this `asm!` block does not perform any kind of synchronization with other threads, e.g. via fences.
516516

0 commit comments

Comments
 (0)