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

Put stacks in their own chunks (and cleanup) #120

Merged
merged 2 commits into from
Jul 21, 2020

Conversation

shwestrick
Copy link
Collaborator

This patch gives each stack its own chunk, similar to large arrays. Some advantages:

  • Stacks can be resized in-place (if the chunk is large enough) without copying any data.
  • When a stack needs to be resized larger than its current chunk, we can copy it to a new chunk and immediately reclaim the old chunk.
  • During GC, stack chunks can be relocated to the to-space without any copying.
  • We should no longer see the strange behavior of stacks "moving around" when they are resized. (Previously, resizing a stack allocated a new stack at the current frontier, which could be deeper than the original location of the stack.)

I did some quick tests and found that these changes are sometimes significant, e.g. in a stack-stress benchmark like fib I saw 20% improvement in space on 70 cores. Elsewhere, I don't think this change affects time or space too much.

To implement this change, I disabled stack shrinking at local GCs. Perhaps this can be re-enabled in the future, but it doesn't seem outrageously important, since the threading in MPL is so well disciplined.

@shwestrick shwestrick merged commit cc22d78 into MPLLang:master Jul 21, 2020
@shwestrick shwestrick deleted the stacks-in-own-chunks branch July 21, 2020 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant