go/cmd/callgraph
Tim King d567bc1c22 go/ssa: monomorphize generic instantiations.
Monomorphize the instantiation of generic functions. Applies type
substitution while building the function instantiation.

Adds a new BuilderMode, ssa.InstantiateGenerics, to enable
monomorphization. InstantiateGenerics is turned on by the flag 'G' in
tools that specify the BuilderMode.

Adds a parameterized field to Program to detect when a MethodValue is
parameterized.

Thunk creation creates new MethodExpr selections. Adds a new methodExpr
type to construct a MethodExpr from outside of types, and selection
interface to generalize a *methodExpr and *types.Selection.

Tests x/tools/go/ssa/interp against the runnable examples in
$GOROOT/test/typeparam/*.go. Some additional models to support files.

Misc. cleanup:
- adding (*canonizer).instantiateMethod to create a canonical
  representative of a method.
- documenting builder.go
- adding (*subster).types that applies type substitution to a list.

Updates golang/go#48525

Change-Id: I885a4223900feaa3664e35caf8618d11ba16a2a7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/356315
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-22 17:17:20 +00:00
..
testdata/src/pkg cmd/callgraph: use go/packages 2018-08-09 16:04:36 +00:00
main.go go/ssa: monomorphize generic instantiations. 2022-04-22 17:17:20 +00:00
main_test.go cmd/callgraph: expand windows/arm64 skip to the whole platform 2022-04-04 15:58:39 +00:00