[m-dev.] for review: accumulator introduction

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Jun 4 16:43:33 AEST 1999


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.

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/

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

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- 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