why a switch statement for coroutine?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

why a switch statement for coroutine?

Alex Denisov via cfe-dev
The code generation for coroutine resume is pretty much the same as a switch statement; for a few suspend points it generates if(state==x) goto label else..., and for many suspend points it uses a jump table.


I would have guessed that it would save the resume state as a call address directly, rather than save the state as an index into a jump table. What advantage does the switch approach have? Why not just save a new resume address in the frame prefix after each resume?

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev