Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asm!: clarify that nomem / readonly can access private memory #1598

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/inline-assembly.md
Original file line number Diff line number Diff line change
Expand Up @@ -505,12 +505,12 @@ r[asm.options.supported-options.pure]
The `pure` option must be combined with either the `nomem` or `readonly` options, otherwise a compile-time error is emitted.

r[asm.options.supported-options.nomem]
- `nomem`: The `asm!` blocks does not read or write to any memory.
- `nomem`: The `asm!` block does not read from or write to any memory accessible outside of the `asm!` block.
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!`.
The compiler also assumes that this `asm!` block does not perform any kind of synchronization with other threads, e.g. via fences.

r[asm.options.supported-options.readonly]
- `readonly`: The `asm!` block does not write to any memory.
- `readonly`: The `asm!` block does not write to any memory accessible outside of the `asm!` block.
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!`.
The compiler also assumes that this `asm!` block does not perform any kind of synchronization with other threads, e.g. via fences.

Expand Down