compiler, runtime: call gcWriteBarrier instead of writebarrierptr

In 1.11 writebarrierptr is going away, so change the compiler to call
gcWriteBarrier instead.  We weren't using gcWriteBarrier before;
adjust the implementation to use the putFast method.

This revealed a problem in the kickoff function.  When using cgo,
kickoff can be called on the g0 of an m allocated by newExtraM.  In
that case the m will generally have a p, but systemstack may be called
by wbBufFlush as part of flushing the write barrier buffer.  At that
point the buffer is full, so we can not do a write barrier.  So adjust
the existing code in kickoff so that in the case where we are g0,
don't do any write barrier at all.

Change-Id: I7c0a70cc31d9fe57093db160c624b1f720c41920
Reviewed-on: https://go-review.googlesource.com/131395
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 files changed