]> Cypherpunks repositories - gostls13.git/commit
runtime: steal space for stack barrier tracking from stack
authorAustin Clements <austin@google.com>
Wed, 20 May 2015 20:16:04 +0000 (16:16 -0400)
committerAustin Clements <austin@google.com>
Tue, 2 Jun 2015 19:57:57 +0000 (19:57 +0000)
commit3f6e69aca585ceaf82595170e5aea5b25a9d29ec
tree85922a987e5800d2d6baf9bd5c1f118ec38bca33
parente610c25df05246efa807e4724a9b2b0d00847604
runtime: steal space for stack barrier tracking from stack

The stack barrier code will need a bookkeeping structure to keep track
of the overwritten return PCs. This commit introduces and allocates
this structure, but does not yet use the structure.

We don't want to allocate space for this structure during garbage
collection, so this commit allocates it along with the allocation of
the corresponding stack. However, we can't do a regular allocation in
newstack because mallocgc may itself grow the stack (which would lead
to a recursive allocation). Hence, this commit makes the bookkeeping
structure part of the stack allocation itself by stealing the
necessary space from the top of the stack allocation. Since the size
of this bookkeeping structure is logarithmic in the size of the stack,
this has minimal impact on stack behavior.

Change-Id: Ia14408be06aafa9ca4867f4e70bddb3fe0e96665
Reviewed-on: https://go-review.googlesource.com/10313
Reviewed-by: Russ Cox <rsc@golang.org>
src/runtime/mgc.go
src/runtime/mgcmark.go
src/runtime/proc1.go
src/runtime/runtime2.go
src/runtime/stack1.go