Jon Chesterfield via llvm-dev
2020-Mar-27 19:20 UTC
[llvm-dev] Efficient Green Thread Context-Switching
> I propose that the LLVM devs consider adding “swapstack” and “newstack” > into the LLVM project officially. >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. '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. 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. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200327/32bba9e9/attachment.html>
Joshua Thomas Wise via llvm-dev
2020-Mar-27 20:04 UTC
[llvm-dev] Efficient Green Thread Context-Switching
I could live with that. You’re right that “newstack" is probably more use-case-dependant. A “preserve_none” calling convention would be more general than swapstack, which is perhaps more preferred for LLVM. I don’t think that would be a big deal for swapstack-seekers, because I think the stack pointer swapping could be achieved using @llvm.read_register() and @llvm.write_register(). I’m glad to know other people are in support of this functionality.> On Mar 27, 2020, at 2:20 PM, Jon Chesterfield via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > I propose that the LLVM devs consider adding “swapstack” and “newstack” into the LLVM project officially. > > 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. > > '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. > > 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. > > Thanks > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200327/e2153b1b/attachment.html>