aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/noder
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2023-06-29 13:22:26 -0400
committerThan McIntosh <thanm@google.com>2023-09-08 23:02:15 +0000
commit323cf730912bc4ad975766118ba2da88a6e80a6b (patch)
tree676c0ceb27b19d8af327a077e028c6c2a7e952f0 /src/cmd/compile/internal/noder
parent906a073b0badf3c76cb8225f376195da594fe5b4 (diff)
downloadgo-323cf730912bc4ad975766118ba2da88a6e80a6b.tar.xz
cmd/compile: write "properties" to export data for inlinable funcs
Augment the ir.Inline container to include an entry for function properties (currently serialized as a string), and if GOEXPERIMENT=newinliner is set, compute and store function properties for all inline candidates processed by the inliner. The idea here is that if the function properties are going to drive inlining decisions, we'd like to have the same info from non-local / imported functions as for local / in-package functions, hence we need to include the properties in the export data. Hand testing on the compiler itself and with k8s kubelet shows that this increases the size of export data overall by about 2-3 percent, so a pretty modest increase. Updates #61502. Change-Id: I9d1c311aa8418d02ffea3629c3dd9d8076886d15 Reviewed-on: https://go-review.googlesource.com/c/go/+/511562 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/noder')
-rw-r--r--src/cmd/compile/internal/noder/linker.go4
-rw-r--r--src/cmd/compile/internal/noder/reader.go4
2 files changed, 8 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/noder/linker.go b/src/cmd/compile/internal/noder/linker.go
index 00a7743085..3bc5c32e1b 100644
--- a/src/cmd/compile/internal/noder/linker.go
+++ b/src/cmd/compile/internal/noder/linker.go
@@ -6,6 +6,7 @@ package noder
import (
"internal/buildcfg"
+ "internal/goexperiment"
"internal/pkgbits"
"io"
@@ -296,6 +297,9 @@ func (l *linker) relocFuncExt(w *pkgbits.Encoder, name *ir.Name) {
if inl := name.Func.Inl; w.Bool(inl != nil) {
w.Len(int(inl.Cost))
w.Bool(inl.CanDelayResults)
+ if goexperiment.NewInliner {
+ w.String(inl.Properties)
+ }
}
w.Sync(pkgbits.SyncEOF)
diff --git a/src/cmd/compile/internal/noder/reader.go b/src/cmd/compile/internal/noder/reader.go
index bf7bfb7d48..35dfe3d674 100644
--- a/src/cmd/compile/internal/noder/reader.go
+++ b/src/cmd/compile/internal/noder/reader.go
@@ -8,6 +8,7 @@ import (
"fmt"
"go/constant"
"internal/buildcfg"
+ "internal/goexperiment"
"internal/pkgbits"
"path/filepath"
"strings"
@@ -1118,6 +1119,9 @@ func (r *reader) funcExt(name *ir.Name, method *types.Sym) {
Cost: int32(r.Len()),
CanDelayResults: r.Bool(),
}
+ if goexperiment.NewInliner {
+ fn.Inl.Properties = r.String()
+ }
}
} else {
r.addBody(name.Func, method)