[Stackless] Coming very near to SLP 3.0

Christian Tismer tismer at tismer.com
Thu Apr 10 06:03:33 CEST 2003

Hi friends,

during the last weeks, I have been beavering away
on finalizing Stackless. There have been very many
check-ins, and hundreds of hours of debugging.
Today, I thought I were done so far, but there are still some
tiny bugs left.
The problem is soft-switching, which in fact is almost twice as fast
as SLP 2.0's hard switching. Hard-switching is quite fast already,
and even faster than in 2.0, since SLP 3.0 alpha already tries to
avoid almost all interpreter recursions, which saves C stack size
and therefore time to allocate and move stack data.
Anyway, SLP 3.0 tries to implement soft switching between tasklets,
that is, whenever tasklets are running in a context that does not
need to save a C stack, it will be avoided (meaning: nesting_level
is 0 (never started) or 1 (running toplevel).
I managed to get this to work in almost all cases, but there are still
a few issues left. Please see the check-in message from this night:

After lots and lots of debugging, tasktest.py, temptest.py
and schedtest.py seem to work under all configurations, now.
Introduced a new config function:
enable_softswitch controls whether soft-switching is used or not.
This allows for soft-switch debugging without recompilation.
ALso, with soft-switching, tasklets are created without default
C stacks attached. Disabling it re-enables this, and stacks
can be meaured.

The remaining problem is taskspeed.py, astonishingly!
When run as intended (enable_softswitch off when measuring stack sizes),
everything is fine. When not, the test_cframe tasklet introduces a fault.
I guess there is a wrong assumption about soft-switchability, which does
not hold for the cframe tasklet. Will figure this out and fix it
later today.
There is also one refcount bug left:
Py_None increases refcount in schedtest.py by one for each run.
It does not with hard switching.
There is probably an oversight with overwriting f_temp_val.

By default, stackless.enable_softswitch is set to zero, until this
functionality passes all tests.
I hope to get this to a final state during this day.

cheers -- 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/

Stackless mailing list
Stackless at www.tismer.com

More information about the Stackless mailing list