]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.typeparams] cmd/compile: add OFUNCINST/OTYPEINST nodes for generic func/type...
authorDan Scales <danscales@google.com>
Tue, 2 Feb 2021 20:17:57 +0000 (12:17 -0800)
committerDan Scales <danscales@google.com>
Wed, 3 Feb 2021 01:18:23 +0000 (01:18 +0000)
commite633f343ba791e770c6a6c2f8ff3640d2e8ff079
tree862cd9c47e985812e60310dd31a75a803b3f584c
parent0d2d6c74644c4e09655225894e6eca2a06aeeef4
[dev.typeparams] cmd/compile:  add OFUNCINST/OTYPEINST nodes for generic func/type instantiation

Expresses things more clearly, especially in cases like 'f := min[int]'
where we create a xsgeneric function instantiation, but don't immediately
call it.

min[int](2, 3) now looks like:

.   CALLFUNC tc(1) Use:1 int # min1.go:11 int
.   .   FUNCINST tc(1) FUNC-func(int, int) int # min1.go:11 FUNC-func(int, int) int
.   .   .   NAME-main.min tc(1) Class:PFUNC Offset:0 Used FUNC-func[T](T, T) T # min1.go:3
.   .   FUNCINST-Targs
.   .   .   TYPE .int Offset:0 type int
.   CALLFUNC-Args
.   .   LITERAL-2 tc(1) int # min1.go:11
.   .   LITERAL-3 tc(1) int # min1.go:11

Remove the targs parameter from ir.NewCallExpr(), not needed anymore,
since type arguments are included in the FUNCINST.

Change-Id: I23438b75288330475294d7ace239ba64acfa641e
Reviewed-on: https://go-review.googlesource.com/c/go/+/288951
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
19 files changed:
src/cmd/compile/internal/ir/expr.go
src/cmd/compile/internal/ir/node.go
src/cmd/compile/internal/ir/node_gen.go
src/cmd/compile/internal/ir/op_string.go
src/cmd/compile/internal/noder/expr.go
src/cmd/compile/internal/noder/helpers.go
src/cmd/compile/internal/noder/noder.go
src/cmd/compile/internal/reflectdata/alg.go
src/cmd/compile/internal/reflectdata/reflect.go
src/cmd/compile/internal/ssagen/abi.go
src/cmd/compile/internal/typecheck/func.go
src/cmd/compile/internal/typecheck/iimport.go
src/cmd/compile/internal/walk/builtin.go
src/cmd/compile/internal/walk/compare.go
src/cmd/compile/internal/walk/complit.go
src/cmd/compile/internal/walk/convert.go
src/cmd/compile/internal/walk/expr.go
src/cmd/compile/internal/walk/stmt.go
src/cmd/compile/internal/walk/walk.go