Commit bca4b95c by Ian Lance Taylor

runtime: Remove undefined references to runtime_race*.

From-SVN: r219049
parent 3feb0298
...@@ -6,7 +6,6 @@ package runtime ...@@ -6,7 +6,6 @@ package runtime
#include "runtime.h" #include "runtime.h"
#include "arch.h" #include "arch.h"
#include "go-type.h" #include "go-type.h"
#include "race.h"
#include "malloc.h" #include "malloc.h"
#include "chan.h" #include "chan.h"
...@@ -15,7 +14,6 @@ uint32 runtime_Hchansize = sizeof(Hchan); ...@@ -15,7 +14,6 @@ uint32 runtime_Hchansize = sizeof(Hchan);
static void dequeueg(WaitQ*); static void dequeueg(WaitQ*);
static SudoG* dequeue(WaitQ*); static SudoG* dequeue(WaitQ*);
static void enqueue(WaitQ*, SudoG*); static void enqueue(WaitQ*, SudoG*);
static void racesync(Hchan*, SudoG*);
static Hchan* static Hchan*
makechan(ChanType *t, int64 hint) makechan(ChanType *t, int64 hint)
...@@ -82,6 +80,7 @@ __go_new_channel_big(ChanType *t, uint64 hint) ...@@ -82,6 +80,7 @@ __go_new_channel_big(ChanType *t, uint64 hint)
static bool static bool
chansend(ChanType *t, Hchan *c, byte *ep, bool block, void *pc) chansend(ChanType *t, Hchan *c, byte *ep, bool block, void *pc)
{ {
USED(pc);
SudoG *sg; SudoG *sg;
SudoG mysg; SudoG mysg;
G* gp; G* gp;
...@@ -90,9 +89,6 @@ chansend(ChanType *t, Hchan *c, byte *ep, bool block, void *pc) ...@@ -90,9 +89,6 @@ chansend(ChanType *t, Hchan *c, byte *ep, bool block, void *pc)
g = runtime_g(); g = runtime_g();
if(raceenabled)
runtime_racereadobjectpc(ep, t->__element_type, runtime_getcallerpc(&t), chansend);
if(c == nil) { if(c == nil) {
USED(t); USED(t);
if(!block) if(!block)
...@@ -116,8 +112,6 @@ chansend(ChanType *t, Hchan *c, byte *ep, bool block, void *pc) ...@@ -116,8 +112,6 @@ chansend(ChanType *t, Hchan *c, byte *ep, bool block, void *pc)
} }
runtime_lock(c); runtime_lock(c);
if(raceenabled)
runtime_racereadpc(c, pc, chansend);
if(c->closed) if(c->closed)
goto closed; goto closed;
...@@ -126,8 +120,6 @@ chansend(ChanType *t, Hchan *c, byte *ep, bool block, void *pc) ...@@ -126,8 +120,6 @@ chansend(ChanType *t, Hchan *c, byte *ep, bool block, void *pc)
sg = dequeue(&c->recvq); sg = dequeue(&c->recvq);
if(sg != nil) { if(sg != nil) {
if(raceenabled)
racesync(c, sg);
runtime_unlock(c); runtime_unlock(c);
gp = sg->g; gp = sg->g;
...@@ -183,11 +175,6 @@ asynch: ...@@ -183,11 +175,6 @@ asynch:
goto asynch; goto asynch;
} }
if(raceenabled) {
runtime_raceacquire(chanbuf(c, c->sendx));
runtime_racerelease(chanbuf(c, c->sendx));
}
runtime_memmove(chanbuf(c, c->sendx), ep, c->elemsize); runtime_memmove(chanbuf(c, c->sendx), ep, c->elemsize);
if(++c->sendx == c->dataqsiz) if(++c->sendx == c->dataqsiz)
c->sendx = 0; c->sendx = 0;
...@@ -225,8 +212,6 @@ chanrecv(ChanType *t, Hchan* c, byte *ep, bool block, bool *received) ...@@ -225,8 +212,6 @@ chanrecv(ChanType *t, Hchan* c, byte *ep, bool block, bool *received)
if(runtime_gcwaiting()) if(runtime_gcwaiting())
runtime_gosched(); runtime_gosched();
// raceenabled: don't need to check ep, as it is always on the stack.
if(debug) if(debug)
runtime_printf("chanrecv: chan=%p\n", c); runtime_printf("chanrecv: chan=%p\n", c);
...@@ -256,8 +241,6 @@ chanrecv(ChanType *t, Hchan* c, byte *ep, bool block, bool *received) ...@@ -256,8 +241,6 @@ chanrecv(ChanType *t, Hchan* c, byte *ep, bool block, bool *received)
sg = dequeue(&c->sendq); sg = dequeue(&c->sendq);
if(sg != nil) { if(sg != nil) {
if(raceenabled)
racesync(c, sg);
runtime_unlock(c); runtime_unlock(c);
if(ep != nil) if(ep != nil)
...@@ -319,11 +302,6 @@ asynch: ...@@ -319,11 +302,6 @@ asynch:
goto asynch; goto asynch;
} }
if(raceenabled) {
runtime_raceacquire(chanbuf(c, c->recvx));
runtime_racerelease(chanbuf(c, c->recvx));
}
if(ep != nil) if(ep != nil)
runtime_memmove(ep, chanbuf(c, c->recvx), c->elemsize); runtime_memmove(ep, chanbuf(c, c->recvx), c->elemsize);
runtime_memclr(chanbuf(c, c->recvx), c->elemsize); runtime_memclr(chanbuf(c, c->recvx), c->elemsize);
...@@ -352,8 +330,6 @@ closed: ...@@ -352,8 +330,6 @@ closed:
runtime_memclr(ep, c->elemsize); runtime_memclr(ep, c->elemsize);
if(received != nil) if(received != nil)
*received = false; *received = false;
if(raceenabled)
runtime_raceacquire(c);
runtime_unlock(c); runtime_unlock(c);
if(mysg.releasetime > 0) if(mysg.releasetime > 0)
runtime_blockevent(mysg.releasetime - t0, 2); runtime_blockevent(mysg.releasetime - t0, 2);
...@@ -789,8 +765,6 @@ loop: ...@@ -789,8 +765,6 @@ loop:
break; break;
case CaseSend: case CaseSend:
if(raceenabled)
runtime_racereadpc(c, runtime_selectgo, chansend);
if(c->closed) if(c->closed)
goto sclose; goto sclose;
if(c->dataqsiz > 0) { if(c->dataqsiz > 0) {
...@@ -874,24 +848,11 @@ loop: ...@@ -874,24 +848,11 @@ loop:
*cas->receivedp = true; *cas->receivedp = true;
} }
if(raceenabled) {
if(cas->kind == CaseRecv && cas->sg.elem != nil)
runtime_racewriteobjectpc(cas->sg.elem, c->elemtype, selectgo, chanrecv);
else if(cas->kind == CaseSend)
runtime_racereadobjectpc(cas->sg.elem, c->elemtype, selectgo, chansend);
}
selunlock(sel); selunlock(sel);
goto retc; goto retc;
asyncrecv: asyncrecv:
// can receive from buffer // can receive from buffer
if(raceenabled) {
if(cas->sg.elem != nil)
runtime_racewriteobjectpc(cas->sg.elem, c->elemtype, selectgo, chanrecv);
runtime_raceacquire(chanbuf(c, c->recvx));
runtime_racerelease(chanbuf(c, c->recvx));
}
if(cas->receivedp != nil) if(cas->receivedp != nil)
*cas->receivedp = true; *cas->receivedp = true;
if(cas->sg.elem != nil) if(cas->sg.elem != nil)
...@@ -914,11 +875,6 @@ asyncrecv: ...@@ -914,11 +875,6 @@ asyncrecv:
asyncsend: asyncsend:
// can send to buffer // can send to buffer
if(raceenabled) {
runtime_raceacquire(chanbuf(c, c->sendx));
runtime_racerelease(chanbuf(c, c->sendx));
runtime_racereadobjectpc(cas->sg.elem, c->elemtype, selectgo, chansend);
}
runtime_memmove(chanbuf(c, c->sendx), cas->sg.elem, c->elemsize); runtime_memmove(chanbuf(c, c->sendx), cas->sg.elem, c->elemsize);
if(++c->sendx == c->dataqsiz) if(++c->sendx == c->dataqsiz)
c->sendx = 0; c->sendx = 0;
...@@ -937,11 +893,6 @@ asyncsend: ...@@ -937,11 +893,6 @@ asyncsend:
syncrecv: syncrecv:
// can receive from sleeping sender (sg) // can receive from sleeping sender (sg)
if(raceenabled) {
if(cas->sg.elem != nil)
runtime_racewriteobjectpc(cas->sg.elem, c->elemtype, selectgo, chanrecv);
racesync(c, sg);
}
selunlock(sel); selunlock(sel);
if(debug) if(debug)
runtime_printf("syncrecv: sel=%p c=%p o=%d\n", sel, c, o); runtime_printf("syncrecv: sel=%p c=%p o=%d\n", sel, c, o);
...@@ -963,16 +914,10 @@ rclose: ...@@ -963,16 +914,10 @@ rclose:
*cas->receivedp = false; *cas->receivedp = false;
if(cas->sg.elem != nil) if(cas->sg.elem != nil)
runtime_memclr(cas->sg.elem, c->elemsize); runtime_memclr(cas->sg.elem, c->elemsize);
if(raceenabled)
runtime_raceacquire(c);
goto retc; goto retc;
syncsend: syncsend:
// can send to sleeping receiver (sg) // can send to sleeping receiver (sg)
if(raceenabled) {
runtime_racereadobjectpc(cas->sg.elem, c->elemtype, selectgo, chansend);
racesync(c, sg);
}
selunlock(sel); selunlock(sel);
if(debug) if(debug)
runtime_printf("syncsend: sel=%p c=%p o=%d\n", sel, c, o); runtime_printf("syncsend: sel=%p c=%p o=%d\n", sel, c, o);
...@@ -1062,6 +1007,7 @@ func reflect.chanclose(c *Hchan) { ...@@ -1062,6 +1007,7 @@ func reflect.chanclose(c *Hchan) {
static void static void
closechan(Hchan *c, void *pc) closechan(Hchan *c, void *pc)
{ {
USED(pc);
SudoG *sg; SudoG *sg;
G* gp; G* gp;
...@@ -1076,12 +1022,6 @@ closechan(Hchan *c, void *pc) ...@@ -1076,12 +1022,6 @@ closechan(Hchan *c, void *pc)
runtime_unlock(c); runtime_unlock(c);
runtime_panicstring("close of closed channel"); runtime_panicstring("close of closed channel");
} }
if(raceenabled) {
runtime_racewritepc(c, pc, runtime_closechan);
runtime_racerelease(c);
}
c->closed = true; c->closed = true;
// release all readers // release all readers
...@@ -1194,12 +1134,3 @@ enqueue(WaitQ *q, SudoG *sgp) ...@@ -1194,12 +1134,3 @@ enqueue(WaitQ *q, SudoG *sgp)
q->last->link = sgp; q->last->link = sgp;
q->last = sgp; q->last = sgp;
} }
static void
racesync(Hchan *c, SudoG *sg)
{
runtime_racerelease(chanbuf(c, 0));
runtime_raceacquireg(sg->g, chanbuf(c, 0));
runtime_racereleaseg(sg->g, chanbuf(c, 0));
runtime_raceacquire(chanbuf(c, 0));
}
...@@ -16,7 +16,6 @@ package runtime ...@@ -16,7 +16,6 @@ package runtime
#include "malloc.h" #include "malloc.h"
#include "interface.h" #include "interface.h"
#include "go-type.h" #include "go-type.h"
#include "race.h"
// Map gccgo field names to gc field names. // Map gccgo field names to gc field names.
// Eface aka __go_empty_interface. // Eface aka __go_empty_interface.
...@@ -249,9 +248,6 @@ runtime_mallocgc(uintptr size, uintptr typ, uint32 flag) ...@@ -249,9 +248,6 @@ runtime_mallocgc(uintptr size, uintptr typ, uint32 flag)
if(UseSpanType && !(flag & FlagNoScan) && typ != 0) if(UseSpanType && !(flag & FlagNoScan) && typ != 0)
settype(s, v, typ); settype(s, v, typ);
if(raceenabled)
runtime_racemalloc(v, size);
if(runtime_debug.allocfreetrace) if(runtime_debug.allocfreetrace)
runtime_tracealloc(v, size, typ); runtime_tracealloc(v, size, typ);
...@@ -697,8 +693,6 @@ runtime_MHeap_SysAlloc(MHeap *h, uintptr n) ...@@ -697,8 +693,6 @@ runtime_MHeap_SysAlloc(MHeap *h, uintptr n)
h->arena_used += n; h->arena_used += n;
runtime_MHeap_MapBits(h); runtime_MHeap_MapBits(h);
runtime_MHeap_MapSpans(h); runtime_MHeap_MapSpans(h);
if(raceenabled)
runtime_racemapshadow(p, n);
if(((uintptr)p & (PageSize-1)) != 0) if(((uintptr)p & (PageSize-1)) != 0)
runtime_throw("misrounded allocation in MHeap_SysAlloc"); runtime_throw("misrounded allocation in MHeap_SysAlloc");
...@@ -732,8 +726,6 @@ runtime_MHeap_SysAlloc(MHeap *h, uintptr n) ...@@ -732,8 +726,6 @@ runtime_MHeap_SysAlloc(MHeap *h, uintptr n)
h->arena_end = p_end; h->arena_end = p_end;
runtime_MHeap_MapBits(h); runtime_MHeap_MapBits(h);
runtime_MHeap_MapSpans(h); runtime_MHeap_MapSpans(h);
if(raceenabled)
runtime_racemapshadow(p, n);
} }
if(((uintptr)p & (PageSize-1)) != 0) if(((uintptr)p & (PageSize-1)) != 0)
......
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
#include "malloc.h" #include "malloc.h"
#include "mgc0.h" #include "mgc0.h"
#include "chan.h" #include "chan.h"
#include "race.h"
#include "go-type.h" #include "go-type.h"
// Map gccgo field names to gc field names. // Map gccgo field names to gc field names.
...@@ -2507,8 +2506,6 @@ runfinq(void* dummy __attribute__ ((unused))) ...@@ -2507,8 +2506,6 @@ runfinq(void* dummy __attribute__ ((unused)))
continue; continue;
} }
runtime_unlock(&finlock); runtime_unlock(&finlock);
if(raceenabled)
runtime_racefingo();
for(; fb; fb=next) { for(; fb; fb=next) {
next = fb->next; next = fb->next;
for(i=0; i<(uint32)fb->cnt; i++) { for(i=0; i<(uint32)fb->cnt; i++) {
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "arch.h" #include "arch.h"
#include "defs.h" #include "defs.h"
#include "malloc.h" #include "malloc.h"
#include "race.h"
#include "go-type.h" #include "go-type.h"
#include "go-defer.h" #include "go-defer.h"
...@@ -462,9 +461,6 @@ runtime_schedinit(void) ...@@ -462,9 +461,6 @@ runtime_schedinit(void)
// Can not enable GC until all roots are registered. // Can not enable GC until all roots are registered.
// mstats.enablegc = 1; // mstats.enablegc = 1;
// if(raceenabled)
// g->racectx = runtime_raceinit();
} }
extern void main_init(void) __asm__ (GOSYM_PREFIX "__go_init_main"); extern void main_init(void) __asm__ (GOSYM_PREFIX "__go_init_main");
...@@ -528,8 +524,6 @@ runtime_main(void* dummy __attribute__((unused))) ...@@ -528,8 +524,6 @@ runtime_main(void* dummy __attribute__((unused)))
mstats.enablegc = 1; mstats.enablegc = 1;
main_main(); main_main();
if(raceenabled)
runtime_racefini();
// Make racy client program work: if panicking on // Make racy client program work: if panicking on
// another goroutine at the same time as main returns, // another goroutine at the same time as main returns,
...@@ -1848,8 +1842,6 @@ runtime_goexit(void) ...@@ -1848,8 +1842,6 @@ runtime_goexit(void)
{ {
if(g->status != Grunning) if(g->status != Grunning)
runtime_throw("bad g status"); runtime_throw("bad g status");
if(raceenabled)
runtime_racegoend();
runtime_mcall(goexit0); runtime_mcall(goexit0);
} }
......
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Definitions related to data race detection.
#ifdef RACE
enum { raceenabled = 1 };
#else
enum { raceenabled = 0 };
#endif
// Initialize race detection subsystem.
uintptr runtime_raceinit(void);
// Finalize race detection subsystem, does not return.
void runtime_racefini(void);
void runtime_racemapshadow(void *addr, uintptr size);
void runtime_racemalloc(void *p, uintptr sz);
uintptr runtime_racegostart(void *pc);
void runtime_racegoend(void);
void runtime_racewritepc(void *addr, void *callpc, void *pc);
void runtime_racereadpc(void *addr, void *callpc, void *pc);
void runtime_racewriterangepc(void *addr, uintptr sz, void *callpc, void *pc);
void runtime_racereadrangepc(void *addr, uintptr sz, void *callpc, void *pc);
void runtime_racereadobjectpc(void *addr, const Type *t, void *callpc, void *pc);
void runtime_racewriteobjectpc(void *addr, const Type *t, void *callpc, void *pc);
void runtime_racefingo(void);
void runtime_raceacquire(void *addr);
void runtime_raceacquireg(G *gp, void *addr);
void runtime_racerelease(void *addr);
void runtime_racereleaseg(G *gp, void *addr);
void runtime_racereleasemerge(void *addr);
void runtime_racereleasemergeg(G *gp, void *addr);
...@@ -7,7 +7,6 @@ package runtime ...@@ -7,7 +7,6 @@ package runtime
#include "arch.h" #include "arch.h"
#include "malloc.h" #include "malloc.h"
#include "go-string.h" #include "go-string.h"
#include "race.h"
#define charntorune(pv, str, len) __go_get_rune(str, len, pv) #define charntorune(pv, str, len) __go_get_rune(str, len, pv)
......
...@@ -12,7 +12,6 @@ package time ...@@ -12,7 +12,6 @@ package time
#include "defs.h" #include "defs.h"
#include "arch.h" #include "arch.h"
#include "malloc.h" #include "malloc.h"
#include "race.h"
enum { enum {
debug = 0, debug = 0,
...@@ -42,8 +41,6 @@ func Sleep(ns int64) { ...@@ -42,8 +41,6 @@ func Sleep(ns int64) {
// startTimer adds t to the timer heap. // startTimer adds t to the timer heap.
func startTimer(t *Timer) { func startTimer(t *Timer) {
if(raceenabled)
runtime_racerelease(t);
runtime_addtimer(t); runtime_addtimer(t);
} }
...@@ -237,8 +234,6 @@ timerproc(void* dummy __attribute__ ((unused))) ...@@ -237,8 +234,6 @@ timerproc(void* dummy __attribute__ ((unused)))
f = (void*)t->fv->fn; f = (void*)t->fv->fn;
arg = t->arg; arg = t->arg;
runtime_unlock(&timers); runtime_unlock(&timers);
if(raceenabled)
runtime_raceacquire(t);
__go_set_closure(fv); __go_set_closure(fv);
f(now, arg); f(now, arg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment