]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/gc: racewalk: instrument returnsfromheap params
authorDmitriy Vyukov <dvyukov@google.com>
Wed, 7 Nov 2012 08:10:35 +0000 (12:10 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Wed, 7 Nov 2012 08:10:35 +0000 (12:10 +0400)
Fixes #4307.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6822073

src/cmd/gc/racewalk.c

index 73352b75323423883f8178024d191df0e402d806..93a3f92b0b568cc9c82623121ccb03356da13e77 100644 (file)
@@ -45,6 +45,10 @@ racewalk(Node *fn)
                }
        }
 
+       racewalklist(fn->nbody, nil);
+       // nothing interesting for race detector in fn->enter
+       racewalklist(fn->exit, nil);
+
        // nodpc is the PC of the caller as extracted by
        // getcallerpc. We use -widthptr(FP) for x86.
        // BUG: this will not work on arm.
@@ -56,15 +60,14 @@ racewalk(Node *fn)
        fn->enter = concat(list1(nd), fn->enter);
        nd = mkcall("racefuncexit", T, nil);
        fn->exit = list(fn->exit, nd);
-       racewalklist(curfn->nbody, nil);
 
        if(debug['W']) {
-               snprint(s, sizeof(s), "after racewalk %S", curfn->nname->sym);
-               dumplist(s, curfn->nbody);
-               snprint(s, sizeof(s), "after walk %S", curfn->nname->sym);
-               dumplist(s, curfn->nbody);
-               snprint(s, sizeof(s), "enter %S", curfn->nname->sym);
-               dumplist(s, curfn->enter);
+               snprint(s, sizeof(s), "after racewalk %S", fn->nname->sym);
+               dumplist(s, fn->nbody);
+               snprint(s, sizeof(s), "enter %S", fn->nname->sym);
+               dumplist(s, fn->enter);
+               snprint(s, sizeof(s), "exit %S", fn->nname->sym);
+               dumplist(s, fn->exit);
        }
 }
 
@@ -311,8 +314,9 @@ racewalknode(Node **np, NodeList **init, int wr, int skip)
 
        // does not require instrumentation
        case OINDEXMAP:  // implemented in runtime
-       case OPRINT:  // don't bother instrumenting it
-       case OPRINTN:  // don't bother instrumenting it
+       case OPRINT:     // don't bother instrumenting it
+       case OPRINTN:    // don't bother instrumenting it
+       case OPARAM:     // it appears only in fn->exit to copy heap params back
                goto ret;
 
        // unimplemented