Charllls Alquarra
2011-May-04 21:40 UTC
[LLVMdev] exception cleanup examples (was: status: llvm-stack-switch)
Hi,>Am 02.05.2011 um 11:05 schrieb Anton Korobeynikov: > >> Hello Toralf, >> >>> I wanted to ask what the current status of llvm-stack-switch[1] is. >> Given that this project never appeared in this mailing list - have you >> tried to ask its author? > >It is on the mailing list. This is how I found this project. >http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-April/030787.html > >But I couldn't find any updates after this thread. > >Toralf NiebuhrI am trying to implement something like this using boost.context library; in my case, the scope of usage is more limited, in the sense that i don't want to spawn coroutines from the language, but actually just embed the compiled code inside coroutines/user space threads/or how we want to call it. I have some trouble figuring out the best way to do the cleanups for stack-allocated non-POD objects, which have to happen both at the exit of each function (easy) but also if i decide for some reason to kill the coroutine (for example, in case of a runtime error). I know there is exception handling primitives on LLVM (http://llvm.org/docs/ExceptionHandling.html) that could help me do this but what i wanted is to look at some examples, the Kaleidoscope example doesn't do exception handling, and it seems that there is still some strong development happening on the EH primitives: http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-December/036769.html if someone knows some publicly available examples that make basic usage of llvm exception handling primitives it would be great. I don't need error handling per se, just details on how to setup the cleanup code generation @Toralf, in your case, if i would be after full blown support of coroutines, i would try by generating calls to the boost.context (or some other coroutine library) constructors and yield methods from the IR, it could certainly have some issues, but i don't see any reason it wouldn't work