mirror of
https://github.com/golang/go
synced 2024-11-20 03:24:41 -07:00
cmd/gc: racewalk: fix instrumentation of ninit lists
The idea is to (1) process ninit of all nodes, and (2) put instrumentation of ninit into the nodes themselves (not the top-level statement ninit). Fixes #4304. R=golang-dev, rsc CC=golang-dev, lvd https://golang.org/cl/6818049
This commit is contained in:
parent
8d95245d0d
commit
b11f85a8aa
@ -89,6 +89,8 @@ racewalknode(Node **np, NodeList **init, int wr, int skip)
|
||||
opnames[n->op], n->left, n->right, n->right ? n->right->type : nil, n->type, n->class);
|
||||
setlineno(n);
|
||||
|
||||
racewalklist(n->ninit, nil);
|
||||
|
||||
switch(n->op) {
|
||||
default:
|
||||
fatal("racewalk: unknown node type %O", n->op);
|
||||
@ -100,7 +102,6 @@ racewalknode(Node **np, NodeList **init, int wr, int skip)
|
||||
case OAS2RECV:
|
||||
case OAS2FUNC:
|
||||
case OAS2MAPR:
|
||||
racewalklist(n->ninit, init);
|
||||
racewalknode(&n->left, init, 1, 0);
|
||||
racewalknode(&n->right, init, 0, 0);
|
||||
goto ret;
|
||||
@ -115,7 +116,6 @@ racewalknode(Node **np, NodeList **init, int wr, int skip)
|
||||
goto ret;
|
||||
|
||||
case OFOR:
|
||||
racewalklist(n->ninit, nil);
|
||||
if(n->ntest != N)
|
||||
racewalklist(n->ntest->ninit, nil);
|
||||
racewalknode(&n->nincr, init, wr, 0);
|
||||
@ -123,7 +123,6 @@ racewalknode(Node **np, NodeList **init, int wr, int skip)
|
||||
goto ret;
|
||||
|
||||
case OIF:
|
||||
racewalklist(n->ninit, nil);
|
||||
racewalknode(&n->ntest, &n->ninit, wr, 0);
|
||||
racewalklist(n->nbody, nil);
|
||||
racewalklist(n->nelse, nil);
|
||||
@ -140,7 +139,6 @@ racewalknode(Node **np, NodeList **init, int wr, int skip)
|
||||
|
||||
case OCALLFUNC:
|
||||
racewalknode(&n->left, init, 0, 0);
|
||||
racewalklist(n->ninit, init);
|
||||
racewalklist(n->list, init);
|
||||
goto ret;
|
||||
|
||||
@ -159,7 +157,6 @@ racewalknode(Node **np, NodeList **init, int wr, int skip)
|
||||
goto ret;
|
||||
|
||||
case OSWITCH:
|
||||
racewalklist(n->ninit, nil);
|
||||
if(n->ntest->op == OTYPESW)
|
||||
// don't bother, we have static typization
|
||||
return;
|
||||
@ -168,7 +165,6 @@ racewalknode(Node **np, NodeList **init, int wr, int skip)
|
||||
goto ret;
|
||||
|
||||
case OEMPTY:
|
||||
racewalklist(n->ninit, nil);
|
||||
goto ret;
|
||||
|
||||
case ONOT:
|
||||
@ -274,7 +270,6 @@ racewalknode(Node **np, NodeList **init, int wr, int skip)
|
||||
case OSLICE:
|
||||
case OSLICEARR:
|
||||
// Seems to only lead to double instrumentation.
|
||||
//racewalklist(n->ninit, init);
|
||||
//racewalknode(&n->left, init, 0, 0);
|
||||
//racewalklist(n->list, init);
|
||||
goto ret;
|
||||
|
Loading…
Reference in New Issue
Block a user