[m-dev.] for review: --optimize-mostly-det-tailcalls
Fergus Henderson
fjh at cs.mu.OZ.AU
Mon Jun 7 13:24:40 AEST 1999
On 06-Jun-1999, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
>
> Add a new option, --optimize-mostly-det-tailcalls, that enables the use of
> Prolog style nondet tail calls (which check whether the current frame is
> on top of the nondet stack and only do a tail call if it is).
...
> --- jumpopt.m 1999/05/28 05:26:18 1.46
> @@ -65,8 +82,16 @@
> Procmap0, Procmap, Sdprocmap0, Sdprocmap, Succmap0, Succmap),
> map__init(Forkmap0),
> jumpopt__build_forkmap(Instrs0, Sdprocmap, Forkmap0, Forkmap),
> + ( MostlyDetTailCall = yes ->
> + opt_util__get_prologue(Instrs0, ProcLabel, _, _, _),
> + opt_util__new_label_no(Instrs0, 500, LabelNum),
> + MostlyDetTailCallInfo = yes(ProcLabel - LabelNum)
> + ;
> + MostlyDetTailCallInfo = no
> + ),
What's the magic number 500 for?
I think it would be a good idea to centralize the code which allocates
label numbers so that all such magic numbers occur in a single part
of the code.
options.m:
> @@ -2077,6 +2081,12 @@
> + "\tConvert nondet calls into tail calls whenever possible,",
> + "\teven if the code before the call is not guaranteed to be det.",
> + "\tThis increases speed only if the code before the call turns",
> + "\tout to be det most of the time, but can reduce speed if this",
> + "\tis not the case.",
> +++ user_guide.texi 1999/06/06 04:38:39
> @@ -3483,6 +3483,14 @@
> Disable elimination of jumps to ordinary code.
>
> @sp 1
> + at item --optimize-mostly-det-tailcalls
> +Convert nondet calls into tail calls whenever possible,
> +even if the code before the call is not guaranteed to be det.
> +This increases speed only if the code before the call turns
> +out to be det most of the time, but can reduce speed if this
> +is not the case.
I think this documentation will be very hard for most users to
understand. I think it would be better to explain things in more detail,
e.g. mentioning the run-time test.
Regarding "Convert nondet calls" -- a "nondet call" is a call to a nondet
procedure, but here I think you mean a call _from_ a nondet (or multi)
procedure.
Also, "is not guaranteed to be det" is not the right condition.
The right condition is "might return more than one solution" or
something like that.
--
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