[Python-Dev] Tcl adept wanted for Stackless problem

Christian Tismer tismer at tismer.com
Wed Jun 19 11:28:50 EDT 2002


Guido van Rossum wrote:
>>My big question is:
>>When does Tcl use C stack entries as globals, which
>>are passed as function arguments to interpreter calls?
> 
> 
> It's a performance hack, just as stackless :-).

Where the effect of my hack is slightly bigger.
We can fight that out in Charleroi. :-)

> Tcl's interpreter data structure has a return value field which can
> receive a string of arbitrary length.  In order to make this
> efficient, this is initialized with a pointer to a limited-size array
> on the stack of the caller; when the return value is longer, a
> malloc()'ed buffer is used.  There is a little dance you have to do to
> free the malloc()'ed buffer.  The big win is that most calls return
> short strings and hence you save a call to malloc() and one to free()
> per invocation.  This is used *all over* the Tcl source, so good luck
> getting rid of it.

Thank you! I should better not try this. Instead, I'd like
not to touch it at all.
I have patched tkinter in a way that it does not slice the stack
while some Tcl stuff is running (maybe I didn't catch all).
That should mean that the small stack stings are all alive.
That is, in the context of Tcl, I dispensed with the
"stackless" concept.

The remaining problem is switching of tasklets which contain
Tcl invocations. I thought so far that this is no problem,
since these are disjoint contexts, but Jeff Senn reported
problems as well.
I fear I have the problem that Tcl thinks it is still using
the same interp, or it creates a nested one, while the
tasklets are not nested, but seen as independent. Somehow
I need to create a new Tcl frame chain for every tasklet
that uses Tcl.
Can this be the problem?

Still no clue how to do it but thanks - 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/







More information about the Python-list mailing list