This patch changes libgo to ignore stack sizes when deciding when to run the next GC. This patch restores an old patch, https://golang.org/cl/6081043, that was accidentally lost when updating to a new version of libgo in https://golang.org/cl/22440043. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Commited to mainline, GCC 5 branch, and GCC 4.9 branch.
Ian
Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 227777) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -ae60deadd72b3b29df98cee61deed68f251f0122 +23392287e9a26956977987fe95f337c5be4d6417 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: libgo/runtime/mgc0.c =================================================================== --- libgo/runtime/mgc0.c (revision 227696) +++ libgo/runtime/mgc0.c (working copy) @@ -2280,7 +2280,7 @@ gc(struct gc_args *args) heap0 = mstats.next_gc*100/(gcpercent+100); // conservatively set next_gc to high value assuming that everything is live // concurrent/lazy sweep will reduce this number while discovering new garbage - mstats.next_gc = mstats.heap_alloc+mstats.heap_alloc*gcpercent/100; + mstats.next_gc = mstats.heap_alloc+(mstats.heap_alloc-runtime_stacks_sys)*gcpercent/100; t4 = runtime_nanotime(); mstats.last_gc = runtime_unixnanotime(); // must be Unix time to make sense to user