runtime: eliminate traceBuf write barriers

The tracing code is currently called from contexts such as sysmon and
the scheduler where write barriers are not allowed. Unfortunately,
while the common paths through the tracing code do not have write
barriers, many of the less common paths dealing with buffer overflow
and recycling do.

This change replaces all *traceBufs with traceBufPtrs. In the style of
guintptr, etc., the GC does not trace traceBufPtrs and write barriers
do not apply when these pointers are written. Since traceBufs are
allocated from non-GC'd memory and manually managed, this is always
safe.

Updates #10600.

Change-Id: I52b992d36d1b634ebd855c8cde27947ec14f59ba
Reviewed-on: https://go-review.googlesource.com/16812
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
This commit is contained in:
Austin Clements 2015-11-10 14:37:52 -05:00
parent a9a7e40609
commit 03227bb55e
2 changed files with 83 additions and 69 deletions

View file

@ -380,7 +380,7 @@ type p struct {
sudogcache []*sudog
sudogbuf [128]*sudog
tracebuf *traceBuf
tracebuf traceBufPtr
palloc persistentAlloc // per-P to avoid mutex