[m-rev.] diff: detism `failure' does not imply tail call
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Feb 7 05:43:33 AEDT 2002
On 31-Jan-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> Fix a bug where we weren't getting proper tail recursion optimization in
> the MLDS->C back-end for procedures with output arguments and determinism
> `erroneous'.
>
> compiler/ml_call_gen.m:
> Mark calls with determinism `erroneous' or `failure' as tail calls.
Estimated hours taken: 0.5
Branches: main
Fix a bug that broke tests/hard_coded/unused_float_box_test.m
in MLDS grades at -O4 and higher.
compiler/ml_call_gen.m:
compiler/ml_tailcall.m:
Don't mark procedures with determinism `failure' as tail calls --
that's not always correct. The called procedured can fail,
i.e. return FALSE to the caller, and then the caller can continue
to do other computations.
Workspace: /home/earth/fjh/ws-earth4/mercury
Index: compiler/ml_call_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_call_gen.m,v
retrieving revision 1.29
diff -u -d -r1.29 ml_call_gen.m
--- compiler/ml_call_gen.m 1 Feb 2002 22:09:07 -0000 1.29
+++ compiler/ml_call_gen.m 6 Feb 2002 18:40:35 -0000
@@ -447,10 +447,9 @@
%
% build the MLDS call statement
%
- % if the called procedure has determinism `erroneous' or `failure',
+ % if the called procedure has determinism `erroneous'
% then it's always safe to make this call a tail call.
- { determinism_components(Detism, _, NumSolns) },
- { NumSolns = at_most_zero ->
+ { Detism = erroneous ->
CallOrTailcall = tail_call
;
CallOrTailcall = call
Index: compiler/ml_tailcall.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_tailcall.m,v
retrieving revision 1.13
diff -u -d -r1.13 ml_tailcall.m
--- compiler/ml_tailcall.m 1 Feb 2002 22:09:08 -0000 1.13
+++ compiler/ml_tailcall.m 6 Feb 2002 18:36:01 -0000
@@ -45,7 +45,7 @@
% any backend support for them.
%
% Note that ml_call_gen.m will also mark calls to procedures with determinism
-% `erroneous' or `failure' as tail calls when it generates them.
+% `erroneous' as tail calls when it generates them.
%-----------------------------------------------------------------------------%
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list