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

Peter Wang novalazy at gmail.com
Mon Aug 25 16:00:33 AEST 2008


On 2008-08-21, Paul Bone <pbone at csse.unimelb.edu.au> wrote:
> On Thu, Aug 21, 2008 at 07:08:44PM +1000, Peter Wang wrote:
> > On 2008-08-21, Paul Bone <pbone at csse.unimelb.edu.au> wrote:
> > 
> > I think this might work for the analysis.  Assume Nancy's sharing
> > analysis has been run, so we know (conservatively) all the variables
> > that share with output variables of the procedure.  If a variable being
> > constructed doesn't (potentially) share with an output variable, it can
> > be stack allocated.
> > 
> 
> We should analyze how many heap alrogithms we can potentially save, to
> provide motivation for this optimisation.

I wrote an initial version of the analysis which just annotates
constructions with whether they can be constructed on the stack.
Assuming the analysis is not too buggy (and I didn't think about nondet
procedures at all), here are the results.  I grepped the HLDS dumps.

library:    431 of  10786 allocations can be done on the stack ( 4.0%)
compiler: 15629 of 108863 allocations can be done on the stack (14.3%)

Inspecting a few of the HLDS dumps manually, it looks like most cases of
stack allocation are for constructions of type(class)infos and closures.

Peter

--------------------------------------------------------------------------
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