[dev.typeparams] cmd/compile: separate out creating instantiations from creating dictionaries

We often need to create a function/method instantiation, but not a
dictionary, because the call to the instantiation will be using a
sub-dictionary. Also, main dictionaries are only need for concrete,
non-gcshape types, whereas instantiations will be for gcshape types (or
concrete types, for strict stenciling).

Created a helper function getDictOrSubdict() to reduce duplicated code.
Also, moved gfGetGfInfo() call in getDictionarySym() inside conditional
where it is needed, to avoid extra work when dictionary has already been
created.

Change-Id: I06587cb2ddc77de2f991e9f9eaf462d2c5a5d45e
Reviewed-on: https://go-review.googlesource.com/c/go/+/332550
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
Dan Scales 2021-07-02 12:32:38 -07:00
parent 6dec18cc75
commit b994cc69e0
2 changed files with 64 additions and 62 deletions

View file

@ -111,11 +111,6 @@ type gfInfo struct {
type instInfo struct {
fun *ir.Func // The instantiated function (with body)
dictParam *ir.Name // The node inside fun that refers to the dictionary param
// Addr of static dictionary associated with this instantiation. This is the
// dictionary you should pass if all the type args are concreate. Soon to be
// removed, when creating static dictionary and instantiated function are
// separated.
dictAddr ir.Node
gf *ir.Name // The associated generic function
gfInfo *gfInfo