<div dir="ltr"><div dir="ltr"></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I propose that the LLVM devs consider adding “swapstack” and “newstack” into the LLVM project officially.<br></blockquote><div><br></div><div>Thanks for the reference. I was going to suggest the 'preserve_none' calling convention, applied to asm which does the stack pointer swapping, would be equivalent to swapstack. However that calling convention doesn't appear to exist - it would be one where the caller is required to save all live values to the stack before jumping.<br><br></div><div>'preserve_none' may be a useful calling convention independent of green threads. Functions which will always use all the available registers benefit from not having to save/restore any of them, if the caller knew to preserve any live values. A green thread context switch is roughly a call that preserved nothing.<br><br></div><div>Newstack I'm not as sure about. Green thread libraries are likely to put a lot of effort into how stacks are sized, allocated, reused. That seems better as a runtime call.<br></div><div><br></div><div>Thanks<br><br></div></div></div>