mirror of
https://github.com/golang/go
synced 2024-11-26 04:17:59 -07:00
cmd/gc: turn race detector off for tail-call method wrapper functions
It was off in the old implementation (because there was no high-level description of the function at all). Maybe some day the race detector should be fixed to handle the wrapper and then enabled for it, but there's no reason that has to be today. R=golang-dev TBR=dvyukov CC=golang-dev https://golang.org/cl/10037045
This commit is contained in:
parent
e50e4f7ec1
commit
e440354c40
@ -268,6 +268,7 @@ 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;
|
||||
|
||||
|
@ -58,7 +58,7 @@ racewalk(Node *fn)
|
||||
Node *nodpc;
|
||||
char s[1024];
|
||||
|
||||
if(ispkgin(omit_pkgs, nelem(omit_pkgs)))
|
||||
if(fn->norace || ispkgin(omit_pkgs, nelem(omit_pkgs)))
|
||||
return;
|
||||
|
||||
if(!ispkgin(noinst_pkgs, nelem(noinst_pkgs))) {
|
||||
|
@ -2574,6 +2574,8 @@ genwrapper(Type *rcvr, Type *method, Sym *newnam, int iface)
|
||||
|
||||
// generate call
|
||||
if(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;
|
||||
if(!isptr[dotlist[0].field->type->etype])
|
||||
|
Loading…
Reference in New Issue
Block a user