Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: investigate closure capture issue #18300

bradfitz opened this Issue Dec 13, 2016 · 4 comments


None yet
8 participants
Copy link

bradfitz commented Dec 13, 2016

This change reduces allocations:

Why? Can the compiler be changed instead?

(See test file in same CL for details)

/cc @randall77 @mdempsky @aclements

@bradfitz bradfitz added this to the Go1.9Maybe milestone Dec 13, 2016


This comment has been minimized.

Copy link

randall77 commented Dec 13, 2016

I suspect this would require a finer-grained escape analysis. Contrast these:

  f := new(int)
  f = new(int)
  x := new(int)
  y := new(int)

There's only one declaration in the first example. Escape analysis works on declarations. So f has to be declared as escaping. In contrast, the second example has 2 declarations so x can be seen to not escape.

I guess escape analysis would have to be augmented to split declarations into unconnected subsets somehow and then treat each subset independently.



This comment has been minimized.

Copy link

mrjrieke commented Dec 16, 2016



This comment has been minimized.

Copy link

bcmills commented Apr 28, 2017

Escape analysis works on declarations.

Does that change with SSA? I would expect escape analysis to apply to SSA variables/slots/whatever rather than source variables.


This comment has been minimized.

Copy link

dr2chase commented May 2, 2017

No change here, sorry.

@bradfitz bradfitz modified the milestones: Go1.9Maybe, Go1.10 Jul 20, 2017

@cherrymui cherrymui modified the milestones: Go1.10, Go1.11 Nov 29, 2017

@gopherbot gopherbot modified the milestones: Go1.11, Unplanned May 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.