From a3a7244779066ba639e9c61d4b351800a9cb77f6 Mon Sep 17 00:00:00 2001 From: Dmitriy Vyukov Date: Wed, 7 Nov 2012 12:10:35 +0400 Subject: [PATCH] cmd/gc: racewalk: instrument returnsfromheap params Fixes #4307. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/6822073 --- src/cmd/gc/racewalk.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/cmd/gc/racewalk.c b/src/cmd/gc/racewalk.c index 73352b7532..93a3f92b0b 100644 --- a/src/cmd/gc/racewalk.c +++ b/src/cmd/gc/racewalk.c @@ -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