aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMateusz Poliwczak <mpoliwczak34@gmail.com>2025-02-18 20:40:58 +0000
committerGopher Robot <gobot@golang.org>2025-02-18 17:51:54 -0800
commita7489b864879e89182ddf32d4a108c6967aa0522 (patch)
treecacb435e07525f2a9d51bd07356e68927746393f /src
parent279da965329a74cd75320f15cb9672a282690ab7 (diff)
downloadgo-a7489b864879e89182ddf32d4a108c6967aa0522.tar.xz
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: 6dea0bd27c38d9118d13d55052efcb4070b26751 GitHub-Pull-Request: golang/go#71823 Reviewed-on: https://go-review.googlesource.com/c/go/+/650435 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/compile/internal/ir/expr.go4
-rw-r--r--src/cmd/compile/internal/ir/sizeof_test.go3
2 files changed, 4 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/ir/expr.go b/src/cmd/compile/internal/ir/expr.go
index 4a2e996569..5bd26fc145 100644
--- a/src/cmd/compile/internal/ir/expr.go
+++ b/src/cmd/compile/internal/ir/expr.go
@@ -24,12 +24,12 @@ type Expr interface {
// A miniExpr is a miniNode with extra fields common to expressions.
// TODO(rsc): Once we are sure about the contents, compact the bools
// into a bit field and leave extra bits available for implementations
-// embedding miniExpr. Right now there are ~60 unused bits sitting here.
+// embedding miniExpr. Right now there are ~24 unused bits sitting here.
type miniExpr struct {
miniNode
+ flags bitset8
typ *types.Type
init Nodes // TODO(rsc): Don't require every Node to have an init
- flags bitset8
}
const (
diff --git a/src/cmd/compile/internal/ir/sizeof_test.go b/src/cmd/compile/internal/ir/sizeof_test.go
index ea74296315..1715bad0c1 100644
--- a/src/cmd/compile/internal/ir/sizeof_test.go
+++ b/src/cmd/compile/internal/ir/sizeof_test.go
@@ -21,7 +21,8 @@ func TestSizeof(t *testing.T) {
_64bit uintptr // size on 64bit platforms
}{
{Func{}, 184, 312},
- {Name{}, 96, 168},
+ {Name{}, 96, 160},
+ {miniExpr{}, 32, 48},
}
for _, tt := range tests {