[m-dev.] diff: improve performance of jumpopt.m
Simon Taylor
stayl at cs.mu.OZ.AU
Thu Oct 26 16:36:46 AEDT 2000
Estimated hours taken: 0.25
compiler/jumpopt.m:
Avoid constructing a comment for a tailcall
unless it is actually needed. This change reduces
the time taken by `mmc -C make_hlds' by about 1%.
Index: jumpopt.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/jumpopt.m,v
retrieving revision 1.55
diff -u -u -r1.55 jumpopt.m
--- jumpopt.m 2000/10/13 04:04:46 1.55
+++ jumpopt.m 2000/10/25 15:08:10
@@ -239,7 +239,6 @@
TraceLevel, CheckedNondetTailCallInfo0,
CheckedNondetTailCallInfo, Instrs) :-
Instr0 = Uinstr0 - Comment0,
- string__append(Comment0, " (redirected return)", Redirect),
(
Uinstr0 = call(Proc, label(RetLabel), LiveInfos, Context,
GoalPath, CallModel)
@@ -257,7 +256,8 @@
->
opt_util__filter_out_livevals(Between0, Between1),
list__append(Between1, [livevals(Livevals) - "",
- goto(Proc) - Redirect], NewInstrs),
+ goto(Proc) - redirect_comment(Comment0)],
+ NewInstrs),
RemainInstrs = Instrs0,
CheckedNondetTailCallInfo1 = CheckedNondetTailCallInfo0
;
@@ -269,7 +269,8 @@
not set__member(RetLabel, LayoutLabels)
->
list__append(Between, [livevals(Livevals) - "",
- goto(Proc) - Redirect], NewInstrs),
+ goto(Proc) - redirect_comment(Comment0)],
+ NewInstrs),
RemainInstrs = Instrs0,
CheckedNondetTailCallInfo1 = CheckedNondetTailCallInfo0
;
@@ -290,7 +291,7 @@
assign(curfr, lval(succfr(lval(curfr))))
- "setup curfr on return from tailcall",
livevals(Livevals) - "",
- goto(Proc) - Redirect
+ goto(Proc) - redirect_comment(Comment0)
],
RemainInstrs = Instrs0,
CheckedNondetTailCallInfo1 = CheckedNondetTailCallInfo0
@@ -319,7 +320,7 @@
assign(curfr, lval(succfr(lval(curfr))))
- "setup curfr on return from tailcall",
livevals(Livevals) - "",
- goto(Proc) - Redirect,
+ goto(Proc) - redirect_comment(Comment0),
label(NewLabel) - "non tail call",
Instr0
],
@@ -340,7 +341,7 @@
NewInstrs = [call(Proc, label(DestLabel),
LiveInfos, Context, GoalPath,
CallModel)
- - Redirect],
+ - redirect_comment(Comment0)],
RemainInstrs = Instrs0
),
CheckedNondetTailCallInfo1 = CheckedNondetTailCallInfo0
@@ -627,6 +628,9 @@
TraceLevel, CheckedNondetTailCallInfo1,
CheckedNondetTailCallInfo, Instrs9),
list__append(NewInstrs, Instrs9, Instrs).
+
+:- func redirect_comment(string) = string.
+redirect_comment(Comment0) = string__append(Comment0, " (redirected return)").
% We avoid generating statements that redefine the value of a location
% by comparing its old contents for non-equality with zero.
--------------------------------------------------------------------------
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