diff: .agc liveness in ite.
Tyson Richard DOWD
trd at cs.mu.oz.au
Sun Jun 22 20:24:54 AEST 1997
Hi,
Another bugfix for liveness with accurate gc - this one was a fairly
simple oversight.
===================================================================
Estimated hours taken: 1
Fix a bug in liveness that causes a sanity check to fail for accurate
gc.
compiler/liveness.m:
Handle if-then-else correctly for .agc grades, it wasn't
handling polymorphic type variables correctly.
tests/valid/Mmake:
tests/valid/agc_ite.m:
Add a test case for if-then-else - previously the compiler
aborted on this test case.
Index: compiler/liveness.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/liveness.m,v
retrieving revision 1.74
diff -u -r1.74 liveness.m
--- liveness.m 1997/05/21 02:13:30 1.74
+++ liveness.m 1997/06/20 05:51:41
@@ -373,7 +373,20 @@
detect_deadness_in_goal(Cond0, DeadnessThen, LiveInfo,
DeadnessCond, Cond1),
- goal_info_get_nonlocals(GoalInfo, NonLocals),
+ goal_info_get_nonlocals(GoalInfo, NonLocals0),
+ live_info_get_module_info(LiveInfo, ModuleInfo),
+ module_info_globals(ModuleInfo, Globals),
+ globals__get_gc_method(Globals, GCmethod),
+ (
+ GCmethod = accurate
+ ->
+ live_info_get_proc_info(LiveInfo, ProcInfo),
+ proc_info_get_typeinfo_vars_setwise(ProcInfo, NonLocals0,
+ TypeInfoVars),
+ set__union(NonLocals0, TypeInfoVars, NonLocals)
+ ;
+ NonLocals = NonLocals0
+ ),
set__union(DeadnessCond, DeadnessElse, Deadness),
set__intersect(Deadness, NonLocals, NonLocalDeadness),
Index: tests/valid/Mmake
===================================================================
RCS file: /home/staff/zs/imp/tests/valid/Mmake,v
retrieving revision 1.40
diff -u -r1.40 Mmake
--- Mmake 1997/06/18 07:26:04 1.40
+++ Mmake 1997/06/20 06:00:00
@@ -8,6 +8,7 @@
# please keep this list sorted
SOURCES= \
+ agc_ite.m \
agc_unbound_typevars.m \
agc_unbound_typevars2.m \
agc_unused_in.m \
@@ -78,6 +79,7 @@
# some regression tests only failed with particular options enabled
# (please keep this list sorted)
+GRADE-agc_ite = asm_fast.agc
GRADE-agc_unbound_typevars = asm_fast.agc
GRADE-agc_unbound_typevars2 = asm_fast.agc
GRADE-agc_unused_in = asm_fast.agc
New File: tests/valid/agc_ite.m
===================================================================
%
% Regression test.
%
% Name: agc_ite.m
%
% Description of bug:
% The liveness of polymorphic type variables for accurate gc
% wasn't being computed correctly in the case of if-then-else.
%
% Symptom(s) of bug:
% A sanity check in liveness.m is failed.
%
% Software error: branches of if-then-else disagree on liveness
% Then: HeadVar__3 TypeInfo_for_Y
% Else: HeadVar__3 TypeInfo_for_X TypeInfo_for_Y
%
%
% Date bug existed: 19-June-1997
%
% Author: trd
:- module agc_ite.
:- interface.
:- import_module list.
:- pred agc_ite__filter_map(pred(X, Y), list(X), list(Y)).
:- mode agc_ite__filter_map(pred(in, out) is semidet, in, out) is det.
:- implementation.
agc_ite__filter_map(_, [], []).
agc_ite__filter_map(Pred, [Head0|Tail0], List) :-
( call(Pred, Head0, Head) ->
List = [Head|List1]
;
List = List1
),
agc_ite__filter_map(Pred, Tail0, List1).
--
Tyson Dowd #
# Surreal humour isn't eveyone's cup of
trd at cs.mu.oz.au # fur.
http://www.cs.mu.oz.au/~trd #
More information about the developers
mailing list