1
0
mirror of https://github.com/golang/go synced 2024-11-22 22:20:03 -07:00

cmd/gc: fix race detector on tail-call wrappers

(By not using the tail-call wrappers when the race
detector is enabled.)

R=golang-dev, minux.ma, dvyukov, daniel.morsing
CC=golang-dev
https://golang.org/cl/10227043
This commit is contained in:
Russ Cox 2013-06-18 14:43:37 -04:00
parent f882bc8708
commit 269b2f2d4d
3 changed files with 3 additions and 6 deletions

View File

@ -268,7 +268,6 @@ struct Node
uchar dupok; // duplicate definitions ok (for func)
schar likely; // likeliness of if statement
uchar hasbreak; // has break statement
uchar norace; // disable race detector for this function
uint esc; // EscXXX
int funcdepth;

View File

@ -58,7 +58,7 @@ racewalk(Node *fn)
Node *nodpc;
char s[1024];
if(fn->norace || ispkgin(omit_pkgs, nelem(omit_pkgs)))
if(ispkgin(omit_pkgs, nelem(omit_pkgs)))
return;
if(!ispkgin(noinst_pkgs, nelem(noinst_pkgs))) {

View File

@ -2573,11 +2573,9 @@ genwrapper(Type *rcvr, Type *method, Sym *newnam, int iface)
dot = adddot(nod(OXDOT, this->left, newname(method->sym)));
// generate call
if(isptr[rcvr->etype] && isptr[methodrcvr->etype] && method->embedded && !isifacemethod(method->type)) {
if(!flag_race && isptr[rcvr->etype] && isptr[methodrcvr->etype] && method->embedded && !isifacemethod(method->type)) {
// generate tail call: adjust pointer receiver and jump to embedded method.
fn->norace = 1; // something about this body makes the race detector unhappy.
// skip final .M
dot = dot->left;
dot = dot->left; // skip final .M
if(!isptr[dotlist[0].field->type->etype])
dot = nod(OADDR, dot, N);
as = nod(OAS, this->left, nod(OCONVNOP, dot, N));