Skip to content

Commit

Permalink
cmd/compile: deduplicate racewalk switch cases
Browse files Browse the repository at this point in the history
Only the contiguous ones, to keep the patch simple. Remove some
unnecessary newlines, while at it.

Change-Id: Ia588f80538b49a169fbf49835979ebff5a0a7b6d
Reviewed-on: https://go-review.googlesource.com/94756
Run-TryBot: Daniel Martí <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Matthew Dempsky <[email protected]>
  • Loading branch information
mvdan committed Mar 13, 2018
1 parent 1178e51 commit 63f4ab9
Showing 1 changed file with 7 additions and 35 deletions.
42 changes: 7 additions & 35 deletions src/cmd/compile/internal/gc/racewalk.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,7 @@ func instrumentnode(np **Node, init *Nodes, wr int, skip int) {
afterCall = (op == OCALLFUNC || op == OCALLMETH || op == OCALLINTER)
}

case ODEFER:
instrumentnode(&n.Left, init, 0, 0)

case OPROC:
case ODEFER, OPROC:
instrumentnode(&n.Left, init, 0, 0)

case OCALLINTER:
Expand Down Expand Up @@ -199,14 +196,9 @@ func instrumentnode(np **Node, init *Nodes, wr int, skip int) {
instrumentnode(&n.Left, init, 0, 1)
callinstr(&n, init, wr, skip)

case ODOTPTR: // dst = (*x).f with implicit *; otherwise it's ODOT+OIND
case ODOTPTR, // dst = (*x).f with implicit *; otherwise it's ODOT+OIND
OIND: // *p
instrumentnode(&n.Left, init, 0, 0)

callinstr(&n, init, wr, skip)

case OIND: // *p
instrumentnode(&n.Left, init, 0, 0)

callinstr(&n, init, wr, skip)

case OSPTR, OLEN, OCAP:
Expand All @@ -219,22 +211,8 @@ func instrumentnode(np **Node, init *Nodes, wr int, skip int) {
callinstr(&n1, init, 0, skip)
}

case OLSH,
ORSH,
OAND,
OANDNOT,
OOR,
OXOR,
OSUB,
OMUL,
OEQ,
ONE,
OLT,
OLE,
OGE,
OGT,
OADD,
OCOMPLEX:
case OLSH, ORSH, OAND, OANDNOT, OOR, OXOR, OSUB,
OMUL, OEQ, ONE, OLT, OLE, OGE, OGT, OADD, OCOMPLEX:
instrumentnode(&n.Left, init, wr, 0)
instrumentnode(&n.Right, init, wr, 0)

Expand All @@ -250,10 +228,7 @@ func instrumentnode(np **Node, init *Nodes, wr int, skip int) {
case ONAME:
callinstr(&n, init, wr, skip)

case OCONV:
instrumentnode(&n.Left, init, wr, 0)

case OCONVNOP:
case OCONV, OCONVNOP:
instrumentnode(&n.Left, init, wr, 0)

case ODIV, OMOD:
Expand Down Expand Up @@ -291,10 +266,7 @@ func instrumentnode(np **Node, init *Nodes, wr int, skip int) {
case OEFACE:
instrumentnode(&n.Right, init, 0, 0)

case OITAB, OIDATA:
instrumentnode(&n.Left, init, 0, 0)

case OSTRARRAYBYTETMP:
case OITAB, OIDATA, OSTRARRAYBYTETMP:
instrumentnode(&n.Left, init, 0, 0)

case OAS2DOTTYPE:
Expand Down

0 comments on commit 63f4ab9

Please sign in to comment.