Then there are the JVMs, which historically instantiate "activation
records" on the heap, and let the garbage collector clean up the mess
later. This ensures that references to locals returned to callers don't
wind up hanging.
Apparently this is such a performance loser (stacks have
nice refrerence locality properties that work well with caches) that
recent JVMs do "escape analysis" to catch the hanging return issue and
allocate everything else on a real stack, as the scope syntax might lead
one to expect.
This is relevant in the context of the OP because there
exists at least one C compiler that targets the JVM, so therefore there is
at least one C compiler that uses heap allocated stacks. I expect that
there are others, though.
In article <438B6648.F691DA73@sympaticoREMOVE.ca>,
Eric P. <eric_pattison@sympaticoREMOVE.ca> wrote:
However with multi-threading, I think the only solutions are the
between-a-rock-and-a-hard-place types, at least the ones that I
have heard of.
The common Unix solution is to treat the initial stack specially, so
non-threaded programs behave fairly sanely. And that's the case which
was at question here.
There is no place to linearly grow dynamic stacks,
and if you reserve too much space for each thread stack, you can
run out of space and limit the number of threads.
Apparently you aren't a convert to 64-bit computing.
...
So you pick a number and Windows picked 1 MB as their default.
Eric P. wrote:
So you pick a number and Windows picked 1 MB as their default.
Is it one megabyte? IIRC, Windows doesn't allow to grow the stack by some
arbitrary constant, but if you grow it step by step, you could grow it much
larger than the 1 MB limit above. The stack could grow only by a rather
small amount at a time (I ended up to grow in pages).
On Tue, 29 Nov 2005 16:23:47 +0100 in comp.arch, Bernd Paysan
bernd.paysan@gmx.de> wrote:
Eric P. wrote:
So you pick a number and Windows picked 1 MB as their default.
Is it one megabyte? IIRC, Windows doesn't allow to grow the stack by some
arbitrary constant, but if you grow it step by step, you could grow it much
larger than the 1 MB limit above. The stack could grow only by a rather
small amount at a time (I ended up to grow in pages).
AIUI, the 1 MB is the default address space allocation, but at thread
startup, only 1 page is committed. As the stack grows, additional
pages are committed one at a time, but the stack is not allowed to
grow beyond the allocated (e.g., 1 MB) limit.
The 1 MB limit can be overridden, either at link time or run time.
Similarly, the stack committment default can also be overridden, in
multiples of pages.
This was true of NT4 about 6 years ago. Subsequent versions of
Windoze may be different.
Eric P. wrote:
So you pick a number and Windows picked 1 MB as their default.
Is it one megabyte? IIRC, Windows doesn't allow to grow the stack by some
arbitrary constant, but if you grow it step by step, you could grow it much
larger than the 1 MB limit above. The stack could grow only by a rather
small amount at a time (I ended up to grow in pages).
Can you name a JVM with heap-allocated activation records?
Andrew Reilly <andrew-newspost@areilly.bpc-users.org> writes:
Then there are the JVMs, which historically instantiate "activation
records" on the heap, and let the garbage collector clean up the mess
later. This ensures that references to locals returned to callers don't
wind up hanging.
On Tue, 29 Nov 2005 09:58:37 -0800, dgay wrote:
Can you name a JVM with heap-allocated activation records?
I thought that I'd read about one, but now can't find one. It's pretty
easy to find references to Smalltalk and lisp/scheme compilers that do
this, but not JVM ones.
Sorry for the noise. Chalk it up to crossed neurones.
Hi
On a pentium machine the following program crashes. Was guessing has it
something to do with the architecture ?
int main()
{
int ar[530000];
return 0;
}
Whereas in Java the reference s on the stack, but the object has to behave
as if it is on the heap.
It is a big deal and highly touted feature for a JVM to be able to
allocate some such objects on the stack rather than the heap.
Either it uses static analysis to do so.
Or it allocates on the stack, and detects when it should be moved to the heap.
Return to Computer Architecture
Users browsing this forum: No registered users and 0 guests