[LLVMdev] status: llvm-stack-switch

Toralf Niebuhr llvm at niebuhrt.de
Mon May 2 01:17:20 PDT 2011


Hello,

I wanted to ask what the current status of llvm-stack-switch[1] is.
Currently, we use uclib for implementing coroutines. The Problem with this is, that you either copy you stack (and invalidate pointers to lokals) or have many stacks on the heap (the is very memory inefficient). Having llvm doing some optimization there would really help.

A different approach (for asymmetric coroutines) that I can think of is the following:
As llvm already supports stackless architectures, it should be possible to translate a program written with coroutines into a program that implements these with state machines. This way, no system calls would be needed and everything would be with little memory usage. Obviously this could blow up the stack but it would be efficient in out use case. (Every coroutines pauses and returns to the scheduler, this scheduler then activates the next coroutine)


Toralf Niebuhr

[1]http://code.google.com/p/llvm-stack-switch/



More information about the llvm-dev mailing list