[m-dev.] for review: make tailcall loops an MLDS transformation
Tyson Dowd
trd at cs.mu.OZ.AU
Thu Aug 24 16:47:13 AEST 2000
On 24-Aug-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 22-Aug-2000, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> > +++ compiler/ml_tailcall.m 2000/08/14 01:37:38
> > @@ -57,6 +57,7 @@
> >
> > :- implementation.
> > :- import_module list, std_util.
> > +:- import_module ml_util.
> >
> > ml_mark_tailcalls(MLDS0, MLDS) -->
> > { MLDS0 = mlds(ModuleName, ForeignCode, Imports, Defns0) },
>
> 1. I don't understand why that import is needed.
It's not.
>
> 2. I think it would be a good idea to add a comment in ml_tailcall.m
> mentioning that optimization of self-tailcalls is done in ml_optimize.m.
Done.
>
> > +:- func optimize_in_maybe_statement(opt_info,
> > + maybe(mlds__statement)) = maybe(mlds__statement).
> > +
> > +optimize_in_maybe_statement(_, no) = no.
> > +optimize_in_maybe_statement(OptInfo, yes(Statement0)) = yes(Statement) :-
> > + Statement = optimize_in_statement(OptInfo, Statement0).
> > +
> > +:- func optimize_in_statements(opt_info, list(mlds__statement)) =
> > + (list(mlds__statement)).
>
> The parentheses around the return value are not needed, and for consistency
> with other code in this module (and elsewhere) they should be omitted.
>
> > +:- func optimize_in_statement(opt_info, mlds__statement) =
> > + (mlds__statement).
>
> Likewise here, and in a few other places in this module.
Fixed.
>
> > +optimize_in_statement(OptInfo, statement(Stmt, Context)) =
> > + statement(optimize_in_stmt(OptInfo ^ context := Context, Stmt),
> > + Context).
>
> For consistency with code elsewhere in the Mercury compiler, s/ ^ /^/
> Likewise in many other spots in this module.
There is no consistency in the rest of the Mercury compiler.
fjh, zs (mostly), petdr, conway and dmo use Var^field.
stayl and trd use Var ^ field.
About 1/3 of the uses of ^ in the compiler are Var ^ field.
The error messages use Var ^ field.
The comments in make_hlds use Var ^ field.
The documentation uses Var^field.
If you want Var^field to be the standard then suggest a change to the
coding standards. But I will fight this because I think it is butt
ugly, and I have a great deal of trouble reading code that uses this
style. Of course you have numbers on your side.
--
Tyson Dowd #
# Surreal humour isn't everyone's cup of fur.
trd at cs.mu.oz.au #
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
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