From: Dave Cheney Date: Thu, 8 Oct 2015 09:14:03 +0000 (+1100) Subject: cmd/internal/obj: improve obj.ProgInfo struct layout X-Git-Tag: go1.6beta1~880 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b795ce9ab0cce86f9f76904a9f933b11ac993c8a;p=gostls13.git cmd/internal/obj: improve obj.ProgInfo struct layout obj.ProgInfo is a field inside obj.Prog, which is currently 320 bytes on 64bit platforms. By moving the Flags field below the other fields the size of obj.Prog drops into the 288 byte size class, a saving of 32 bytes per value allocated on the heap. Change-Id: If8bb12f45328996d7df1d0bac9d1c019d2af73bd Reviewed-on: https://go-review.googlesource.com/15522 Run-TryBot: Dave Cheney TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- diff --git a/src/cmd/internal/obj/link.go b/src/cmd/internal/obj/link.go index 4d6f7d7bdb..3a1faa2edf 100644 --- a/src/cmd/internal/obj/link.go +++ b/src/cmd/internal/obj/link.go @@ -247,10 +247,10 @@ func (p *Prog) From3Offset() int64 { // by clients such as the compiler. The exact meaning of this // data is up to the client and is not interpreted by the cmd/internal/obj/... packages. type ProgInfo struct { - Flags uint32 // flag bits Reguse uint64 // registers implicitly used by this instruction Regset uint64 // registers implicitly set by this instruction Regindex uint64 // registers used by addressing mode + Flags uint32 // flag bits _ struct{} // to prevent unkeyed literals }