[m-dev.] Attn Peter Wang: CTGC idea.

Peter Wang novalazy at gmail.com
Thu Aug 21 17:26:21 AEST 2008

On 2008-08-21, Paul Bone <pbone at csse.unimelb.edu.au> wrote:
> Attention Peter Wang.
> I don't know if you've considered this as part of your CTGC work or not
> yet.  alloca (C function) provides very cheap memory allocation and
> deallocation using the program stack.  Even though we don't use the C
> program stack in LLDS backends I'm sure we can write something
> equivalent.
> Java promotes some heap variables to stack variables using a technique
> like this when it's analysis shows a variable being created and
> destroyed when the same stack frame is at the top of the stack.  Perhaps
> we could do a similar analysis and use this technique too?

Yes, I suppose we could.  So if you construct a cell and it dies by the
end of the procedure, and remains unique, then you don't have to
allocate it on the heap.  We can't use the detstack.  The C stack might
work, but I'm not sure how portable that would be.  On the high-level C
grade we could use a local variable.

Of course then there's rbmm.


mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au

More information about the developers mailing list