[m-dev.] for review: accumulator introduction

Peter Ross petdr at cs.mu.OZ.AU
Tue Jun 15 12:41:22 AEST 1999


On 04-Jun-1999, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 04-Jun-1999, Peter Ross <petdr at cs.mu.OZ.AU> wrote:
> > Add a new pass to the compiler, that attempts to introduce accumulators
> > into a procedure so as to make that procedure tail recursive.
> 
> You should mention this in either the NEWS file (and w3/news/news.db)
> or in the WORK_IN_PROGRESS file.
> 

Added it to WORK_IN_PROGRESS, when I check it in I will also add a news
announcement.

> I haven't reviewed the bulk of accumulator.m, but here's a review
> of the comments at the top and of your other changes.
> 
> > +++ accumulator.m	Fri Jun  4 13:57:40 1999
> > +% The transformation is described more fully in papers/tail_recursive.
> 
> That reference will be meaningless to people not in the Mercury group.
> Please give a more detailed reference (e.g. a URL).
> 
> > Index: compiler/options.m
> > @@ -2009,6 +2012,9 @@
> >  		"\t`--optimize-higher-order' and `--type-specialization'.",
> >  		"\tGoal size is measured as the number of calls, unifications",
> >  		"\tand branched goals.",
> > +		"--introduce-accumulators",
> > +		"\tAttempt to introduce accumulating variables into",
> > +		"\tprocedures, so as to make the procedure tail recursive.",
> 
> I suggest s/the procedure/them/
> 
Done.

> > Index: compiler/notes/compiler_design.html
> > +++ user_guide.texi	1999/06/03 08:37:05
> > @@ -3370,6 +3370,11 @@
> >  Evaluate constant expressions at compile time.
> >  
> >  @sp 1
> > + at item --introduce-accumulators
> > +Attempt to introduce accumulating variables into
> > +procedures, so as to make the procedure tail recursive.
> 
> I suggest s/the procedure/them/
> 
> > Index: profiler/demangle.m
> > Index: util/mdemangle.c
> > -	if (category == LAMBDA || category == DEFORESTATION) {
> > +	if (category == LAMBDA || category == DEFORESTATION || 
> > +			category == ACCUMULATOR) {
> 
> The { should be on a new line.
> 
I can do this, but it will be inconsistent with the formatting of the
rest of the code.

Are you sure that you want this change?
--------------------------------------------------------------------------
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