Wed Nov 9 10:40:38 EST 2011
Serialzing thread state
I'm thinking about the shallow coroutine (SCR) approach to encoding
code that's formulated using recursion into a compact state-machine
Currently there are 2 ways to go about this:
- Implement 1-SCR using state ID allocation, jump table generation
- On top of this, implement n-SCR by control flow analysis.
Maybe the flow analysis really isn't necessary. As long as the
"recursion" is factored out as macros, there is no real issue since
this can just use linear allocation of control point IDs.
The code turns out to be quite small and straightforward. It is
amazing how such a minimal change can have such a big impact.