You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmd/compile: make 64-bit fields 64-bit aligned on 32-bit systems #599
Even though the 386 has a 4-byte word size, some instructions move
data in larger chunks. In particular float64 loads move 8 bytes and
some SSE2 operations (as yet unused) move even larger amounts.
A float64 load from an only-4-byte-aligned address is significantly
more expensive than one from a 8-byte-aligned address. The same
is probably true of SSE2 too.
We should make sure that data symbols >32 bits (e.g., float64 constants)
are aligned on 8-byte boundaries in the data segment. (Fairly easy.)
We should also make sure that the stack pointer can be relied upon to be
8-byte aligned (harder), by making stack frame sizes = -4 mod 8
(the caller PC will add 4 more) and starting new goroutines with a
properly aligned stack pointer.
It might be worth using 16 bytes for the stack alignment. OS X requires
that for their own ABI, presumably because it matters for SSE2.
Reacted by Roberto Clapis, bronze1man, Google AutoFuzz Team, Oleg Broslavsky and Maria Nedyak
Too hard. I tried a few different things and failed miserably. The gc toolchain expects
that the struct and function argument frame alignments match. The stack frame
barely matters, since we don't take pointers of stack variables anymore, but that's
hard too.
This only really matters for atomics, and we do guarantee 64-bit alignment for the
base of an allocated struct or slice, so that will have to be good enough for now.
We didn't do it for 1.3. My guess is that in comment 13 I was referring to NaCl having
unusual alignment requirements, so perhaps that would pave the way.
Activity
rsc commentedon Dec 9, 2011
Comment 1:
Labels changed: added priority-someday.
rsc commentedon Sep 12, 2012
Comment 2:
Issue #3799 has been merged into this issue.
rsc commentedon Sep 12, 2012
Comment 3:
rsc commentedon Sep 12, 2012
Comment 4:
Labels changed: added priority-soon, removed priority-someday.
Status changed to Accepted.
rsc commentedon Sep 12, 2012
Comment 5:
Labels changed: added go1.1.
rsc commentedon Dec 10, 2012
Comment 7:
Labels changed: added size-l.
rsc commentedon Dec 22, 2012
Comment 8:
Labels changed: added priority-someday, removed priority-soon, go1.1.
rsc commentedon Dec 22, 2012
Comment 9:
Labels changed: added size-xl, removed size-l.
rsc commentedon Jul 30, 2013
Comment 10:
Labels changed: added go1.3maybe.
robpike commentedon Aug 20, 2013
Comment 11:
Labels changed: removed go1.3maybe.
rsc commentedon Oct 29, 2013
Comment 13:
Labels changed: added go1.3.
rsc commentedon Dec 4, 2013
Comment 14:
Labels changed: added release-go1.3.
rsc commentedon Dec 4, 2013
Comment 15:
Labels changed: removed go1.3.
rsc commentedon Dec 4, 2013
Comment 16:
Labels changed: added repo-main.
rsc commentedon Apr 3, 2014
Comment 17:
Labels changed: added release-go1.4, removed release-go1.3.
63 remaining items
design/36606-64-bit-field-alignment: add proposal
rsc commentedon Oct 7, 2020
Duplicate of #36606.
Fix not aligned uint64 variable
Fix not aligned uint64 variable
Use uint32 atomics
Use uint32 atomics