runtime: Remove undefined references to runtime_race*.

From-SVN: r219049
This commit is contained in:
Ian Lance Taylor 2014-12-23 20:33:53 +00:00
parent 3feb029833
commit bca4b95c4a
7 changed files with 2 additions and 130 deletions

View File

@ -6,7 +6,6 @@ package runtime
#include "runtime.h"
#include "arch.h"
#include "go-type.h"
#include "race.h"
#include "malloc.h"
#include "chan.h"
@ -15,7 +14,6 @@ uint32 runtime_Hchansize = sizeof(Hchan);
static void dequeueg(WaitQ*);
static SudoG* dequeue(WaitQ*);
static void enqueue(WaitQ*, SudoG*);
static void racesync(Hchan*, SudoG*);
static Hchan*
makechan(ChanType *t, int64 hint)
@ -82,6 +80,7 @@ __go_new_channel_big(ChanType *t, uint64 hint)
static bool
chansend(ChanType *t, Hchan *c, byte *ep, bool block, void *pc)
{
USED(pc);
SudoG *sg;
SudoG mysg;
G* gp;
@ -90,9 +89,6 @@ chansend(ChanType *t, Hchan *c, byte *ep, bool block, void *pc)
g = runtime_g();
if(raceenabled)
runtime_racereadobjectpc(ep, t->__element_type, runtime_getcallerpc(&t), chansend);
if(c == nil) {
USED(t);
if(!block)
@ -116,8 +112,6 @@ chansend(ChanType *t, Hchan *c, byte *ep, bool block, void *pc)
}
runtime_lock(c);
if(raceenabled)
runtime_racereadpc(c, pc, chansend);
if(c->closed)
goto closed;
@ -126,8 +120,6 @@ chansend(ChanType *t, Hchan *c, byte *ep, bool block, void *pc)
sg = dequeue(&c->recvq);
if(sg != nil) {
if(raceenabled)
racesync(c, sg);
runtime_unlock(c);
gp = sg->g;
@ -183,11 +175,6 @@ 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);
if(++c->sendx == c->dataqsiz)
c->sendx = 0;
@ -225,8 +212,6 @@ chanrecv(ChanType *t, Hchan* c, byte *ep, bool block, bool *received)
if(runtime_gcwaiting())
runtime_gosched();
// raceenabled: don't need to check ep, as it is always on the stack.
if(debug)
runtime_printf("chanrecv: chan=%p\n", c);
@ -256,8 +241,6 @@ chanrecv(ChanType *t, Hchan* c, byte *ep, bool block, bool *received)
sg = dequeue(&c->sendq);
if(sg != nil) {
if(raceenabled)
racesync(c, sg);
runtime_unlock(c);
if(ep != nil)
@ -319,11 +302,6 @@ asynch:
goto asynch;
}
if(raceenabled) {
runtime_raceacquire(chanbuf(c, c->recvx));
runtime_racerelease(chanbuf(c, c->recvx));
}
if(ep != nil)
runtime_memmove(ep, chanbuf(c, c->recvx), c->elemsize);
runtime_memclr(chanbuf(c, c->recvx), c->elemsize);
@ -352,8 +330,6 @@ closed:
runtime_memclr(ep, c->elemsize);
if(received != nil)
*received = false;
if(raceenabled)
runtime_raceacquire(c);
runtime_unlock(c);
if(mysg.releasetime > 0)
runtime_blockevent(mysg.releasetime - t0, 2);
@ -789,8 +765,6 @@ loop:
break;
case CaseSend:
if(raceenabled)
runtime_racereadpc(c, runtime_selectgo, chansend);
if(c->closed)
goto sclose;
if(c->dataqsiz > 0) {
@ -874,24 +848,11 @@ loop:
*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);
goto retc;
asyncrecv:
// 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)
*cas->receivedp = true;
if(cas->sg.elem != nil)
@ -914,11 +875,6 @@ asyncrecv:
asyncsend:
// 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);
if(++c->sendx == c->dataqsiz)
c->sendx = 0;
@ -937,11 +893,6 @@ asyncsend:
syncrecv:
// 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);
if(debug)
runtime_printf("syncrecv: sel=%p c=%p o=%d\n", sel, c, o);
@ -963,16 +914,10 @@ rclose:
*cas->receivedp = false;
if(cas->sg.elem != nil)
runtime_memclr(cas->sg.elem, c->elemsize);
if(raceenabled)
runtime_raceacquire(c);
goto retc;
syncsend:
// can send to sleeping receiver (sg)
if(raceenabled) {
runtime_racereadobjectpc(cas->sg.elem, c->elemtype, selectgo, chansend);
racesync(c, sg);
}
selunlock(sel);
if(debug)
runtime_printf("syncsend: sel=%p c=%p o=%d\n", sel, c, o);
@ -1062,6 +1007,7 @@ func reflect.chanclose(c *Hchan) {
static void
closechan(Hchan *c, void *pc)
{
USED(pc);
SudoG *sg;
G* gp;
@ -1076,12 +1022,6 @@ closechan(Hchan *c, void *pc)
runtime_unlock(c);
runtime_panicstring("close of closed channel");
}
if(raceenabled) {
runtime_racewritepc(c, pc, runtime_closechan);
runtime_racerelease(c);
}
c->closed = true;
// release all readers
@ -1194,12 +1134,3 @@ enqueue(WaitQ *q, SudoG *sgp)
q->last->link = 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));
}

View File

@ -16,7 +16,6 @@ package runtime
#include "malloc.h"
#include "interface.h"
#include "go-type.h"
#include "race.h"
// Map gccgo field names to gc field names.
// Eface aka __go_empty_interface.
@ -249,9 +248,6 @@ runtime_mallocgc(uintptr size, uintptr typ, uint32 flag)
if(UseSpanType && !(flag & FlagNoScan) && typ != 0)
settype(s, v, typ);
if(raceenabled)
runtime_racemalloc(v, size);
if(runtime_debug.allocfreetrace)
runtime_tracealloc(v, size, typ);
@ -697,8 +693,6 @@ runtime_MHeap_SysAlloc(MHeap *h, uintptr n)
h->arena_used += n;
runtime_MHeap_MapBits(h);
runtime_MHeap_MapSpans(h);
if(raceenabled)
runtime_racemapshadow(p, n);
if(((uintptr)p & (PageSize-1)) != 0)
runtime_throw("misrounded allocation in MHeap_SysAlloc");
@ -732,8 +726,6 @@ runtime_MHeap_SysAlloc(MHeap *h, uintptr n)
h->arena_end = p_end;
runtime_MHeap_MapBits(h);
runtime_MHeap_MapSpans(h);
if(raceenabled)
runtime_racemapshadow(p, n);
}
if(((uintptr)p & (PageSize-1)) != 0)

View File

@ -57,7 +57,6 @@
#include "malloc.h"
#include "mgc0.h"
#include "chan.h"
#include "race.h"
#include "go-type.h"
// Map gccgo field names to gc field names.
@ -2507,8 +2506,6 @@ runfinq(void* dummy __attribute__ ((unused)))
continue;
}
runtime_unlock(&finlock);
if(raceenabled)
runtime_racefingo();
for(; fb; fb=next) {
next = fb->next;
for(i=0; i<(uint32)fb->cnt; i++) {

View File

@ -18,7 +18,6 @@
#include "arch.h"
#include "defs.h"
#include "malloc.h"
#include "race.h"
#include "go-type.h"
#include "go-defer.h"
@ -462,9 +461,6 @@ runtime_schedinit(void)
// Can not enable GC until all roots are registered.
// mstats.enablegc = 1;
// if(raceenabled)
// g->racectx = runtime_raceinit();
}
extern void main_init(void) __asm__ (GOSYM_PREFIX "__go_init_main");
@ -528,8 +524,6 @@ runtime_main(void* dummy __attribute__((unused)))
mstats.enablegc = 1;
main_main();
if(raceenabled)
runtime_racefini();
// Make racy client program work: if panicking on
// another goroutine at the same time as main returns,
@ -1848,8 +1842,6 @@ runtime_goexit(void)
{
if(g->status != Grunning)
runtime_throw("bad g status");
if(raceenabled)
runtime_racegoend();
runtime_mcall(goexit0);
}

View File

@ -1,34 +0,0 @@
// 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);

View File

@ -7,7 +7,6 @@ package runtime
#include "arch.h"
#include "malloc.h"
#include "go-string.h"
#include "race.h"
#define charntorune(pv, str, len) __go_get_rune(str, len, pv)

View File

@ -12,7 +12,6 @@ package time
#include "defs.h"
#include "arch.h"
#include "malloc.h"
#include "race.h"
enum {
debug = 0,
@ -42,8 +41,6 @@ func Sleep(ns int64) {
// startTimer adds t to the timer heap.
func startTimer(t *Timer) {
if(raceenabled)
runtime_racerelease(t);
runtime_addtimer(t);
}
@ -237,8 +234,6 @@ timerproc(void* dummy __attribute__ ((unused)))
f = (void*)t->fv->fn;
arg = t->arg;
runtime_unlock(&timers);
if(raceenabled)
runtime_raceacquire(t);
__go_set_closure(fv);
f(now, arg);