|
From: miguel s. <mig...@gm...> - 2008-08-28 11:21:36
|
Lars Hellström wrote: > Ultimately, we may always fall back to what is written on the tape of > our Turing machine. :-) More practically, also the NRE has to separate > the per-coroutine state from the general interpreter state, and IMHO > that is where you might encounter nontrivial issues. The rest should > just be the hard work of serializing a well-defined data structure. Not so, NRE does not separate the per-coroutine execution environment when [yield] is called. Those execEnvs are born separate, that's the main job of the [coroutine] command. The generated command for the coroutine just swaps the coroutine's execEnv into the interp (swapping a couple of pointers), registers a callback to swap back the original exexcEnv on return, and runs. Later [yield] saves the relevant pointers into a CoroutineData struct and returns, letting the callback restore the caller's environment. |