Skip to content

Commit 0ca4906

Browse files
author
Lukas Markeffsky
committed
asm!: clarify that nomem / readonly can access "private" memory
1 parent c118ff6 commit 0ca4906

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)