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

Question: Boxing on stack for function calls #8735

Closed
edward-a opened this Issue Dec 27, 2016 · 2 comments

Comments

Projects
None yet
4 participants
@edward-a

edward-a commented Dec 27, 2016

I am aware of similar proposal #1784. But what i am asking is a bit different. I am wondering if it's a good idea to allocate boxed value on stack in case boxing is done for a function argument. And move that box to heap later only if that box gets referenced from an object from heap. I think it would be a significant optimization for function calls with object-type arguments and the ones with variable number of arguments. I believe implementation should be straight forward without "thinking" on compiler's side, which is boxed values are pushed out of stack upon function return, and moved to heap when referenced by an object from heap.

@jkotas jkotas added the question label Dec 28, 2016

@mikedn

This comment has been minimized.

Show comment
Hide comment
@mikedn

mikedn Dec 28, 2016

Contributor

I believe implementation should be straight forward without "thinking" on compiler's side, which is boxed values are pushed out of stack upon function return, and moved to heap when referenced by an object from heap.

That "move to heap when referenced by an object from heap" involves compiler thinking. And this type of thinking is actually more complicated than traditional escape analysis as "move to heap" needs to happen at most once for a given object.

Contributor

mikedn commented Dec 28, 2016

I believe implementation should be straight forward without "thinking" on compiler's side, which is boxed values are pushed out of stack upon function return, and moved to heap when referenced by an object from heap.

That "move to heap when referenced by an object from heap" involves compiler thinking. And this type of thinking is actually more complicated than traditional escape analysis as "move to heap" needs to happen at most once for a given object.

@danmosemsft

This comment has been minimized.

Show comment
Hide comment
@danmosemsft

danmosemsft Apr 8, 2017

Member

I'm going to close this as it seems discussion finished.

Member

danmosemsft commented Apr 8, 2017

I'm going to close this as it seems discussion finished.

@danmosemsft danmosemsft closed this Apr 8, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment