Mauri de Souza Meneguzzo c2dcde178d cmd/compile: add align128 compiler marker for 128-bit struct alignment
Add an align128 sentinel type to sync/atomic and
internal/runtime/atomic, analogous to align64. Embedding `_ align128`
in a struct causes the compiler to enforce 16-byte alignment on the
containing struct.

This is required for 128-bit atomic operations (CMPXCHG16B on amd64,
CASP on arm64), which require a 16-byte-aligned memory operand. A
struct containing two uint64 fields has natural alignment of 8 bytes,
so it may otherwise be placed at a non-16-byte-aligned offset within a
larger struct, causing faults or incorrect behavior.

No test: align128 is unexported in sync/atomic, and testing it in internal
would create cyclic dependencies with reflect.

For #61236.

Change-Id: Iab0502776141aed309457b462f2fdb60ec0d5245
GitHub-Last-Rev: 8cf379404d04c1fbe2b011975d5932eb9d9225da
GitHub-Pull-Request: golang/go#79991
Reviewed-on: https://go-review.googlesource.com/c/go/+/790320
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-07-16 07:44:12 -07:00
2026-07-15 12:15:25 -07:00

The Go Programming Language

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

Gopher image Gopher image by Renee French, licensed under Creative Commons 4.0 Attribution license.

Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.

Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.

Download and Install

Binary Distributions

Official binary distributions are available at https://go.dev/dl/.

After downloading a binary release, visit https://go.dev/doc/install for installation instructions.

Install From Source

If a binary distribution is not available for your combination of operating system and architecture, visit https://go.dev/doc/install/source for source installation instructions.

Contributing

Go is the work of thousands of contributors. We appreciate your help!

To contribute, please read the contribution guidelines at https://go.dev/doc/contribute.

Note that the Go project uses the issue tracker for bug reports and proposals only. See https://go.dev/wiki/Questions for a list of places to ask questions about the Go language.

Description
Languages
Go 95.1%
Assembly 4.5%
C 0.2%