]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/ssa: remove Frontend.MyImportPath
authorMatthew Dempsky <mdempsky@google.com>
Thu, 7 Sep 2023 04:48:28 +0000 (21:48 -0700)
committerGopher Robot <gobot@golang.org>
Fri, 8 Sep 2023 19:01:07 +0000 (19:01 +0000)
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 <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/config.go
src/cmd/compile/internal/ssa/export_test.go
src/cmd/compile/internal/ssa/func.go
src/cmd/compile/internal/ssagen/ssa.go

index 43f9f0affc6b4d1229009e79413384c1fee141ce..8d431085a82143e9b643d73a95414fadf1b45f8d 100644 (file)
@@ -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
 }
index f02cfd2cd4c3014e75a27054b2d9a61b777957f4..bc74826c3e7e570b977b55e6359fe5d1c71849c4 100644 (file)
@@ -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
 }
index c5716e3a9a44e9a645d5618fec7f29e87082ba31..2318d52e0c579cc3c8f7b352250e775eb4352ba2 100644 (file)
@@ -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) {
index 2934c8b527297ecf15b0e1b612fb732b490c61b8..fa8db71255d8cd6df0c51ed1ec96cf283fc1d079 100644 (file)
@@ -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
 }