]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: use internal/buildcfg for checking newinliner enable
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 16 Nov 2023 15:19:37 +0000 (22:19 +0700)
committerGopher Robot <gobot@golang.org>
Fri, 17 Nov 2023 12:45:41 +0000 (12:45 +0000)
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 <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/cmd/compile/internal/inline/inlheur/analyze.go
src/cmd/compile/internal/noder/linker.go
src/cmd/compile/internal/noder/reader.go

index 45782e64ed5503e895b246f83014e5c902b201ba..6c3db92afec963fe39e0755b3e70bf8bd602fd46 100644 (file)
@@ -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 {
index 3bc5c32e1b52cc18a552af54bc61f0e86523fb1d..f5667f57ab98f3f820399636d68c1fcd0ff03bb3 100644 (file)
@@ -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)
                }
        }
index b4c2801e53807ee4c978b1eb0ad54d3fd9cd67b9..c1145f980ea309039b62972167a66fdaece317be 100644 (file)
@@ -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()
                        }
                }