[m-rev.] [reuse] diff: unconditional reuses (bugfix)
Nancy Mazur
Nancy.Mazur at cs.kuleuven.ac.be
Fri Aug 17 03:15:33 AEST 2001
Hi,
===================================================================
Estimated hours taken: 1
Bugfix. If a procedure has conditional reuse, it is split up into 2
versions: a version having all reuse, and a version having all
unconditional reuse (i.e. reuse which is always safe to do,
independent of the caller). Even if a reuse has no conditional reuse, the
version is still processed to allow all unconditional reuse.
When introducing the concept of "potential_reuse" as an extra step
before the actual reuses, things went wrong, and the unconditional
reuses in the versions with pure unconditional reuses, were not
marked as actual reuses, hence missing a huge part of all the
reuses.
Solution: when a reuse is known to be unconditional, don't go mark
it as "potential reuse", but directly as a plain reuse tout-court.
sr_choice_graphing.m:
sr_indirect.m:
When reuse is detected, check whether it is conditional
or not. If yes: produce a potential_reuse(...), or else,
simply move on to reuse(...).
Index: sr_choice_graphing.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/sr_choice_graphing.m,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 sr_choice_graphing.m
--- sr_choice_graphing.m 2001/07/06 09:42:25 1.1.2.2
+++ sr_choice_graphing.m 2001/08/16 17:05:56
@@ -742,11 +742,22 @@
Cond = condition(_,_,_),
Conditional = yes
),
- goal_info_set_reuse(I0,
- potential_reuse(cell_reused(
- DeadContextVar ^ pvar,
+ CellReused = cell_reused( DeadContextVar ^ pvar,
Conditional,
- ConsIds, ReuseFields)), I),
+ ConsIds, ReuseFields),
+ (
+ Conditional = yes,
+ KindReuse = potential_reuse(CellReused)
+ ;
+ Conditional = no,
+ % If the reuse is unconditional, then
+ % reuse is not just potentially possible,
+ % but alwasy possible, so skipping the
+ % potential phase is perfectly safe.
+ % (see also sr_indirect__call_verify_reuse)
+ KindReuse = reuse(CellReused)
+ ),
+ goal_info_set_reuse(I0, KindReuse, I),
E = E0
;
% ReuseVars = [_|_]
Index: sr_indirect.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/sr_indirect.m,v
retrieving revision 1.1.2.25
diff -u -r1.1.2.25 sr_indirect.m
--- sr_indirect.m 2001/06/22 14:46:59 1.1.2.25
+++ sr_indirect.m 2001/08/16 17:05:57
@@ -513,10 +513,21 @@
indirect_reuse_pool_add(HLDS, ProcInfo,
Memo, LFUi, LBUi,
Alias0, ConditionalReuse, Pool0, Pool),
- goal_info_set_reuse(Info0,
- potential_reuse(
- reuse_call(ConditionalReuse)),
- Info),
+ ReuseCall = reuse_call(ConditionalReuse),
+ (
+ ConditionalReuse = yes,
+ KindReuse = potential_reuse(ReuseCall)
+ ;
+ ConditionalReuse = no,
+ % If the reuse is unconditional, then
+ % reuse is not just potentially possible,
+ % but alwasy possible, so skipping the
+ % potential phase is perfectly safe.
+ % (see also
+ % sr_choice_graphing__annotate_reuses)
+ KindReuse = reuse(ReuseCall)
+ ),
+ goal_info_set_reuse(Info0, KindReuse, Info),
YesNo = yes
;
Pool = Pool0,
--------------------------------------------------------------------------
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