// Reuse the newly evicted entry.
e.depth = uintptr(len(pc))
e.count = 1
- for i := range pc {
- e.stack[i] = pc[i]
- }
+ copy(e.stack[:], pc)
}
// evict copies the given entry's data into the log, so that
q++
log[q] = d
q++
- for i := uintptr(0); i < d; i++ {
- log[q] = e.stack[i]
- q++
- }
+ copy(log[q:], e.stack[:d])
+ q += d
p.nlog = q
e.count = 0
return true
runtime·main(void)
{
Defer d;
-
+
+ // Racectx of m0->g0 is used only as the parent of the main goroutine.
+ // It must not be used for anything else.
+ g->m->g0->racectx = 0;
+
// Max stack size is 1 GB on 64-bit, 250 MB on 32-bit.
// Using decimal instead of binary GB and MB because
// they look nicer in the stack overflow failure message.
mp = runtime·allocm(p);
mp->nextp = p;
mp->mstartfn = fn;
- if(raceenabled)
- mp->g0->racectx = runtime·racegostart(newm);
if(runtime·iscgo) {
CgoThreadStart ts;
void
runtime·racewriterangepc(void *addr, uintptr sz, void *callpc, void *pc)
{
+ if(g != g->m->curg) {
+ // The call is coming from manual instrumentation of Go code running on g0/gsignal.
+ // Not interesting.
+ return;
+ }
if(callpc != nil)
runtime·racefuncenter(callpc);
runtime·racewriterangepc1(addr, sz, pc);
void
runtime·racereadrangepc(void *addr, uintptr sz, void *callpc, void *pc)
{
+ if(g != g->m->curg) {
+ // The call is coming from manual instrumentation of Go code running on g0/gsignal.
+ // Not interesting.
+ return;
+ }
if(callpc != nil)
runtime·racefuncenter(callpc);
runtime·racereadrangepc1(addr, sz, pc);