go/src/sync/atomic
Austin Clements 83317d9e3c runtime/internal/atomic: panic nicely on unaligned 64-bit atomics
On 386 and arm, unaligned 64-bit atomics aren't safe, so we check for
this and panic. Currently, we panic by dereferencing nil, which may be
expedient but is pretty user-hostile since it gives no hint of what
the actual problem was.

This CL replaces this with an actual panic. The only subtlety here is
now the atomic assembly implementations are calling back into Go, so
they have to play nicely with stack maps and stack scanning. On 386,
this just requires declaring NO_LOCAL_POINTERS. On arm, this is
somewhat more complicated: first, we have to move the alignment check
into the functions that have Go signatures. Then we have to support
both the tail call from these functions to the underlying
implementation (which requires that they have no frame) and the call
into Go to panic (which requires that they have a frame). We resolve
this by forcing them to have no frame and setting up the frame
manually just before the panic call.

Change-Id: I19f1e860045df64088013db37a18acea47342c69
Reviewed-on: https://go-review.googlesource.com/c/go/+/262778
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2020-10-16 17:31:17 +00:00
..
asm.s sync/atomic: redirect many functions to runtime/internal/atomic 2018-05-03 21:35:01 +00:00
atomic_test.go runtime/internal/atomic: panic nicely on unaligned 64-bit atomics 2020-10-16 17:31:17 +00:00
doc.go sync/atomic: remove panic64 2020-03-19 19:46:54 +00:00
example_test.go sync/atomic: use package prefix in examples 2018-04-18 23:58:54 +00:00
race.s
value.go
value_test.go all: fix incorrect channel and API usage in some unit tests 2020-02-27 19:04:17 +00:00