]> Cypherpunks repositories - gostls13.git/commit
[dev.typeparams] cmd/compile: add dictionary entries for itab conversion
authorDan Scales <danscales@google.com>
Tue, 13 Jul 2021 02:34:15 +0000 (19:34 -0700)
committerDan Scales <danscales@google.com>
Fri, 23 Jul 2021 21:16:54 +0000 (21:16 +0000)
commit02c01725002a73739cefbc9fcf2575469be6da13
tree630a1294f5b72f5a3b06b6697cff72f628739dfc
parent12866bd8ea13e43bc5995f58cdeb67ffd64a1c8c
[dev.typeparams] cmd/compile: add dictionary entries for itab conversion

This fix the case where a type param or derived type is converted to a
non-empty interface. Previously, we were converting to an empty
interface and then using DOTTYPE to convert to the correct non-empty
interface. In that case, we can get the needed itab directly from the
dictionary. This is needed for correctness from shapes, if the
destination interface is parameterized, else we will incorrectly convert
to the shape version of the interface.

Creating/writing an itab can involve generating wrappers for a bunch of
methods, which may use dictionaries. So, all the
dictionaries/instantiations are being generated on the fly and have
recursive relationships, it is simplest to finish creating/writing the
itabs at the end of the stenciling phase. So, we create a list of the
dictionaries which need to be completed by writing out their itab
entries.

The existing tests ordered.go, ifaceconv.go, and issue44688.go make use
of this optimization.

Got itab conversions for bound calls working, except for 13.go.
Also, want to get rid of the concretify, but I think we need more info
on the Bound from types2.

Change-Id: If552958a7b8a435500d6cc42c401572c367b30d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/336993
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/noder/irgen.go
src/cmd/compile/internal/noder/stencil.go
src/cmd/compile/internal/reflectdata/reflect.go
test/run.go