]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.regabi] cmd/compile: fix OCALLMETH desugaring
authorMatthew Dempsky <mdempsky@google.com>
Fri, 25 Dec 2020 08:34:32 +0000 (00:34 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Fri, 25 Dec 2020 11:15:41 +0000 (11:15 +0000)
commite4f293d85306cb89da3c134ce432e330e289447e
treed1279fe95eee2592def7007c604356efd9e7bbd7
parent1d9a1f67d537309f80740b16ef619500fb55db16
[dev.regabi] cmd/compile: fix OCALLMETH desugaring

During walkCall, there's a half-hearted attempt at rewriting OCALLMETH
expressions into regular function calls by moving the receiver
argument into n.Args with the rest of the arguments. But the way it
does this leaves the AST in an inconsistent state (an ODOTMETH node
with no X expression), and leaves a lot of duplicate work for the rest
of the backend to deal with.

By simply rewriting OCALLMETH expressions into proper OCALLFUNC
expressions, we eliminate a ton of unnecessary code duplication during
SSA construction and avoid creation of invalid method-typed variables.

Passes toolstash -cmp.

Change-Id: I4d5c5f90a79f8994059b2d0ae472182e08096c0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/280294
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
src/cmd/compile/internal/reflectdata/reflect.go
src/cmd/compile/internal/ssagen/ssa.go
src/cmd/compile/internal/typecheck/dcl.go
src/cmd/compile/internal/walk/expr.go