Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Don't switch to the C stack when there is room on the Rust stack #4480
If there is sufficient room on the Rust stack to run a particular foreign function then we don't need to switch stacks. Each scheduler has a native stack size so we just need the Rust segment to be larger than that (and they can be much larger).
At that point we can annotate specific functions in core with their required stack size. It could significantly reduce the number of stack switches we do.
referenced this issue
Jan 14, 2013
I remember thinking about this case a bit during my starter project last summer. This is definitely a feasible optimization, but you have to be careful(?) in the case where C calls back to Rust (what was once charmingly called "crust" functions).