diff options
author | Cuong Manh Le <cuong.manhle.vn@gmail.com> | 2021-06-24 14:13:39 +0700 |
---|---|---|
committer | Cuong Manh Le <cuong.manhle.vn@gmail.com> | 2021-06-25 02:28:47 +0000 |
commit | aee209c04426c50bb045e058b4f618ed306b7d62 (patch) | |
tree | 6b0abe0684715f733308499e58765dba1957c9f2 /src/cmd/compile/internal/ssagen | |
parent | 75ad32377378b4d6fa831b67a7f6aaf68cbe07d4 (diff) | |
download | go-aee209c04426c50bb045e058b4f618ed306b7d62.tar.gz go-aee209c04426c50bb045e058b4f618ed306b7d62.zip |
[dev.typeparams] cmd/compile: catch another mis-used OCALLMETH in backend
OCALLMETH is rewritten by walkCall to OCALLFUNC, and other places in
backend have already caught it. So do the same thing in state.expr for
consistency and prevent mis-use in frontend side.
While at it, also remove un-used function getParam.
Change-Id: I03e1ea907e0bcb05fa35fa81804c33b5c9a4d77e
Reviewed-on: https://go-review.googlesource.com/c/go/+/330669
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssagen')
-rw-r--r-- | src/cmd/compile/internal/ssagen/ssa.go | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/cmd/compile/internal/ssagen/ssa.go b/src/cmd/compile/internal/ssagen/ssa.go index 93847a39a3..9212c5776e 100644 --- a/src/cmd/compile/internal/ssagen/ssa.go +++ b/src/cmd/compile/internal/ssagen/ssa.go @@ -279,18 +279,6 @@ func regAbiForFuncType(ft *types.Func) bool { return np > 0 && strings.Contains(ft.Params.FieldType(np-1).String(), magicLastTypeName) } -// getParam returns the Field of ith param of node n (which is a -// function/method/interface call), where the receiver of a method call is -// considered as the 0th parameter. This does not include the receiver of an -// interface call. -func getParam(n *ir.CallExpr, i int) *types.Field { - t := n.X.Type() - if n.Op() == ir.OCALLMETH { - base.Fatalf("OCALLMETH missed by walkCall") - } - return t.Params().Field(i) -} - // dvarint writes a varint v to the funcdata in symbol x and returns the new offset func dvarint(x *obj.LSym, off int, v int64) int { if v < 0 || v > 1e9 { @@ -3127,10 +3115,14 @@ func (s *state) expr(n ir.Node) *ssa.Value { } fallthrough - case ir.OCALLINTER, ir.OCALLMETH: + case ir.OCALLINTER: n := n.(*ir.CallExpr) return s.callResult(n, callNormal) + case ir.OCALLMETH: + base.Fatalf("OCALLMETH missed by walkCall") + panic("unreachable") + case ir.OGETG: n := n.(*ir.CallExpr) return s.newValue1(ssa.OpGetG, n.Type(), s.mem()) |