[Stackless] Re: [Psyco-devel] Stackless Python and Simulation

Christian Tismer tismer at tismer.com
Sat Jul 12 23:40:00 CEST 2003


Armin Rigo wrote:

> Hello Simon,
> 
> On Thu, Jul 10, 2003 at 05:40:12PM -0700, Simon Frost wrote:
> 
>>I have a couple of problems with the code though related to Psyco:
> 
> 
> The first note is that Psyco is not particularly tested with Stackless Python.  
> Although I think it should probably work, at least to some extent. Psyco may
> not like Stackless moving the stack away, which I guess would result in a
> violation whenever you use sys._getframe(). More generally, the problem is
> that both Stackless and Psyco change the execution model of Python in some
> subtle and not a priori compatible way.
> 
> I guess that I could work out a Stackless-friendly version of Psyco if there 
> is enough demand.

Ok, one small addition from my side:
Stackless 3.0 avoids the stack moving trick as much as it can.
But this is not totally complete, yet.
The stackless.run() code always introduces stack moves now.
The only way to avoid this currently is to avoid
stackless.run() at all. :-(
Yes I will change that.
Although you probably create all your tasklets in a way that
allows soft switching, you might still create a hard switch,
by running your file through execfile() or something.
You can either avoid this, or you can make a new tasklet from your
main code, by tasklet().become().
The attached code from test_pickle.py does this, see the line
which says "temporary hack".
This will vanish, pretty soon.

I think, one quick way to make Stackless Psyco compatible would
be to ask Psyco to not optimize hard-switched tasklets at all.

I will for sure talk with Armin, how this should work in
the future. Thanks for pointing this problem out.

ciao - chris
-- 
Christian Tismer             :^)   <mailto:tismer at tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test_pickle.py
URL: <http://www.stackless.com/pipermail/stackless/attachments/20030712/53139565/attachment.asc>


More information about the Stackless mailing list