]> Cypherpunks repositories - gostls13.git/commit
[dev.garbage] cmd/gc, runtime: implement write barriers in terms of writebarrierptr
authorRuss Cox <rsc@golang.org>
Thu, 30 Oct 2014 14:16:03 +0000 (10:16 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 30 Oct 2014 14:16:03 +0000 (10:16 -0400)
commitb035e973158847801ce6193461159a3b9b66f4e5
tree3fde2115b1f395af6d1d6dd611280f61f0ad3b6e
parentd6f4e5020b0dc4014a75782a72d39c99657bd659
[dev.garbage] cmd/gc, runtime: implement write barriers in terms of writebarrierptr

This CL implements the many multiword write barriers by calling
writebarrierptr, so that only writebarrierptr needs the actual barrier.
In lieu of an actual barrier, writebarrierptr checks that the value
being copied is not a small non-zero integer. This is enough to
shake out bugs where the barrier is being called when it should not
(for non-pointer values). It also found a few tests in sync/atomic
that were being too clever.

This CL adds a write barrier for the memory moved during the
builtin copy function, which I forgot when inserting barriers for Go 1.4.

This CL re-enables some write barriers that were disabled for Go 1.4.
Those were disabled because it is possible to change the generated
code so that they are unnecessary most of the time, but we have not
changed the generated code yet. For safety they must be enabled.

None of this is terribly efficient. We are aiming for correct first.

LGTM=rlh
R=rlh
CC=golang-codereviews
https://golang.org/cl/168770043
12 files changed:
src/cmd/api/goapi.go
src/cmd/gc/builtin.c
src/cmd/gc/runtime.go
src/cmd/gc/typecheck.c
src/cmd/gc/walk.c
src/run.bash
src/runtime/malloc.go
src/runtime/mgc0.go
src/runtime/mgc0.h
src/runtime/wbfat.go [new file with mode: 0644]
src/runtime/wbfat_gen.go [new file with mode: 0644]
src/sync/atomic/atomic_test.go