Skip to content

Commit a7489b8

Browse files
mateusz834gopherbot
authored andcommitted
cmd/compile/internal/ir: reduce size of miniExpr by 8 bytes
By moving the bit field, we can reduce the miniExpr size by 8 bytes, reducing the sizes of Exprs embedding this type. Hopefully we get a few types to a lower memory size class. Change-Id: I4b1d4471cf905f998b26d235980e40ca91446f45 GitHub-Last-Rev: 6dea0bd GitHub-Pull-Request: #71823 Reviewed-on: https://go-review.googlesource.com/c/go/+/650435 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Michael Knyszek <[email protected]> Reviewed-by: Robert Griesemer <[email protected]> Auto-Submit: Robert Griesemer <[email protected]>
1 parent 279da96 commit a7489b8

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/cmd/compile/internal/ir/expr.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ type Expr interface {
2424
// A miniExpr is a miniNode with extra fields common to expressions.
2525
// TODO(rsc): Once we are sure about the contents, compact the bools
2626
// into a bit field and leave extra bits available for implementations
27-
// embedding miniExpr. Right now there are ~60 unused bits sitting here.
27+
// embedding miniExpr. Right now there are ~24 unused bits sitting here.
2828
type miniExpr struct {
2929
miniNode
30+
flags bitset8
3031
typ *types.Type
3132
init Nodes // TODO(rsc): Don't require every Node to have an init
32-
flags bitset8
3333
}
3434

3535
const (

src/cmd/compile/internal/ir/sizeof_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ func TestSizeof(t *testing.T) {
2121
_64bit uintptr // size on 64bit platforms
2222
}{
2323
{Func{}, 184, 312},
24-
{Name{}, 96, 168},
24+
{Name{}, 96, 160},
25+
{miniExpr{}, 32, 48},
2526
}
2627

2728
for _, tt := range tests {

0 commit comments

Comments
 (0)