Re: The C Stack in interpreters - why?

clearm@comcast.net
14 May 2005 01:58:54 -0400

          From comp.compilers

Related articles
The C Stack in interpreters - why? clearm@comcast.net (2005-05-13)
Re: The C Stack in interpreters - why? Peter_Flass@Yahoo.com (Peter Flass) (2005-05-14)
Re: The C Stack in interpreters - why? haberg@math.su.se (2005-05-14)
Re: The C Stack in interpreters - why? clearm@comcast.net (2005-05-14)
Re: The C Stack in interpreters - why? nmm1@cus.cam.ac.uk (2005-05-14)
Re: The C Stack in interpreters - why? anton@mips.complang.tuwien.ac.at (2005-05-14)
Re: The C Stack in interpreters - why? haberg@math.su.se (2005-05-14)
Re: The C Stack in interpreters - why? nmm1@cus.cam.ac.uk (2005-05-14)
Re: The C Stack in interpreters - why? Marko.Makela@HUT.FI (Marko =?ISO-8859-1?Q?M=E4kel=E4?=) (2005-05-14)
Re: The C Stack in interpreters - why? marcov@stack.nl (Marco van de Voort) (2005-05-14)
[6 later articles]
| List of all articles for this month |
From: clearm@comcast.net
Newsgroups: comp.compilers
Date: 14 May 2005 01:58:54 -0400
Organization: http://groups.google.com
References: 05-05-072
Keywords: C
Posted-Date: 14 May 2005 01:58:54 EDT

By "A lot of languages use the C stack" I mean that many interpreters
coded in C call their bytecode evaluation loop recursively whenever
they enter a new function in the interpreted language. For example,
here is a statement from the Python FAQ:


"Answer 1: Unfortunately, the interpreter pushes at least one C stack
frame for each Python stack frame. Also, extensions can call back into
Python at almost random moments. Therefore, a complete threads
implementation requires thread support for C.


Answer 2: Fortunately, there is Stackless Python, which has a
completely redesigned interpreter loop that avoids the C stack. It's
still experimental but looks very promising."
[That's the hardware stack on computers that have one. The point
they're making is that if you use the regular call stack and want to
do threads in your interpreter, you need a thread package that will
thread at the C level. If you maintain your own stacks for the
interpreter, you can do your own thread package. If you don't want to
do anything that C doesn't do, it's a whole lot easier to use the C
stack than to do explicit allocation and deallocation. -John]



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.