[m-users.] Enable LCMC tail recursion optimization by default?

Zoltan Somogyi zoltan.somogyi at runbox.com
Thu Apr 28 01:42:19 AEST 2016



On Wed, 27 Apr 2016 21:52:47 +0800, Sebastian Godelet <sebastian.godelet at outlook.com> wrote:
> > I found that enabling lcmc in Mmake.params leads to changes in 233 C files,
> 
> From the original question I see that there was a need to enable LCMC for a specific 
> function (family), so could we as an intermediate solution support a pragma that enables this
> optimisation for the specified function only, avoiding influencing so many not directly related parts of the program.

In most modules, only a few predicates at most are affected by lcmc,
so turning lcmc on/off on a module-by-module basis seems perfectly adequate
to me.

> Is my understanding correct that this option could be disabled inside the compiler,
> but the installed standard library could be compiled with LMC turned on,

I don't know whether you mean (a) whether users can tell the compiler to disable lcmc
when it compiles their code, or (b) whether we as the implementors of the Mercury compiler
could compile modules of the compiler itself without lcmc, but in both cases,
the answer is "yes".

> s.th. I can use a tail recursive version
> of list.map etc.?

Yes. All library modules have been compiled with lcmc for a long time.

Zoltan.




More information about the users mailing list