runtime: move write barrier code into mbarrier.go

I also added new comments at the top of mbarrier.go,
but the rest of the code is just copy-and-paste.

Change-Id: Iaeb2b12f8b1eaa33dbff5c2de676ca902bfddf2e
Reviewed-on: https://go-review.googlesource.com/2990
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Russ Cox 2015-01-14 21:47:49 -05:00
parent 7ef59e4ed8
commit 4d226dfee9
5 changed files with 492 additions and 469 deletions

View file

@ -22,7 +22,6 @@ const (
const (
uintptrMask = 1<<(8*ptrSize) - 1
poisonGC = uintptrMask & 0xf969696969696969
poisonStack = uintptrMask & 0x6868686868686868
// Goroutine preemption request.
@ -389,7 +388,7 @@ func adjustpointers(scanp unsafe.Pointer, cbv *bitvector, adjinfo *adjustinfo, f
case _BitsPointer:
p := *(*unsafe.Pointer)(add(scanp, i*ptrSize))
up := uintptr(p)
if f != nil && 0 < up && up < _PageSize && debug.invalidptr != 0 || up == poisonGC || up == poisonStack {
if f != nil && 0 < up && up < _PageSize && debug.invalidptr != 0 || up == poisonStack {
// Looks like a junk value in a pointer slot.
// Live analysis wrong?
getg().m.traceback = 2