aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/devirtualize/devirtualize.go
diff options
context:
space:
mode:
authorMateusz Poliwczak <mpoliwczak34@gmail.com>2026-03-27 18:09:23 +0100
committerMateusz Poliwczak <mpoliwczak34@gmail.com>2026-03-30 07:27:59 -0700
commit4d1f503396fa30da1e7b841de2f464c8bf8940e0 (patch)
treee38cce43600ff0e72193a6b53b06f6e9bf57dd51 /src/cmd/compile/internal/devirtualize/devirtualize.go
parent09031d907c720e38cdde6242c763d25c9f985327 (diff)
downloadgo-4d1f503396fa30da1e7b841de2f464c8bf8940e0.tar.xz
cmd/compile/internal/devirtualize: improve debug logs
Change-Id: Ie8d74d0968c3dfa6fe3454f1d3fdf13d6a6a6944 Reviewed-on: https://go-review.googlesource.com/c/go/+/760162 Auto-Submit: Mateusz Poliwczak <mpoliwczak34@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/cmd/compile/internal/devirtualize/devirtualize.go')
-rw-r--r--src/cmd/compile/internal/devirtualize/devirtualize.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/devirtualize/devirtualize.go b/src/cmd/compile/internal/devirtualize/devirtualize.go
index 59ddc2e536..08af63c39e 100644
--- a/src/cmd/compile/internal/devirtualize/devirtualize.go
+++ b/src/cmd/compile/internal/devirtualize/devirtualize.go
@@ -182,6 +182,17 @@ const concreteTypeDebug = false
// Returns nil when the concrete type could not be determined, or when there are multiple
// (different) types assigned to an interface.
func concreteType(s *State, n ir.Node) (typ *types.Type) {
+ if concreteTypeDebug {
+ base.Warn("concreteType(%v) - analyzing", n)
+ defer func() {
+ t := typ.String()
+ if typ == nil {
+ t = "<nil> (unknown static type)"
+ }
+ base.Warn("concreteType(%v) -> %v", n, t)
+ }()
+ }
+
typ = concreteType1(s, n, make(map[*ir.Name]struct{}))
if typ == &noType {
return nil
@@ -207,6 +218,9 @@ func concreteType1(s *State, n ir.Node, seen map[*ir.Name]struct{}) (outT *types
if outT != &noType {
t = outT.String()
}
+ if outT == nil {
+ t = "<nil> (unknown static type)"
+ }
base.Warn("concreteType1(%v) -> %v", nn, t)
}()
}