Descriptionruntime: refactor and fix stack management code
There are at least 3 bugs:
1. g->stacksize accounting is broken during copystack/shrinkstack
2. stktop->free is not properly maintained during copystack/shrinkstack
3. stktop->free logic is broken:
we can have stktop->free==FixedStack,
and we will free it into stack cache,
but it actually comes from heap as the result of non-copying segment shrink
This shows as at least spurious races on race builders (maybe something else as well I don't know).
The idea behind the refactoring is to consolidate stacksize and
segment origin logic in stackalloc/stackfree.
Fixes issue 7490.
Patch Set 1 #Patch Set 2 : diff -r 72b4b258b09b https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 3 : diff -r 72b4b258b09b https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 4 : diff -r 72b4b258b09b https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 5 : diff -r 72b4b258b09b https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 6 : diff -r 72b4b258b09b https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 7 : diff -r 2bf62ae2b687 https://dvyukov%40google.com@code.google.com/p/go/ #
MessagesTotal messages: 5
|