From: Matthew Dempsky Date: Thu, 7 Sep 2023 04:48:28 +0000 (-0700) Subject: cmd/compile/internal/ssa: remove Frontend.MyImportPath X-Git-Tag: go1.22rc1~934 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=af8a2bde7b5b0b9db3d18c82d4b51ad30760eb09;p=gostls13.git cmd/compile/internal/ssa: remove Frontend.MyImportPath This method is only used to find the path of the function being compiled for hash debugging, but it was instead returning the path of the package being compiled. These are typically the same, but can be different for certain functions compiled across package boundaries (e.g., method value wrappers and generic functions). It's redundant either with f.fe.Func().Sym().Pkg.Path (package path of the function being compiled) or f.Config.ctxt.Pkgpath (package path of the compilation unit), so just remove it instead. Change-Id: I1daae09055043d0ecb1fcc874a0b0006a6f8bddf Reviewed-on: https://go-review.googlesource.com/c/go/+/526516 Auto-Submit: Matthew Dempsky LUCI-TryBot-Result: Go LUCI Reviewed-by: Keith Randall Reviewed-by: Keith Randall --- diff --git a/src/cmd/compile/internal/ssa/config.go b/src/cmd/compile/internal/ssa/config.go index 43f9f0affc..8d431085a8 100644 --- a/src/cmd/compile/internal/ssa/config.go +++ b/src/cmd/compile/internal/ssa/config.go @@ -167,9 +167,6 @@ type Frontend interface { // UseWriteBarrier reports whether write barrier is enabled UseWriteBarrier() bool - // MyImportPath provides the import name (roughly, the package) for the function being compiled. - MyImportPath() string - // Func returns the ir.Func of the function being compiled. Func() *ir.Func } diff --git a/src/cmd/compile/internal/ssa/export_test.go b/src/cmd/compile/internal/ssa/export_test.go index f02cfd2cd4..bc74826c3e 100644 --- a/src/cmd/compile/internal/ssa/export_test.go +++ b/src/cmd/compile/internal/ssa/export_test.go @@ -105,9 +105,6 @@ func (d TestFrontend) Fatalf(_ src.XPos, msg string, args ...interface{}) { d.t. func (d TestFrontend) Warnl(_ src.XPos, msg string, args ...interface{}) { d.t.Logf(msg, args...) } func (d TestFrontend) Debug_checknil() bool { return false } -func (d TestFrontend) MyImportPath() string { - return d.f.Sym().Pkg.Path -} func (d TestFrontend) Func() *ir.Func { return d.f } diff --git a/src/cmd/compile/internal/ssa/func.go b/src/cmd/compile/internal/ssa/func.go index c5716e3a9a..2318d52e0c 100644 --- a/src/cmd/compile/internal/ssa/func.go +++ b/src/cmd/compile/internal/ssa/func.go @@ -781,7 +781,8 @@ func (f *Func) DebugHashMatch() bool { if !base.HasDebugHash() { return true } - return base.DebugHashMatchPkgFunc(f.fe.MyImportPath(), f.Name) + sym := f.fe.Func().Sym() + return base.DebugHashMatchPkgFunc(sym.Pkg.Path, sym.Name) } func (f *Func) spSb() (sp, sb *Value) { diff --git a/src/cmd/compile/internal/ssagen/ssa.go b/src/cmd/compile/internal/ssagen/ssa.go index 2934c8b527..fa8db71255 100644 --- a/src/cmd/compile/internal/ssagen/ssa.go +++ b/src/cmd/compile/internal/ssagen/ssa.go @@ -8025,10 +8025,6 @@ func (e *ssafn) Syslook(name string) *obj.LSym { return nil } -func (e *ssafn) MyImportPath() string { - return base.Ctxt.Pkgpath -} - func (e *ssafn) Func() *ir.Func { return e.curfn }