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

Implement escape analysis and use the results to turn heap allocations into stack allocations #358

Open
pschachte opened this issue Sep 27, 2022 · 3 comments
Labels
enhancement New feature or request performance Issues related to performance of generated code research project

Comments

@pschachte
Copy link
Owner

pschachte commented Sep 27, 2022

The benefit is that stack allocations are very cheap, and reclaimed for free when the procedure exits. The cost is greater stack usage.

@pschachte pschachte added enhancement New feature or request research project performance Issues related to performance of generated code labels Sep 27, 2022
@jimbxb
Copy link
Collaborator

jimbxb commented Sep 27, 2022

Greater heap usage?

@pschachte
Copy link
Owner Author

Oops. Fixed.

@pschachte
Copy link
Owner Author

It's worth reading Oxidizing OCaml: Locality for a nice discussion of a similar idea in the context of OCaml. Their approach requires locality (freedom from escape) to be declared, whereas this request is for locality to be (conservatively) inferred, which makes it easier to use (with 0 effort), but not certain for the programmer. A possible improvement would be to allow the programmer to declare that something should be allocated locally, and have the compiler warn or error if it won't be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance Issues related to performance of generated code research project
Projects
None yet
Development

No branches or pull requests

2 participants