Re: Compile to C difficulties

Pascal Bourguignon <>
8 Sep 2006 23:22:17 -0400

          From comp.compilers

Related articles
Compile to C difficulties (Charlie) (2006-09-08)
Re: Compile to C difficulties (Michael Tiomkin) (2006-09-08)
Re: Compile to C difficulties (Pascal Bourguignon) (2006-09-08)
Re: Compile to C difficulties (George Neuner) (2006-09-09)
Re: Compile to C difficulties (Charlie) (2006-09-11)
Re: Compile to C difficulties (George Neuner) (2006-09-12)
Re: Compile to C difficulties (Charlie) (2006-09-16)
Re: Compile to C difficulties (russell kym horsell) (2006-09-18)
| List of all articles for this month |

From: Pascal Bourguignon <>
Newsgroups: comp.compilers
Date: 8 Sep 2006 23:22:17 -0400
Organization: Informatimago
References: 06-09-026
Keywords: translator, storage, C, question
Posted-Date: 08 Sep 2006 23:22:17 EDT

"Charlie" <> writes:

> I am developed a language, Jenny (see -- which may be of
> interest to the members of this group. Jenny/Jenagin is implimented
> with a version of Gentle, which compiles to C in a simplistic fashion.
> Since many of the rules are recursive, the C procedure stack can
> overflow for practical exam code.
> Currently I am working on improved translation to C. To avoid C stack
> overflow, I can use my own stack from heap memory but this slows the
> execution. So I can run normally with the C stack, then switch over
> to the heap stack. In the literature I have found a means of
> determining position on the C stack which should be fairly portable,
> and can switch over once a arbitrary limit is reached.
> But for robust usage I have a number of questions.
> Is there a reasonable way to obtain a good limit?
> I considered trying to probe the stack size with say alloca but this
> seems to exit the program when the limit is reached.
> If the C stack competes with the Heap space or grows into virtual
> memory, is this even a good idea?
> Any suggestions?

First try: ulimit -S space
              or: ulimit -s space
man ulimit

> Another problem.
> As the heap stack grows and contracts, it leaves pointers to unneeded
> "garbage". It seems wasteful to zero the heap stack contents as it
> contracts. But leaving the pointers would prevent a garbage collector
> recycling the garbage. Ideally I would like to zero the left over
> stack immediately before a garbage collector starts, but the most
> popular Boehm GC does not seem to have hooks for this purpose.
> Again thanks for any suggestions.

For the heap, you can just unmap the pages that are freed, and keep
track of the mapped pages for the GC.

__Pascal Bourguignon__

Post a followup to this message

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