]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/gc: turn race detector off for tail-call method wrapper functions
authorRuss Cox <rsc@golang.org>
Wed, 12 Jun 2013 02:37:07 +0000 (22:37 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 12 Jun 2013 02:37:07 +0000 (22:37 -0400)
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

src/cmd/gc/go.h
src/cmd/gc/racewalk.c
src/cmd/gc/subr.c

index eb5e523b5701a06b1b034b6d13adeadc987cdb0d..2f2d90391c42561bd373719c8c6e507e4fe92f32 100644 (file)
@@ -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;
 
index 60ed0f06438330776ac6ce08a4beb50c90fd59b3..41edc52c761a9c1ada4919b7c03b60e9a815dcb6 100644 (file)
@@ -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))) {
index a3fd0f4a8e0d9243bb44c21a25c3f743550ac54a..c3e00a2e957713199c00cd95601c7d4fdbdc6c59 100644 (file)
@@ -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])