1
0
mirror of https://github.com/golang/go synced 2024-11-20 01:54:41 -07:00
go/src
Austin Clements e9079a69f3 runtime: buffered write barrier implementation
This implements runtime support for buffered write barriers on amd64.
The buffered write barrier has a fast path that simply enqueues
pointers in a per-P buffer. Unlike the current write barrier, this
fast path is *not* a normal Go call and does not require the compiler
to spill general-purpose registers or put arguments on the stack. When
the buffer fills up, the write barrier takes the slow path, which
spills all general purpose registers and flushes the buffer. We don't
allow safe-points or stack splits while this frame is active, so it
doesn't matter that we have no type information for the spilled
registers in this frame.

One minor complication is cgocheck=2 mode, which uses the write
barrier to detect Go pointers being written to non-Go memory. We
obviously can't buffer this, so instead we set the buffer to its
minimum size, forcing the write barrier into the slow path on every
call. For this specific case, we pass additional information as
arguments to the flush function. This also requires enabling the cgo
write barrier slightly later during runtime initialization, after Ps
(and the per-P write barrier buffers) have been initialized.

The code in this CL is not yet active. The next CL will modify the
compiler to generate calls to the new write barrier.

This reduces the average cost of the write barrier by roughly a factor
of 4, which will pay for the cost of having it enabled more of the
time after we make the GC pacer less aggressive. (Benchmarks will be
in the next CL.)

Updates #14951.
Updates #22460.

Change-Id: I396b5b0e2c5e5c4acfd761a3235fd15abadc6cb1
Reviewed-on: https://go-review.googlesource.com/73711
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2017-10-30 18:12:44 +00:00
..
archive archive/zip: restrict UTF-8 detection for comment and name fields 2017-10-25 22:16:46 +00:00
bufio Revert "bufio: make Reader.Peek invalidate Unreads" 2017-07-06 03:06:44 +00:00
builtin
bytes bytes: add examples of Equal and IndexByte 2017-10-16 03:34:28 +00:00
cmd runtime: buffered write barrier implementation 2017-10-30 18:12:44 +00:00
compress compress/bzip2: fix checksum mismatch on empty reads 2017-09-25 23:05:58 +00:00
container container/ring: add examples for various Ring functions 2017-10-25 13:34:06 +00:00
context context: fix references to "d" in WithDeadline docs 2017-09-21 03:00:51 +00:00
crypto crypto/{ecdsa,rsa}: rename argument to PrivateKey.Sign. 2017-10-29 19:45:11 +00:00
database/sql database/sql: scan into *time.Time without reflection 2017-10-25 19:29:16 +00:00
debug debug/dwarf: clarify StructField.ByteSize doc 2017-10-18 21:45:30 +00:00
encoding encoding/csv: forbid certain Comma and Comment runes 2017-10-25 01:43:46 +00:00
errors
expvar expvar: make (*Map).Init clear existing keys 2017-09-11 21:31:51 +00:00
flag flag: simplify switch-case in isZeroValue 2017-10-17 20:23:14 +00:00
fmt fmt: clarify wording of * flag 2017-10-15 06:03:34 +00:00
go go/types: improved documentation for WriteExpr and ExprString 2017-10-23 18:10:06 +00:00
hash all: gofmt 2017-06-21 03:14:30 +00:00
html all: revert "all: prefer strings.IndexByte over strings.Index" 2017-10-05 23:19:10 +00:00
image image/draw, image/color: optimize hot path sqDiff function 2017-10-27 05:47:09 +00:00
index/suffixarray
internal os: add deadline methods for File type 2017-10-25 18:27:06 +00:00
io io: flatten MultiWriter writers 2017-10-25 21:48:50 +00:00
log log: Remove unnecessary else 2017-10-25 05:02:37 +00:00
math math/big: add (*Float).Sqrt 2017-10-26 17:29:27 +00:00
mime mime/multipart: permit empty file name 2017-10-24 20:21:03 +00:00
net net/http: fix minor leak in Header.WriteSubset 2017-10-27 19:33:14 +00:00
os os: add deadline methods for File type 2017-10-25 18:27:06 +00:00
path all: revert "all: prefer strings.LastIndexByte over strings.LastIndex" 2017-10-05 23:19:42 +00:00
plugin cmd/link, plugin: always encode path 2017-10-26 15:08:37 +00:00
reflect reflect: allow Copy to a byte array or byte slice from a string 2017-10-13 02:35:56 +00:00
regexp all: revert "all: prefer strings.IndexByte over strings.Index" 2017-10-05 23:19:10 +00:00
runtime runtime: buffered write barrier implementation 2017-10-30 18:12:44 +00:00
sort sort: split post-Go1.4 code into its own file 2017-10-27 16:01:43 +00:00
strconv unicode: update to Unicode 10.0.0 2017-10-24 12:42:35 +00:00
strings strings: improve readability of IndexAny and LastIndexAny functions. 2017-09-25 18:23:11 +00:00
sync sync/atomic: add memory barriers to Load/StoreInt32 on darwin/arm 2017-10-02 09:57:23 +00:00
syscall syscall: document Time{spec,val} methods 2017-10-27 07:18:47 +00:00
testing testing/iotest: fix NewReadLogger documentation typo 2017-10-19 15:59:21 +00:00
text text/template: add break, continue actions in ranges 2017-10-17 02:06:15 +00:00
time all: revert "all: prefer strings.LastIndexByte over strings.LastIndex" 2017-10-05 23:19:42 +00:00
unicode unicode: update to Unicode 10.0.0 2017-10-24 12:42:35 +00:00
unsafe all: remove some double spaces from comments 2017-08-26 15:09:09 +00:00
vendor/golang_org/x vendor/golang_org/x/net/route: refresh from upstream 2017-10-26 20:20:52 +00:00
all.bash Revert "build: fail nicely if somebody runs all.bash from a binary tarball package" 2017-04-28 21:19:32 +00:00
all.bat all.bat,make.bat,run.bat: make these work even when directory has space in it 2013-03-25 12:13:34 +11:00
all.rc build: do not set GOBIN on Plan 9 2013-02-26 09:25:46 -08:00
androidtest.bash androidtest.bash: use go list to get pkg dir 2016-08-29 15:24:39 +00:00
bootstrap.bash
buildall.bash src/*.bash: use tabs consistently 2017-03-09 21:30:31 +00:00
clean.bash build: clean current tree in clean.bash 2015-08-05 19:36:15 +00:00
clean.bat build: fix clean scripts 2015-06-18 16:13:13 +00:00
clean.rc build: fix clean scripts 2015-06-18 16:13:13 +00:00
cmp.bash
iostest.bash
make.bash build: move final steps of make.bash, make.bat, make.rc into cmd/dist 2017-10-25 01:13:01 +00:00
make.bat build: move final steps of make.bash, make.bat, make.rc into cmd/dist 2017-10-25 01:13:01 +00:00
Make.dist cmd/dist: make 'make' quieter for developers 2012-02-08 15:26:47 -05:00
make.rc build: move final steps of make.bash, make.bat, make.rc into cmd/dist 2017-10-25 01:13:01 +00:00
naclmake.bash src: split nacltest.bash into naclmake.bash and keep nacltest.bash 2016-04-12 02:03:34 +00:00
nacltest.bash
race.bash
race.bat
run.bash *.bash: always use the same string equality operator 2017-03-14 21:46:31 +00:00
run.bat build: unset GOBIN during build 2016-05-19 18:40:53 +00:00
run.rc build: unset GOBIN during build 2016-05-19 18:40:53 +00:00