aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Hawkins <whh8b@obs.cr>2022-06-04 03:44:18 -0400
committerMichael Pratt <mpratt@google.com>2022-06-07 17:44:51 +0000
commit69bb7c6ef540caa422e5d7fd1127dd71e3ca90fe (patch)
tree804fb52b0be506006492138d34a9ae172b1a0d0e
parent81033fbd8e414447049e356af382fa6ecca072ea (diff)
downloadgo-69bb7c6ef540caa422e5d7fd1127dd71e3ca90fe.tar.gz
go-69bb7c6ef540caa422e5d7fd1127dd71e3ca90fe.zip
sync/atomic: clarify that 8-byte alignment of variables is due to escape
For #53223. Change-Id: I79e9b920488581a4d850e4051ee0dd600b5bbcb1 Reviewed-on: https://go-review.googlesource.com/c/go/+/410102 Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Austin Clements <austin@google.com>
-rw-r--r--src/sync/atomic/doc.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/sync/atomic/doc.go b/src/sync/atomic/doc.go
index 4d426826da..7977d13168 100644
--- a/src/sync/atomic/doc.go
+++ b/src/sync/atomic/doc.go
@@ -57,8 +57,9 @@ import (
// On ARM, 386, and 32-bit MIPS, it is the caller's responsibility to arrange
// for 64-bit alignment of 64-bit words accessed atomically via the primitive
// atomic functions (types Int64 and Uint64 are automatically aligned).
-// The first word in a variable or in an allocated struct, array, or slice can
-// be relied upon to be 64-bit aligned.
+// The first word in an allocated struct, array, or slice; in a global
+// variable; or in a local variable (because the subject of all atomic operations
+// will escape to the heap) can be relied upon to be 64-bit aligned.
// SwapInt32 atomically stores new into *addr and returns the previous *addr value.
func SwapInt32(addr *int32, new int32) (old int32)