Kristján Valur Jónsson
kristjan at ccpgames.com
Mon Jul 29 19:23:29 CEST 2013
During my vacation, I have been working on a tealet-driven stackless.
This basically rips out the stack switching code from stackless, and uses the tealet engine to do it.
The tealet library is a platform independent stack switching library. It is derived from greenlets, which again derivees from stackless. Since greenlets are still in very active developments, this should provide a more future-safe approach.
tealets inherit the same stack saving system as greenlets, which include dynamic stack saving. This removes the need to "climb the stack" as stackless has done. In addition, tealets have numerous enhancements that I have made, including the capacity to create duplicable stubs. This makes stack slicing a reality with tealets.
I created a branch, 2.7-slpt, which you can see here:
The tealet project is here:
This change makes many things inside python much clearer and explicit. Stack spilling is now much more
straightforward, for example.
Also the relationship between the "main" tasklet and the "main" stack is now clarified. The "main" stack is always suspended and the main tasklet is run by a "worker tealet" always. Since tasklets can migrate between stacks (tealets) as they softswitch, this makes exiting "main" explicit, since any one of the "worker" tealets just switches back to the main one.
This currently runs the entire test suite. I have made it work for x86, I didn't adjust the project for x64 yet. Linux should work out of the box.
One thing that needs redoing, probably, is Anselm's changes to windows SEH handling. I forget exacly how he fixed it, maybe he can remind me of the problem and the solution.
Also, stackless contained a lot of platforms in its /platf folder, more than tealet currently does. Maybe we can incorporate those that work back into the tealet project, merging the platform support from stackless and greenlets into the one, super-duper, universal switching solution from the tealet project.
This is still experimental. The code is originally from Armin Rigo, I have heaviliy modified it, and I am unsure about its licensing status. But it is there for you to peruse and comment on.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Stackless