From 4d1f503396fa30da1e7b841de2f464c8bf8940e0 Mon Sep 17 00:00:00 2001 From: Mateusz Poliwczak Date: Fri, 27 Mar 2026 18:09:23 +0100 Subject: cmd/compile/internal/devirtualize: improve debug logs Change-Id: Ie8d74d0968c3dfa6fe3454f1d3fdf13d6a6a6944 Reviewed-on: https://go-review.googlesource.com/c/go/+/760162 Auto-Submit: Mateusz Poliwczak Reviewed-by: Keith Randall Reviewed-by: Dmitri Shuralyov Reviewed-by: Keith Randall LUCI-TryBot-Result: Go LUCI --- src/cmd/compile/internal/devirtualize/devirtualize.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/cmd/compile/internal/devirtualize') 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 = " (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 = " (unknown static type)" + } base.Warn("concreteType1(%v) -> %v", nn, t) }() } -- cgit v1.3