From: Austin Clements Date: Fri, 7 Apr 2017 22:06:12 +0000 (-0400) Subject: runtime: say where the compiler knows about var writeBarrier X-Git-Tag: go1.9beta1~770 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7e1832d06c0dad102e18e8db0c45f5fcc979718e;p=gostls13.git runtime: say where the compiler knows about var writeBarrier The runtime.writeBarrier variable tries to be helpful by telling you that the compiler also knows about this variable, which you could probably guess, but doesn't say how the compiler knows about it. In fact, the compiler has a complete copy in builtin/runtime.go that needs to be kept in sync. Say so. Change-Id: Ia7fb0c591cb6f9b8230decce01008b417dfcec89 Reviewed-on: https://go-review.googlesource.com/40150 Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go index 03a58c3b27..b79617edf7 100644 --- a/src/runtime/mgc.go +++ b/src/runtime/mgc.go @@ -238,7 +238,9 @@ func setGCPercent(in int32) (out int32) { var gcphase uint32 // The compiler knows about this variable. -// If you change it, you must change the compiler too. +// If you change it, you must change builtin/runtime.go, too. +// If you change the first four bytes, you must also change the write +// barrier insertion code. var writeBarrier struct { enabled bool // compiler emits a check of this before calling write barrier pad [3]byte // compiler uses 32-bit load for "enabled" field