cmd/internal/obj: replace Addr.U struct {...} with Val interface{}

An interface{} is more in the spirit of the original union.
By my calculations, on 64-bit systems this reduces
Addr from 120 to 80 bytes, and Prog from 592 to 424 bytes.

Change-Id: I0d7b0981513c2a3c94c9ac76bb4f8816485b5a3c
Reviewed-on: https://go-review.googlesource.com/7744
Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
Russ Cox 2015-03-16 15:54:44 -04:00
parent 631d6a33bf
commit 532ccae154
33 changed files with 164 additions and 164 deletions

View file

@ -114,8 +114,8 @@ func removevardef(firstp *obj.Prog) {
p.Link = p.Link.Link
}
if p.To.Type == obj.TYPE_BRANCH {
for p.To.U.Branch != nil && (p.To.U.Branch.As == obj.AVARDEF || p.To.U.Branch.As == obj.AVARKILL) {
p.To.U.Branch = p.To.U.Branch.Link
for p.To.Val.(*obj.Prog) != nil && (p.To.Val.(*obj.Prog).As == obj.AVARDEF || p.To.Val.(*obj.Prog).As == obj.AVARKILL) {
p.To.Val = p.To.Val.(*obj.Prog).Link
}
}
}