This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Simula front-end: Heap-allocated activation records
- To: Fergus Henderson <fjh at cs dot mu dot oz dot au>
- Subject: Re: Simula front-end: Heap-allocated activation records
- From: "Knut Aksel Røysland" <knutroy at ifi dot uio dot no>
- Date: Mon, 26 Feb 2001 15:34:57 +0100 (MET)
- CC: gcc at gcc dot gnu dot org
On 23-Feb-2001, Fergus Henderson <fjh@cs.mu.oz.au> wrote:
> A common technique used to implement coroutines is to allocate a
> medium-sized region on the heap for each coroutine thread, to hold the
> stack for that thread.
[...]
> The major drawback of this technique is the need to determine the size
> of the coroutine stacks in advance.
Thanks.
I imagine this is a common method used in Java run-time systems using
threads. In Simula, however, the number of coroutines can usually get
quite large, so this approach could easily waste a lot of address
space or cause expensive and complicated remedies when a stack runs
out of space in its current location (not to mention that one actually
has to check for available space before growing the stack). This is
why I am a little bit reluctant to deploy the scheme you suggested.
Speaking of using a stack per coroutine, I have actually considered
using obstacks for allocating activation records, each coroutine
having its own obstack. I imagine this would improve a bit on
efficiency, although principally the scheme is still the same as I
originally described, where temporaries have to be saved in an
explicitly allocated activation record.
--
Knut Aksel Røysland