That's fine with me, but then we should update the docs and remove the BUG section to a notice.
That's fine with me, but then we should update the docs and remove the BUG section to a notice.
Then let's close the issue and change the "sync/atomic" BUG docs. That would make other conversations with other projects easier.
Then let's close the issue and change the "sync/atomic" BUG docs. That would make other conversations with other projects easier.
On Sun, Sep 25, 2016 at 12:52 AM, Daniel Theophanes <kard...@gmail.com> wrote:I'm interested in in fixing https://github.com/golang/go/issues/599 which is to align 64-bit integers on 32-bit platforms. From first glance it looks like it might be a simple change to "cmd/compile/internal/gc/align.go" where the Field.Offset field gets assigned. But I'm either wrong on that or I haven't pushed the right buttons because the lights light up all wrong when I try.But first, is this a desirable change? Probably quite a bit of non-"sync/atomic" variables will be given padding to them. Should 8 byte alignment be done to variables with a "//go:align8" or similar?If this is a desirable change I would love to have a few pointers in the right direction.Increasing the alignment has profound effects on abi.For example, gcc doesn't align 64-bit integer to 8-byte either on 32-bit systems,so this struct:struct T { int a; long long b; };will no longer be representable in Go on 32-bit systems if Go aligns 64-bit intto 64-bit.
I think the issue #599 is more about stack/data alignment, which is differentfrom field alignment. The cited performance concern for 64-bit alignment isno longer true for recent Intel processors where unaligned moves don't havemuch performance penalty anymore.I also don't like introducing more magic comments.The only major problem of the current 32-bit alignment on 64-bit types issync/atomic, but I think that's not a big problem. If you're going to use lowlevel atomic operations, you are expected to know the hardware well andplan the structure layouts accordingly.