From 5b6d3dea8744311825fd544a73edb8d26d9c7e98 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Thu, 16 Nov 2023 22:19:37 +0700 Subject: [PATCH] cmd/compile: use internal/buildcfg for checking newinliner enable internal/goexperiment reports what GOEXPERIMENT the compiler itself was compiled with, not what experiment to use for the object code that the compiler is compiling. Fixes #64189 Change-Id: I892d78611f8c76376032fd7459e755380afafac6 Reviewed-on: https://go-review.googlesource.com/c/go/+/542995 Auto-Submit: Cuong Manh Le Reviewed-by: Matthew Dempsky Reviewed-by: Than McIntosh LUCI-TryBot-Result: Go LUCI --- src/cmd/compile/internal/inline/inlheur/analyze.go | 4 ++-- src/cmd/compile/internal/noder/linker.go | 3 +-- src/cmd/compile/internal/noder/reader.go | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/cmd/compile/internal/inline/inlheur/analyze.go b/src/cmd/compile/internal/inline/inlheur/analyze.go index 45782e64ed..6c3db92afe 100644 --- a/src/cmd/compile/internal/inline/inlheur/analyze.go +++ b/src/cmd/compile/internal/inline/inlheur/analyze.go @@ -10,7 +10,7 @@ import ( "cmd/compile/internal/types" "encoding/json" "fmt" - "internal/goexperiment" + "internal/buildcfg" "io" "os" "path/filepath" @@ -213,7 +213,7 @@ func fnFileLine(fn *ir.Func) (string, uint) { } func Enabled() bool { - return goexperiment.NewInliner || UnitTesting() + return buildcfg.Experiment.NewInliner || UnitTesting() } func UnitTesting() bool { diff --git a/src/cmd/compile/internal/noder/linker.go b/src/cmd/compile/internal/noder/linker.go index 3bc5c32e1b..f5667f57ab 100644 --- a/src/cmd/compile/internal/noder/linker.go +++ b/src/cmd/compile/internal/noder/linker.go @@ -6,7 +6,6 @@ package noder import ( "internal/buildcfg" - "internal/goexperiment" "internal/pkgbits" "io" @@ -297,7 +296,7 @@ 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 { + if buildcfg.Experiment.NewInliner { w.String(inl.Properties) } } diff --git a/src/cmd/compile/internal/noder/reader.go b/src/cmd/compile/internal/noder/reader.go index b4c2801e53..c1145f980e 100644 --- a/src/cmd/compile/internal/noder/reader.go +++ b/src/cmd/compile/internal/noder/reader.go @@ -8,7 +8,6 @@ import ( "fmt" "go/constant" "internal/buildcfg" - "internal/goexperiment" "internal/pkgbits" "path/filepath" "strings" @@ -1103,7 +1102,7 @@ func (r *reader) funcExt(name *ir.Name, method *types.Sym) { Cost: int32(r.Len()), CanDelayResults: r.Bool(), } - if goexperiment.NewInliner { + if buildcfg.Experiment.NewInliner { fn.Inl.Properties = r.String() } } -- 2.50.0