]> Cypherpunks repositories - gostls13.git/commit
runtime: make morestack less subtle
authorAustin Clements <austin@google.com>
Wed, 19 Oct 2016 22:27:39 +0000 (18:27 -0400)
committerAustin Clements <austin@google.com>
Mon, 24 Oct 2016 02:23:16 +0000 (02:23 +0000)
commitbf9c71cb434a730679f54a3a87c2e9e36ec400d0
treef90242f9a099f13b49f131e714a6d15779804478
parentcdccd6a79c5391c21c8e7316e13f8b8d1697ea63
runtime: make morestack less subtle

morestack writes the context pointer to gobuf.ctxt, but since
morestack is written in assembly (and has to be very careful with
state), it does *not* invoke the requisite write barrier for this
write. Instead, we patch this up later, in newstack, where we invoke
an explicit write barrier for ctxt.

This already requires some subtle reasoning, and it's going to get a
lot hairier with the hybrid barrier.

Fix this by simplifying the whole mechanism. Instead of writing
gobuf.ctxt in morestack, just pass the value of the context register
to newstack and let it write it to gobuf.ctxt. This is a normal Go
pointer write, so it gets the normal Go write barrier. No subtle
reasoning required.

Updates #17503.

Change-Id: Ia6bf8459bfefc6828f53682ade32c02412e4db63
Reviewed-on: https://go-review.googlesource.com/31550
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/runtime/asm_386.s
src/runtime/asm_amd64.s
src/runtime/asm_amd64p32.s
src/runtime/asm_arm.s
src/runtime/asm_arm64.s
src/runtime/asm_mips64x.s
src/runtime/asm_ppc64x.s
src/runtime/asm_s390x.s
src/runtime/stack.go