mirror of
https://github.com/golang/go
synced 2024-11-23 05:10:09 -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:
parent
f882bc8708
commit
269b2f2d4d
@ -268,7 +268,6 @@ struct Node
|
|||||||
uchar dupok; // duplicate definitions ok (for func)
|
uchar dupok; // duplicate definitions ok (for func)
|
||||||
schar likely; // likeliness of if statement
|
schar likely; // likeliness of if statement
|
||||||
uchar hasbreak; // has break statement
|
uchar hasbreak; // has break statement
|
||||||
uchar norace; // disable race detector for this function
|
|
||||||
uint esc; // EscXXX
|
uint esc; // EscXXX
|
||||||
int funcdepth;
|
int funcdepth;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ racewalk(Node *fn)
|
|||||||
Node *nodpc;
|
Node *nodpc;
|
||||||
char s[1024];
|
char s[1024];
|
||||||
|
|
||||||
if(fn->norace || ispkgin(omit_pkgs, nelem(omit_pkgs)))
|
if(ispkgin(omit_pkgs, nelem(omit_pkgs)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!ispkgin(noinst_pkgs, nelem(noinst_pkgs))) {
|
if(!ispkgin(noinst_pkgs, nelem(noinst_pkgs))) {
|
||||||
|
@ -2573,11 +2573,9 @@ genwrapper(Type *rcvr, Type *method, Sym *newnam, int iface)
|
|||||||
dot = adddot(nod(OXDOT, this->left, newname(method->sym)));
|
dot = adddot(nod(OXDOT, this->left, newname(method->sym)));
|
||||||
|
|
||||||
// generate call
|
// 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.
|
// generate tail call: adjust pointer receiver and jump to embedded method.
|
||||||
fn->norace = 1; // something about this body makes the race detector unhappy.
|
dot = dot->left; // skip final .M
|
||||||
// skip final .M
|
|
||||||
dot = dot->left;
|
|
||||||
if(!isptr[dotlist[0].field->type->etype])
|
if(!isptr[dotlist[0].field->type->etype])
|
||||||
dot = nod(OADDR, dot, N);
|
dot = nod(OADDR, dot, N);
|
||||||
as = nod(OAS, this->left, nod(OCONVNOP, dot, N));
|
as = nod(OAS, this->left, nod(OCONVNOP, dot, N));
|
||||||
|
Loading…
Reference in New Issue
Block a user