[llvm-dev] Efficient Green Thread Context-Switching

Joshua Thomas Wise via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 27 19:24:49 PDT 2020

Ahhh I see, I wasn’t looking in the right place.

I’ve spent the last few hours experimenting with the setjmp/longjmp intrinsics, and I don’t think they can achieve the desired result, for two reasons:

	1. While switching stacks, it’s necessary to pass the original stack pointer (or setjmp pointer) to the longjmp destination, hence why the research paper suggests using a new calling convention. It doesn’t look like the longjmp intrinsic allows for passing parameters.
	2. Using setjmp/longjmp requires an extra branch (depending on whether setjmp returned zero or non-zero), which should not be necessary.

> On Mar 27, 2020, at 5:01 PM, Eli Friedman <efriedma at quicinc.com> wrote:
> https://llvm.org/docs/ExceptionHandling.html <https://llvm.org/docs/ExceptionHandling.html> .
> -Eli 
> From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of Joshua Thomas Wise via llvm-dev
> Sent: Friday, March 27, 2020 1:48 PM
> To: Joerg Sonnenberger <joerg at bec.de>
> Cc: llvm-dev at lists.llvm.org
> Subject: [EXT] Re: [llvm-dev] Efficient Green Thread Context-Switching
> The first time you said “setjmp/longjmp intrinsics” I thought it was a typo, and that you were talking about the C standard library functions. If you’re actually talking about LLVM intrinsics, are they documented? I don’t see any intrinsics with those names in the language reference (https://llvm.org/docs/LangRef.html <https://llvm.org/docs/LangRef.html>).
> On Mar 27, 2020, at 3:30 PM, Joerg Sonnenberger via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
> On Fri, Mar 27, 2020 at 02:58:03PM -0500, Joshua Thomas Wise wrote:
> Sorry, I certainly didn't mean to be dishonest. I was just repeating
> one of the comparisons given by the research paper. Regardless, even
> setjmp() uses a structure of 148 bytes in size (on my machine).
> Let me repeat. Please take a look at the setjmp/longjmp intrinsics. On
> support architectures they boil down to at most 5 pointers.
> Joerg
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <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/62723baa/attachment.html>

More information about the llvm-dev mailing list