]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: load properly constant values from itabs
authorMateusz Poliwczak <mpoliwczak34@gmail.com>
Sun, 16 Feb 2025 17:24:19 +0000 (17:24 +0000)
committerGopher Robot <gobot@golang.org>
Wed, 19 Feb 2025 21:39:00 +0000 (13:39 -0800)
commit43e6525986d70e7f3d3af394ee442d3390568c01
tree12aec531e289d6ce34f6b6e8ccef65c4de7188ad
parentba3f568988bff69b3d00cd6ca76ab536eacbea48
cmd/compile: load properly constant values from itabs

While looking at the SSA of following code, i noticed
that these rules do not work properly, and the types
are loaded indirectly through an itab, instead of statically.

type M interface{ M() }
type A interface{ A() }

type Impl struct{}
func (*Impl) M() {}
func (*Impl) A() {}

func main() {
        var a M = &Impl{}
        a.(A).A()
}

Change-Id: Ia275993f81a2e7302102d4ff87ac28586023d13c
GitHub-Last-Rev: 4bfc9019172929d0b0f1c8a1b7eb28cdbc9b87ef
GitHub-Pull-Request: golang/go#71784
Reviewed-on: https://go-review.googlesource.com/c/go/+/649500
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
src/cmd/compile/internal/ssa/_gen/generic.rules
src/cmd/compile/internal/ssa/rewritegeneric.go
test/codegen/load_type_from_itab.go [new file with mode: 0644]