summaryrefslogtreecommitdiff
path: root/test/escape5.go
Commit message (Collapse)AuthorAgeFilesLines
* cmd/gc: distinguish unnamed vs blank-named return variables betterRuss Cox2014-02-131-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Before, an unnamed return value turned into an ONAME node n with n->sym named ~anon%d, and n->orig == n. A blank-named return value turned into an ONAME node n with n->sym named ~anon%d but n->orig == the original blank n. Code generation and printing uses n->orig, so that this node formatted as _. But some code does not use n->orig. In particular the liveness code does not know about the n->orig convention and so mishandles blank identifiers. It is possible to fix but seemed better to avoid the confusion entirely. Now the first kind of node is named ~r%d and the second ~b%d; both have n->orig == n, so that it doesn't matter whether code uses n or n->orig. After this change the ->orig field is only used for other kinds of expressions, not for ONAME nodes. This requires distinguishing ~b from ~r names in a few places that care. It fixes a liveness analysis bug without actually changing the liveness code. TBR=ken2 CC=golang-codereviews https://codereview.appspot.com/63630043
* cmd/gc: move large stack variables to heapRuss Cox2013-08-081-0/+7
| | | | | | | | | | | | | | | | | | | Individual variables bigger than 10 MB are now moved to the heap, as if they had escaped on their own. This avoids ridiculous stacks for programs that do things like x := [1<<30]byte{} ... use x ... If 10 MB is too small, we can raise the limit. Fixes issue 6077. R=ken2 CC=golang-dev https://codereview.appspot.com/12650045
* cmd/gc: fix escape analysis bugRuss Cox2012-11-071-0/+25
| | | | | | | | | | | | | The code assumed that the only choices were EscNone, EscScope, and EscHeap, so that it makes sense to set EscScope only if the current setting is EscNone. Now that we have the many variants of EscReturn, this logic is false, and it was causing important EscScopes to be ignored in favor of EscReturn. Fixes issue 4360. R=ken2 CC=golang-dev, lvd http://codereview.appspot.com/6816103
* cmd/gc: escape analysis to track flow of in to out parameters.Luuk van Dijk2012-10-291-0/+119
includes step 0: synthesize outparams, from 6600044 includes step 1,2: give outparams loopdepth 0 and verify unchanged results generate esc:$mask tags, but still tie to sink if a param has mask != 0 from 6610054 adds final steps: - have esccall generate n->escretval, a list of nodes the function results flow to - use these in esccall and ORETURN/OAS2FUNC/and f(g()) - only tie parameters to sink if tag is absent, otherwise according to mask, tie them to escretval R=rsc, bradfitz CC=dave, gobot, golang-dev, iant, rsc http://codereview.appspot.com/6741044