Commit e2d95c1f authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

runtime/race: remove now unused step parameter from range access functions

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/10259043
parent 591d58a3
...@@ -16,8 +16,8 @@ void runtime∕race·Finalize(void); ...@@ -16,8 +16,8 @@ void runtime∕race·Finalize(void);
void runtimerace·FinalizerGoroutine(uintptr racectx); void runtimerace·FinalizerGoroutine(uintptr racectx);
void runtimerace·Read(uintptr racectx, void *addr, void *pc); void runtimerace·Read(uintptr racectx, void *addr, void *pc);
void runtimerace·Write(uintptr racectx, void *addr, void *pc); void runtimerace·Write(uintptr racectx, void *addr, void *pc);
void runtimerace·ReadRange(uintptr racectx, void *addr, uintptr sz, uintptr step, void *pc); void runtimerace·ReadRange(uintptr racectx, void *addr, uintptr sz, void *pc);
void runtimerace·WriteRange(uintptr racectx, void *addr, uintptr sz, uintptr step, void *pc); void runtimerace·WriteRange(uintptr racectx, void *addr, uintptr sz, void *pc);
void runtimerace·FuncEnter(uintptr racectx, void *pc); void runtimerace·FuncEnter(uintptr racectx, void *pc);
void runtimerace·FuncExit(uintptr racectx); void runtimerace·FuncExit(uintptr racectx);
void runtimerace·Malloc(uintptr racectx, void *p, uintptr sz, void *pc); void runtimerace·Malloc(uintptr racectx, void *p, uintptr sz, void *pc);
...@@ -189,7 +189,7 @@ runtime·racereadpc(void *addr, void *callpc, void *pc) ...@@ -189,7 +189,7 @@ runtime·racereadpc(void *addr, void *callpc, void *pc)
} }
static void static void
rangeaccess(void *addr, uintptr size, uintptr step, uintptr callpc, uintptr pc, bool write) rangeaccess(void *addr, uintptr size, uintptr callpc, uintptr pc, bool write)
{ {
uintptr racectx; uintptr racectx;
...@@ -202,9 +202,9 @@ rangeaccess(void *addr, uintptr size, uintptr step, uintptr callpc, uintptr pc, ...@@ -202,9 +202,9 @@ rangeaccess(void *addr, uintptr size, uintptr step, uintptr callpc, uintptr pc,
runtimerace·FuncEnter(racectx, (void*)callpc); runtimerace·FuncEnter(racectx, (void*)callpc);
} }
if(write) if(write)
runtimerace·WriteRange(racectx, addr, size, step, (void*)pc); runtimerace·WriteRange(racectx, addr, size, (void*)pc);
else else
runtimerace·ReadRange(racectx, addr, size, step, (void*)pc); runtimerace·ReadRange(racectx, addr, size, (void*)pc);
if(callpc) if(callpc)
runtimerace·FuncExit(racectx); runtimerace·FuncExit(racectx);
m->racecall = false; m->racecall = false;
...@@ -212,15 +212,15 @@ rangeaccess(void *addr, uintptr size, uintptr step, uintptr callpc, uintptr pc, ...@@ -212,15 +212,15 @@ rangeaccess(void *addr, uintptr size, uintptr step, uintptr callpc, uintptr pc,
} }
void void
runtime·racewriterangepc(void *addr, uintptr sz, uintptr step, void *callpc, void *pc) runtime·racewriterangepc(void *addr, uintptr sz, void *callpc, void *pc)
{ {
rangeaccess(addr, sz, step, (uintptr)callpc, (uintptr)pc, true); rangeaccess(addr, sz, (uintptr)callpc, (uintptr)pc, true);
} }
void void
runtime·racereadrangepc(void *addr, uintptr sz, uintptr step, void *callpc, void *pc) runtime·racereadrangepc(void *addr, uintptr sz, void *callpc, void *pc)
{ {
rangeaccess(addr, sz, step, (uintptr)callpc, (uintptr)pc, false); rangeaccess(addr, sz, (uintptr)callpc, (uintptr)pc, false);
} }
void void
...@@ -335,7 +335,7 @@ runtime·RaceWrite(void *addr) ...@@ -335,7 +335,7 @@ runtime·RaceWrite(void *addr)
void void
runtime·RaceReadRange(void *addr, intgo len) runtime·RaceReadRange(void *addr, intgo len)
{ {
rangeaccess(addr, len, 1, 0, (uintptr)runtime·getcallerpc(&addr), false); rangeaccess(addr, len, 0, (uintptr)runtime·getcallerpc(&addr), false);
} }
// func RaceWriteRange(addr unsafe.Pointer, len int) // func RaceWriteRange(addr unsafe.Pointer, len int)
...@@ -343,7 +343,7 @@ runtime·RaceReadRange(void *addr, intgo len) ...@@ -343,7 +343,7 @@ runtime·RaceReadRange(void *addr, intgo len)
void void
runtime·RaceWriteRange(void *addr, intgo len) runtime·RaceWriteRange(void *addr, intgo len)
{ {
rangeaccess(addr, len, 1, 0, (uintptr)runtime·getcallerpc(&addr), true); rangeaccess(addr, len, 0, (uintptr)runtime·getcallerpc(&addr), true);
} }
// func RaceDisable() // func RaceDisable()
......
...@@ -22,8 +22,8 @@ uintptr runtime·racegostart(void *pc); ...@@ -22,8 +22,8 @@ uintptr runtime·racegostart(void *pc);
void runtime·racegoend(void); void runtime·racegoend(void);
void runtime·racewritepc(void *addr, void *callpc, void *pc); void runtime·racewritepc(void *addr, void *callpc, void *pc);
void runtime·racereadpc(void *addr, void *callpc, void *pc); void runtime·racereadpc(void *addr, void *callpc, void *pc);
void runtime·racewriterangepc(void *addr, uintptr sz, uintptr step, void *callpc, void *pc); void runtime·racewriterangepc(void *addr, uintptr sz, void *callpc, void *pc);
void runtime·racereadrangepc(void *addr, uintptr sz, uintptr step, void *callpc, void *pc); void runtime·racereadrangepc(void *addr, uintptr sz, void *callpc, void *pc);
void runtime·racefingo(void); void runtime·racefingo(void);
void runtime·raceacquire(void *addr); void runtime·raceacquire(void *addr);
void runtime·raceacquireg(G *gp, void *addr); void runtime·raceacquireg(G *gp, void *addr);
......
...@@ -56,14 +56,14 @@ func Write(racectx uintptr, addr, pc uintptr) { ...@@ -56,14 +56,14 @@ func Write(racectx uintptr, addr, pc uintptr) {
C.__tsan_write(unsafe.Pointer(racectx), unsafe.Pointer(addr), unsafe.Pointer(pc)) C.__tsan_write(unsafe.Pointer(racectx), unsafe.Pointer(addr), unsafe.Pointer(pc))
} }
func ReadRange(racectx uintptr, addr, sz, step, pc uintptr) { func ReadRange(racectx uintptr, addr, sz, pc uintptr) {
C.__tsan_read_range(unsafe.Pointer(racectx), unsafe.Pointer(addr), C.__tsan_read_range(unsafe.Pointer(racectx), unsafe.Pointer(addr),
C.long(sz), C.long(step), unsafe.Pointer(pc)) C.long(sz), 0 /*step is unused*/, unsafe.Pointer(pc))
} }
func WriteRange(racectx uintptr, addr, sz, step, pc uintptr) { func WriteRange(racectx uintptr, addr, sz, pc uintptr) {
C.__tsan_write_range(unsafe.Pointer(racectx), unsafe.Pointer(addr), C.__tsan_write_range(unsafe.Pointer(racectx), unsafe.Pointer(addr),
C.long(sz), C.long(step), unsafe.Pointer(pc)) C.long(sz), 0 /*step is unused*/, unsafe.Pointer(pc))
} }
func FuncEnter(racectx uintptr, pc uintptr) { func FuncEnter(racectx uintptr, pc uintptr) {
......
...@@ -43,21 +43,19 @@ runtime·racereadpc(void *addr, void *callpc, void *pc) ...@@ -43,21 +43,19 @@ runtime·racereadpc(void *addr, void *callpc, void *pc)
} }
void void
runtime·racewriterangepc(void *addr, uintptr sz, uintptr step, void *callpc, void *pc) runtime·racewriterangepc(void *addr, uintptr sz, void *callpc, void *pc)
{ {
USED(addr); USED(addr);
USED(sz); USED(sz);
USED(step);
USED(callpc); USED(callpc);
USED(pc); USED(pc);
} }
void void
runtime·racereadrangepc(void *addr, uintptr sz, uintptr step, void *callpc, void *pc) runtime·racereadrangepc(void *addr, uintptr sz, void *callpc, void *pc)
{ {
USED(addr); USED(addr);
USED(sz); USED(sz);
USED(step);
USED(callpc); USED(callpc);
USED(pc); USED(pc);
} }
......
...@@ -82,12 +82,12 @@ runtime·appendslice(SliceType *t, Slice x, Slice y, Slice ret) ...@@ -82,12 +82,12 @@ runtime·appendslice(SliceType *t, Slice x, Slice y, Slice ret)
pc = runtime·getcallerpc(&t); pc = runtime·getcallerpc(&t);
// read x[:len] // read x[:len]
if(m > x.cap) if(m > x.cap)
runtime·racereadrangepc(x.array, x.len*w, w, pc, runtime·appendslice); runtime·racereadrangepc(x.array, x.len*w, pc, runtime·appendslice);
// read y // read y
runtime·racereadrangepc(y.array, y.len*w, w, pc, runtime·appendslice); runtime·racereadrangepc(y.array, y.len*w, pc, runtime·appendslice);
// write x[len(x):len(x)+len(y)] // write x[len(x):len(x)+len(y)]
if(m <= x.cap) if(m <= x.cap)
runtime·racewriterangepc(ret.array+ret.len*w, y.len*w, w, pc, runtime·appendslice); runtime·racewriterangepc(ret.array+ret.len*w, y.len*w, pc, runtime·appendslice);
} }
// A very common case is appending bytes. Small appends can avoid the overhead of memmove. // A very common case is appending bytes. Small appends can avoid the overhead of memmove.
...@@ -138,10 +138,10 @@ runtime·appendstr(SliceType *t, Slice x, String y, Slice ret) ...@@ -138,10 +138,10 @@ runtime·appendstr(SliceType *t, Slice x, String y, Slice ret)
pc = runtime·getcallerpc(&t); pc = runtime·getcallerpc(&t);
// read x[:len] // read x[:len]
if(m > x.cap) if(m > x.cap)
runtime·racereadrangepc(x.array, x.len, 1, pc, runtime·appendstr); runtime·racereadrangepc(x.array, x.len, pc, runtime·appendstr);
// write x[len(x):len(x)+len(y)] // write x[len(x):len(x)+len(y)]
if(m <= x.cap) if(m <= x.cap)
runtime·racewriterangepc(ret.array+ret.len, y.len, 1, pc, runtime·appendstr); runtime·racewriterangepc(ret.array+ret.len, y.len, pc, runtime·appendstr);
} }
// Small appends can avoid the overhead of memmove. // Small appends can avoid the overhead of memmove.
...@@ -176,7 +176,7 @@ runtime·growslice(SliceType *t, Slice old, int64 n, Slice ret) ...@@ -176,7 +176,7 @@ runtime·growslice(SliceType *t, Slice old, int64 n, Slice ret)
if(raceenabled) { if(raceenabled) {
pc = runtime·getcallerpc(&t); pc = runtime·getcallerpc(&t);
runtime·racereadrangepc(old.array, old.len*t->elem->size, t->elem->size, pc, runtime·growslice); runtime·racereadrangepc(old.array, old.len*t->elem->size, pc, runtime·growslice);
} }
growslice1(t, old, cap, &ret); growslice1(t, old, cap, &ret);
...@@ -234,8 +234,8 @@ runtime·copy(Slice to, Slice fm, uintptr width, intgo ret) ...@@ -234,8 +234,8 @@ runtime·copy(Slice to, Slice fm, uintptr width, intgo ret)
if(raceenabled) { if(raceenabled) {
pc = runtime·getcallerpc(&to); pc = runtime·getcallerpc(&to);
runtime·racewriterangepc(to.array, ret*width, width, pc, runtime·copy); runtime·racewriterangepc(to.array, ret*width, pc, runtime·copy);
runtime·racereadrangepc(fm.array, ret*width, width, pc, runtime·copy); runtime·racereadrangepc(fm.array, ret*width, pc, runtime·copy);
} }
if(ret == 1 && width == 1) { // common case worth about 2x to do here if(ret == 1 && width == 1) { // common case worth about 2x to do here
...@@ -277,7 +277,7 @@ runtime·slicestringcopy(Slice to, String fm, intgo ret) ...@@ -277,7 +277,7 @@ runtime·slicestringcopy(Slice to, String fm, intgo ret)
if(raceenabled) { if(raceenabled) {
pc = runtime·getcallerpc(&to); pc = runtime·getcallerpc(&to);
runtime·racewriterangepc(to.array, ret, 1, pc, runtime·slicestringcopy); runtime·racewriterangepc(to.array, ret, pc, runtime·slicestringcopy);
} }
runtime·memmove(to.array, fm.str, ret); runtime·memmove(to.array, fm.str, ret);
......
...@@ -240,7 +240,7 @@ func slicebytetostring(b Slice) (s String) { ...@@ -240,7 +240,7 @@ func slicebytetostring(b Slice) (s String) {
if(raceenabled) { if(raceenabled) {
pc = runtime·getcallerpc(&b); pc = runtime·getcallerpc(&b);
runtime·racereadrangepc(b.array, b.len, 1, pc, runtime·slicebytetostring); runtime·racereadrangepc(b.array, b.len, pc, runtime·slicebytetostring);
} }
s = gostringsize(b.len); s = gostringsize(b.len);
runtime·memmove(s.str, b.array, s.len); runtime·memmove(s.str, b.array, s.len);
...@@ -261,7 +261,7 @@ func slicerunetostring(b Slice) (s String) { ...@@ -261,7 +261,7 @@ func slicerunetostring(b Slice) (s String) {
if(raceenabled) { if(raceenabled) {
pc = runtime·getcallerpc(&b); pc = runtime·getcallerpc(&b);
runtime·racereadrangepc(b.array, b.len*sizeof(*a), sizeof(*a), pc, runtime·slicerunetostring); runtime·racereadrangepc(b.array, b.len*sizeof(*a), pc, runtime·slicerunetostring);
} }
a = (int32*)b.array; a = (int32*)b.array;
siz1 = 0; siz1 = 0;
......
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