[m-rev.] for review: bug compiler abort on dep_par_14b.m
Peter Wang
wangp at students.csse.unimelb.edu.au
Mon Apr 30 16:01:18 AEST 2007
Branches: main
Fix a bug causing the compiler to abort on tests/par_conj/dep_par_14b.m when
--intermod-opt was enabled (allowing superfluous calls to par_builtin.get be
deleted).
The problem could occur if a parallel conjunction was inside a disjunction.
A variable that was dead in the disjunct containing the parallel conjunction
may be required in a later disjunct, but this was not taken into account so
the stack slot holding the variable might then be erroneously reused.
compiler/live_vars.m:
Make the variables which may become live again on backtracking past
the parallel conjunction (ResumeVars0) part of the set of variables
which need their own stack slots during execution of a parallel
conjunction, so the stack slot allocator won't reuse their slots.
Index: compiler/live_vars.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/live_vars.m,v
retrieving revision 1.129
diff -u -r1.129 live_vars.m
--- compiler/live_vars.m 6 Jan 2007 09:23:37 -0000 1.129
+++ compiler/live_vars.m 30 Apr 2007 05:34:29 -0000
@@ -206,8 +206,10 @@
% or nonlocal to the parallel conjunction. Nonlocal variables that are
% currently free, but are bound inside one of the conjuncts need a
% stackslot because they are passed out by reference to that stackslot.
+ % Variables needed on backtracking must be available in a stackslot
+ % past the parallel conjunction as well.
goal_info_get_code_gen_nonlocals(GoalInfo0, NonLocals),
- set.union(NonLocals, !.Liveness, LiveSet),
+ LiveSet = set.union_list([NonLocals, !.Liveness, ResumeVars0]),
InnerNonLocals = LiveSet `set.union` OuterNonLocals,
InnerParStackVars0 = parallel_stackvars(InnerNonLocals, [], set.init),
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list