go/cmd
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
..
auth cmd: gofmt 2022-04-12 17:38:38 +00:00
benchcmp cmd: gofmt 2022-04-12 17:38:38 +00:00
bundle cmd: gofmt 2022-04-12 17:38:38 +00:00
callgraph go/ssa: monomorphize generic instantiations. 2022-04-22 17:17:20 +00:00
compilebench cmd: gofmt 2022-04-12 17:38:38 +00:00
cover cmd: gofmt 2022-04-12 17:38:38 +00:00
digraph cmd: gofmt 2022-04-12 17:38:38 +00:00
eg cmd: avoid printing redundant newlines 2021-11-08 18:39:25 +00:00
file2fuzz cmd: gofmt 2022-04-12 17:38:38 +00:00
fiximports cmd: gofmt 2022-04-12 17:38:38 +00:00
getgo cmd/getgo: exec main from TestMain instead of running 'go build' in tests 2022-03-04 20:37:47 +00:00
go-contrib-init all: replace all usages of os/exec with golang.org/x/sys/execabs 2021-01-19 22:25:03 +00:00
godex cmd: gofmt 2022-04-12 17:38:38 +00:00
godoc cmd/godoc: remove usage of golang.org/x/xerrors 2022-04-20 16:11:05 +00:00
goimports cmd: gofmt 2022-04-12 17:38:38 +00:00
gomvpkg cmd: avoid printing redundant newlines 2021-11-08 18:39:25 +00:00
gorename cmd: gofmt 2022-04-12 17:38:38 +00:00
gotype cmd: gofmt 2022-04-12 17:38:38 +00:00
goyacc cmd: gofmt 2022-04-12 17:38:38 +00:00
guru cmd: gofmt 2022-04-12 17:38:38 +00:00
html2article copyright: test that all files in the repo have copyright notices 2021-01-11 22:19:46 +00:00
present cmd: gofmt 2022-04-12 17:38:38 +00:00
present2md cmd: gofmt 2022-04-12 17:38:38 +00:00
signature-fuzzer cmd: gofmt 2022-04-12 17:38:38 +00:00
splitdwarf cmd: gofmt 2022-04-12 17:38:38 +00:00
ssadump go/ssa: monomorphize generic instantiations. 2022-04-22 17:17:20 +00:00
stress cmd: gofmt 2022-04-12 17:38:38 +00:00
stringer cmd: gofmt 2022-04-12 17:38:38 +00:00
toolstash cmd: gofmt 2022-04-12 17:38:38 +00:00