[m-dev.] for review: change default stack size

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Dec 19 01:36:50 AEDT 2000


On 15-Dec-2000, Thomas Conway <conway at cs.mu.OZ.AU> wrote:
> On Fri, Dec 15, 2000 at 02:34:26PM EST, Fergus Henderson wrote:
> > On 15-Dec-2000, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> > > On 14-Dec-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > > > 	This will also improve performance for programs that
> > > > 	don't use much memory, since currently the conservative
> > > > 	garbage collector scans the whole of the det stack,
> > > > 	including those parts which aren't used.
> > > 
> > > Unless this effect is significant (e.g. gets a speedup of at least two percent
> > > on a program), I think the problems it causes are not worth it. 3.5Mb just
> > > isn't that much these days.
> > 
> > I get a speedup of roughly 2.5% on nrev.
> 
> Lies, damm lies, statistics, and benchmarks.
> 
> How much difference does it make on any program that anyone uses?

I don't know.  For now, I'll just change the documentation to match
what the runtime does (allocate 4M), rather than changing the runtime
code to match the documentation.

> How hard would it be to allocate a larger stack, mprotect it out
> and only tell the collector about it as it gets unprotected and used?

Not too hard, I suppose, but not quite trivial either.

Previously I spent quite a bit of time working on trying to get the
collector to only collect exactly the bit that has been used.
But that one ran into difficulties with register windows on the sparc:
if the stack pointer was in a register window register, then by the
time we get into the garbage collector, we can't find it anymore.
I was hoping to avoid that by using gcc's `-mflat' option to avoid
using register windows, but it turned out that gcc's `-mflat' option
was broken in the presence of `-fpic', so I shelved that one.

Your suggestion, which amounts to just getting the GC to scan a closer
approximation to the amount actually used, rather than scanning only
those parts of the stack which are used, is probably quite a bit easier
to implement, in that it doesn't require fixing bugs in gcc.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list