[Stackless] Re: [Python-Dev] Tcl adept wanted for Stackless problem

Guido van Rossum guido at python.org
Wed Jun 19 17:07:36 CEST 2002


> 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 :-).

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.

--Guido van Rossum (home page: http://www.python.org/~guido/)

_______________________________________________
Stackless mailing list
Stackless at www.tismer.com
http://www.tismer.com/mailman/listinfo/stackless



More information about the Stackless mailing list