diff options
author | Keith Randall <khr@golang.org> | 2021-06-04 17:19:09 -0700 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2021-06-07 21:12:23 +0000 |
commit | ccfb0ce8df980599750db4fa56a8ab16202f1ba6 (patch) | |
tree | afe6960b73ee984cc32ceffe609ea642967207ef /src/cmd/compile/internal/escape | |
parent | cf4b6dc48eba807e7d85fb6ab30cbbbdb143c552 (diff) | |
download | go-ccfb0ce8df980599750db4fa56a8ab16202f1ba6.tar.gz go-ccfb0ce8df980599750db4fa56a8ab16202f1ba6.zip |
[dev.typeparams] cmd/compile: convert generic values to interface type using dictionary
When converting a variable of generic type to an interface, use the
entry in the dictionary for the type field instead of using the
compile-time type (which we only have when fully stenciling).
Note: this isn't all the conversions. Conversions often get processed
in the ir.OCALL case. Those aren't handled yet.
Change-Id: I9a6a4c572e3c54a8e8efad98365184dbb94c4487
Reviewed-on: https://go-review.googlesource.com/c/go/+/325330
Trust: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
Diffstat (limited to 'src/cmd/compile/internal/escape')
-rw-r--r-- | src/cmd/compile/internal/escape/escape.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/escape/escape.go b/src/cmd/compile/internal/escape/escape.go index 3ac7ff1ebe..842b0f4a7e 100644 --- a/src/cmd/compile/internal/escape/escape.go +++ b/src/cmd/compile/internal/escape/escape.go @@ -669,6 +669,13 @@ func (e *escape) exprSkipInit(k hole, n ir.Node) { k = e.spill(k, n) } e.expr(k.note(n, "interface-converted"), n.X) + case ir.OEFACE: + n := n.(*ir.BinaryExpr) + // Note: n.X is not needed because it can never point to memory that might escape. + e.expr(k, n.Y) + case ir.OIDATA: + n := n.(*ir.UnaryExpr) + e.expr(k, n.X) case ir.OSLICE2ARRPTR: // the slice pointer flows directly to the result n := n.(*ir.ConvExpr) |