Re: Heap Allocated Stack Frame x86 Compiler?

"Fergus Henderson" <fjh@cs.mu.OZ.AU>
8 Sep 2002 22:52:26 -0400

          From comp.compilers

Related articles
Heap Allocated Stack Frame x86 Compiler? siavash_massoumi@yahoo.co.uk (Bruce) (2002-09-03)
Re: Heap Allocated Stack Frame x86 Compiler? stephen@dino.dnsalias.com (Stephen J. Bevan) (2002-09-08)
Re: Heap Allocated Stack Frame x86 Compiler? firefly@diku.dk (Peter \Firefly\Lund) (2002-09-08)
Re: Heap Allocated Stack Frame x86 Compiler? fjh@cs.mu.OZ.AU (Fergus Henderson) (2002-09-08)
Re: Heap Allocated Stack Frame x86 Compiler? idbaxter@semdesigns.com (Ira Baxter) (2002-09-08)
Re: Heap Allocated Stack Frame x86 Compiler? bonzini@gnu.org (Paolo Bonzini) (2002-09-12)
| List of all articles for this month |

From: "Fergus Henderson" <fjh@cs.mu.OZ.AU>
Newsgroups: comp.compilers
Date: 8 Sep 2002 22:52:26 -0400
Organization: Computer Science, University of Melbourne
References: 02-09-005
Keywords: 386, storage
Posted-Date: 08 Sep 2002 22:52:26 EDT



"Bruce" <siavash_massoumi@yahoo.co.uk> writes:


>Is there a compiler available that will create native x86 code that
>makes no use of the stack. Instead it could dynamically allocate space
>for a stack frame on the heap and then set the EBP and ESP registers
>and then use the stack as normal.
>I searched the internet but all I can find are langauges such as
>python and PicoC that run on top of virtual machines.


Well, there are language implementations which work by first compiling
their source language to code for a virtual machine, and then
*compiling* the virtual machine code to native code (rather than
interpreting it), perhaps via another intermediate language such as C.
Examples in this category include ghc, GNU Prolog, and the "low level
C" back-end of the Mercury compiler [1]. These language
implementations all compile to native code (albeit via C), and AFAIK
do not use the ESP register for their normal call frames. (This is
definitely true for GNU Prolog and Mercury, but I'm not so sure for
ghc.) However, I don't think it is true that they make no use of the
system stack; since they compile via C, the generated code may make
use of the system stack to hold temporary values used for expression
evaluation.


Another example which might be even closer to what you are looking for
is SML/NJ [2]. SML/NJ allocates stack frames on the heap, and
recovers them by garbage collection (or at least it did last time I
looked). It has an x86 native code generator.


[1] See <http://www.cs.mu.oz.au/research/mercury/backends.html>.
[2] See <http://www.smlnj.org>.


--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.


Post a followup to this message

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