-
Notifications
You must be signed in to change notification settings - Fork 2
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
Don't Store Memory-Spilled Values on Stack & Steady State Memory Spilling #35
Comments
Changes required:
This function should return the tuple
let spill_code = spill
.map(|x| copy_top_stack_value_to_memory(x, result_type.size_of()))
.unwrap_or_default();
let mut spill_code =
copy_value_to_memory(memory_spill_address, data_type.size_of(), top_of_value); The two last expressions need to be changed to code that moves the top stack value to memory instead of copying it as we do now. Places where memory spilling is already handled this way (included for better overview of codebase, code doesn't need to change here):
|
To be honest, I'm not a 100 % sure this change is worth the complexity, at least not without considering a change to the |
Let's start with seeing if we can move spilled values to memory instead of copying them. The only complication here is how to handle function arguments that must be spilled. The caller must copy the correct values to memory and not push them to stack. How does the called know which arguments to store to memory? The caller would have to compile the function first, then read out which function arguments that should be passed via memory. I see two difficulties with this approach:
|
We can only access values on the stack if they are confined to the top 16 words. That is how we determine if a value should be spilled to memory or not. But once it's spilled to memory it no longer needs to live on the stack and can thus give room to other values that might become accessible after a value above has been spilled. We currently leave the memory-spilled value on the stack which is sub-optimal.
To find the minimal set of values that need to be spilled to memory, we should complete the following tasks:
FunctionState
fieldspill_required
no longer changes (is in a steady state).The text was updated successfully, but these errors were encountered: