From 3dc0a0a2c5a7d8959a43265d4f73d7e2e509de5e Mon Sep 17 00:00:00 2001 From: Dan Scales Date: Fri, 23 Jul 2021 17:19:51 -0700 Subject: [PATCH] [dev.typeparams] cmd/compile: get rid of concretify use for bounds. We just need to substitute from the typeparams to the shapes for the dst type of the bound. Removed concretify substituter, not used anymore. Also removed shape2params, not needed anymore. However, since the dst type is now not concrete, this gives more cases where the linker can't find a method. I realized that we need to call MarkUsedIfaceMethod to mark a method as used on a particular interface, else a type's method can be still deadcoded even though MarkTypeUsedInInterface has been called on the concrete type. I added a new version MarkUsedIfaceMethodIndex to fit my use case. Change-Id: Id67b72b350889dd3688b42739c337d5d79a0d1a2 Reviewed-on: https://go-review.googlesource.com/c/go/+/337230 Trust: Dan Scales Reviewed-by: Keith Randall --- src/cmd/compile/internal/noder/stencil.go | 36 +++++++++---------- .../compile/internal/reflectdata/reflect.go | 12 ++++++- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/cmd/compile/internal/noder/stencil.go b/src/cmd/compile/internal/noder/stencil.go index e308dd7a05..f1de1152c5 100644 --- a/src/cmd/compile/internal/noder/stencil.go +++ b/src/cmd/compile/internal/noder/stencil.go @@ -855,13 +855,9 @@ type subster struct { ts typecheck.Tsubster info *instInfo // Place to put extra info in the instantiation - // Which type parameter the shape type came from. - shape2param map[*types.Type]*types.Type - // unshapeify maps from shape types to the concrete types they represent. // TODO: remove when we no longer need it. - unshapify typecheck.Tsubster - concretify typecheck.Tsubster + unshapify typecheck.Tsubster // TODO: some sort of map from to index in the // dictionary where a *runtime.itab for the corresponding