LEFT | RIGHT |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 // | 4 // |
5 // Escape analysis. | 5 // Escape analysis. |
6 // | 6 // |
7 // First escfunc, esc and escassign recurse over the ast of each | 7 // First escfunc, esc and escassign recurse over the ast of each |
8 // function to dig out flow(dst,src) edges between any | 8 // function to dig out flow(dst,src) edges between any |
9 // pointer-containing nodes and store them in dst->escflowsrc. For | 9 // pointer-containing nodes and store them in dst->escflowsrc. For |
10 // variables assigned to a variable in an outer scope or used as a | 10 // variables assigned to a variable in an outer scope or used as a |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 if(!n->isddd) | 257 if(!n->isddd) |
258 for(ll=n->list->next; ll; ll=ll->next) | 258 for(ll=n->list->next; ll; ll=ll->next) |
259 escassign(&theSink, ll->n); // lose track of as
sign to dereference | 259 escassign(&theSink, ll->n); // lose track of as
sign to dereference |
260 break; | 260 break; |
261 | 261 |
262 case OCALLMETH: | 262 case OCALLMETH: |
263 case OCALLFUNC: | 263 case OCALLFUNC: |
264 case OCALLINTER: | 264 case OCALLINTER: |
265 esccall(n); | 265 esccall(n); |
266 break; | 266 break; |
267 » | 267 |
268 case OCONV: | 268 case OCONV: |
269 case OCONVNOP: | 269 case OCONVNOP: |
270 case OCONVIFACE: | 270 case OCONVIFACE: |
271 escassign(n, n->left); | 271 escassign(n, n->left); |
272 break; | 272 break; |
273 | 273 |
274 case OARRAYLIT: | 274 case OARRAYLIT: |
275 if(isslice(n->type)) { | 275 if(isslice(n->type)) { |
276 n->esc = EscNone; // until proven otherwise | 276 n->esc = EscNone; // until proven otherwise |
277 noesc = list(noesc, n); | 277 noesc = list(noesc, n); |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 if(haspointers(ll->n->type)) // don't bother tagging for
scalars | 709 if(haspointers(ll->n->type)) // don't bother tagging for
scalars |
710 ll->n->paramfld->note = safetag; | 710 ll->n->paramfld->note = safetag; |
711 case EscHeap: // touched by escflood, moved to heap | 711 case EscHeap: // touched by escflood, moved to heap |
712 case EscScope: // touched by escflood, value leaves scope | 712 case EscScope: // touched by escflood, value leaves scope |
713 break; | 713 break; |
714 } | 714 } |
715 } | 715 } |
716 | 716 |
717 curfn = savefn; | 717 curfn = savefn; |
718 } | 718 } |
LEFT | RIGHT |