1
0
mirror of https://github.com/golang/go synced 2024-11-08 19:06:26 -07:00
go/src/runtime/wbfat.go
Russ Cox b035e97315 [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
2014-10-30 10:16:03 -04:00

191 lines
4.4 KiB
Go

// generated by wbfat_gen.go; use go generate
package runtime
//go:nosplit
func writebarrierfat01(dst *[2]uintptr, _ *byte, src [2]uintptr) {
dst[0] = src[0]
writebarrierptr(&dst[1], src[1])
}
//go:nosplit
func writebarrierfat10(dst *[2]uintptr, _ *byte, src [2]uintptr) {
writebarrierptr(&dst[0], src[0])
dst[1] = src[1]
}
//go:nosplit
func writebarrierfat11(dst *[2]uintptr, _ *byte, src [2]uintptr) {
writebarrierptr(&dst[0], src[0])
writebarrierptr(&dst[1], src[1])
}
//go:nosplit
func writebarrierfat001(dst *[3]uintptr, _ *byte, src [3]uintptr) {
dst[0] = src[0]
dst[1] = src[1]
writebarrierptr(&dst[2], src[2])
}
//go:nosplit
func writebarrierfat010(dst *[3]uintptr, _ *byte, src [3]uintptr) {
dst[0] = src[0]
writebarrierptr(&dst[1], src[1])
dst[2] = src[2]
}
//go:nosplit
func writebarrierfat011(dst *[3]uintptr, _ *byte, src [3]uintptr) {
dst[0] = src[0]
writebarrierptr(&dst[1], src[1])
writebarrierptr(&dst[2], src[2])
}
//go:nosplit
func writebarrierfat100(dst *[3]uintptr, _ *byte, src [3]uintptr) {
writebarrierptr(&dst[0], src[0])
dst[1] = src[1]
dst[2] = src[2]
}
//go:nosplit
func writebarrierfat101(dst *[3]uintptr, _ *byte, src [3]uintptr) {
writebarrierptr(&dst[0], src[0])
dst[1] = src[1]
writebarrierptr(&dst[2], src[2])
}
//go:nosplit
func writebarrierfat110(dst *[3]uintptr, _ *byte, src [3]uintptr) {
writebarrierptr(&dst[0], src[0])
writebarrierptr(&dst[1], src[1])
dst[2] = src[2]
}
//go:nosplit
func writebarrierfat111(dst *[3]uintptr, _ *byte, src [3]uintptr) {
writebarrierptr(&dst[0], src[0])
writebarrierptr(&dst[1], src[1])
writebarrierptr(&dst[2], src[2])
}
//go:nosplit
func writebarrierfat0001(dst *[4]uintptr, _ *byte, src [4]uintptr) {
dst[0] = src[0]
dst[1] = src[1]
dst[2] = src[2]
writebarrierptr(&dst[3], src[3])
}
//go:nosplit
func writebarrierfat0010(dst *[4]uintptr, _ *byte, src [4]uintptr) {
dst[0] = src[0]
dst[1] = src[1]
writebarrierptr(&dst[2], src[2])
dst[3] = src[3]
}
//go:nosplit
func writebarrierfat0011(dst *[4]uintptr, _ *byte, src [4]uintptr) {
dst[0] = src[0]
dst[1] = src[1]
writebarrierptr(&dst[2], src[2])
writebarrierptr(&dst[3], src[3])
}
//go:nosplit
func writebarrierfat0100(dst *[4]uintptr, _ *byte, src [4]uintptr) {
dst[0] = src[0]
writebarrierptr(&dst[1], src[1])
dst[2] = src[2]
dst[3] = src[3]
}
//go:nosplit
func writebarrierfat0101(dst *[4]uintptr, _ *byte, src [4]uintptr) {
dst[0] = src[0]
writebarrierptr(&dst[1], src[1])
dst[2] = src[2]
writebarrierptr(&dst[3], src[3])
}
//go:nosplit
func writebarrierfat0110(dst *[4]uintptr, _ *byte, src [4]uintptr) {
dst[0] = src[0]
writebarrierptr(&dst[1], src[1])
writebarrierptr(&dst[2], src[2])
dst[3] = src[3]
}
//go:nosplit
func writebarrierfat0111(dst *[4]uintptr, _ *byte, src [4]uintptr) {
dst[0] = src[0]
writebarrierptr(&dst[1], src[1])
writebarrierptr(&dst[2], src[2])
writebarrierptr(&dst[3], src[3])
}
//go:nosplit
func writebarrierfat1000(dst *[4]uintptr, _ *byte, src [4]uintptr) {
writebarrierptr(&dst[0], src[0])
dst[1] = src[1]
dst[2] = src[2]
dst[3] = src[3]
}
//go:nosplit
func writebarrierfat1001(dst *[4]uintptr, _ *byte, src [4]uintptr) {
writebarrierptr(&dst[0], src[0])
dst[1] = src[1]
dst[2] = src[2]
writebarrierptr(&dst[3], src[3])
}
//go:nosplit
func writebarrierfat1010(dst *[4]uintptr, _ *byte, src [4]uintptr) {
writebarrierptr(&dst[0], src[0])
dst[1] = src[1]
writebarrierptr(&dst[2], src[2])
dst[3] = src[3]
}
//go:nosplit
func writebarrierfat1011(dst *[4]uintptr, _ *byte, src [4]uintptr) {
writebarrierptr(&dst[0], src[0])
dst[1] = src[1]
writebarrierptr(&dst[2], src[2])
writebarrierptr(&dst[3], src[3])
}
//go:nosplit
func writebarrierfat1100(dst *[4]uintptr, _ *byte, src [4]uintptr) {
writebarrierptr(&dst[0], src[0])
writebarrierptr(&dst[1], src[1])
dst[2] = src[2]
dst[3] = src[3]
}
//go:nosplit
func writebarrierfat1101(dst *[4]uintptr, _ *byte, src [4]uintptr) {
writebarrierptr(&dst[0], src[0])
writebarrierptr(&dst[1], src[1])
dst[2] = src[2]
writebarrierptr(&dst[3], src[3])
}
//go:nosplit
func writebarrierfat1110(dst *[4]uintptr, _ *byte, src [4]uintptr) {
writebarrierptr(&dst[0], src[0])
writebarrierptr(&dst[1], src[1])
writebarrierptr(&dst[2], src[2])
dst[3] = src[3]
}
//go:nosplit
func writebarrierfat1111(dst *[4]uintptr, _ *byte, src [4]uintptr) {
writebarrierptr(&dst[0], src[0])
writebarrierptr(&dst[1], src[1])
writebarrierptr(&dst[2], src[2])
writebarrierptr(&dst[3], src[3])
}