-
Notifications
You must be signed in to change notification settings - Fork 30
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
Allocate region variables as "local variables" on previous stack #642
Conversation
case Call(_, Ccc(), _, nonglobal, _) => | ||
C.abort(s"cannot call non-global operand: $nonglobal") | ||
C.abort(s"cannot call non-global operand: $nonglobal") // why not? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@phischu maybe you could discuss this in the meeting briefly?
@@ -385,7 +349,7 @@ object Transformer { | |||
emit(callLabel(returnAddress, values.map(transform))) | |||
RetVoid() | |||
|
|||
case machine.NewStack(variable, prompt, frame, rest) => | |||
case machine.NewStack(variable, prompt, frame, isRegion, rest) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this flag go away when we allocate regions directly on the stack?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we need to know whether we are returning from a region.
The last commit depends on #651 |
This enables automatic growing of LLVM's stack once the end is reached (or memory larger than the remaining space is allocated). We can now have much smaller stack sizes than before. For now, I've set the previous 256M stacks to 1KB (which, after initial tests, seems fine). Due to some code repetition I wanted to merge the growing logic of regions with this. I've reverted my attempts since #642 removes the duplicated code anyway. --------- Co-authored-by: Jonathan Immanuel Brachthäuser <jonathan@b-studios.de> Co-authored-by: Philipp Schuster <philipp.schuster@uni-tuebingen.de>
and call special function when underflowing a region
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, so much code was deleted.
@phischu I hate how this turned out.
When allocating into a region, we cannot know the answer type of that region. This makes it impossible to push a regular return address.
As a workaround, variables are allocated with a special return function, that removes the region from the stack. When underflowing a region, we first call this special function, and then return regularly.
Also, this breaks globals, as the first stack has no previous stack.