This check was originally implemented by Vladimir in
https://go-review.googlesource.com/c/31489/1/src/runtime/internal/atomic/atomic_mipsx.go#30
but removed due to my comment (Sorry!). This CL adds it back.
Fixes #17786.
Change-Id: I7ff4c2539fc9e2afd8199964b587a8ccf093b896
Reviewed-on: https://go-review.googlesource.com/33431
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
//go:nosplit
func lockAndCheck(addr *uint64) {
- // force dereference before taking lock
+ // ensure 8-byte alignement
+ if uintptr(unsafe.Pointer(addr))&7 != 0 {
+ addr = nil
+ }
+ // force dereference before taking lock
_ = *addr
spinLock(&lock.state)
if unsafe.Sizeof(int(0)) != 4 {
t.Skip("test only runs on 32-bit systems")
}
- case "amd64p32", "mips", "mipsle":
- // amd64p32 and mips can handle unaligned atomics.
+ case "amd64p32":
+ // amd64p32 can handle unaligned atomics.
t.Skipf("test not needed on %v", runtime.GOARCH)
}
if unsafe.Sizeof(int(0)) != 4 {
t.Skip("test only runs on 32-bit systems")
}
- case "amd64p32", "mips", "mipsle":
- // amd64p32 and mips can handle unaligned atomics.
+ case "amd64p32":
+ // amd64p32 can handle unaligned atomics.
t.Skipf("test not needed on %v", runtime.GOARCH)
}