[m-dev.] for review: bug fix for existential_rtti.m

David Glen JEFFERY dgj at cs.mu.OZ.AU
Tue Feb 15 18:28:21 AEDT 2000


This one's for Fergus.

This diff fixes the error with tests/hard_coded/existential_rtti.m when
compiled in debug grade. This uses the patch that Fergus posted here last week,
although slightly modified.

===================================================================

Estimated hours taken: 8 
		(including a few misguided tries...)

compiler/type_util.m:
	Add a new predicate, type_util__real_vars, which is the same
	as type_util__vars except it doesn't count type-info variables.
compiler/{continuation_info.m, hlds_pred.m, trace.m}:
	Use type_util__real_vars rather than type_util__vars since the
	latter was causing problems when calculating the live type-infos,
	and causing the failure of the test case 
	tests/hard_coded/existential_rtti.m in debug grade.

===================================================================


cvs diff: Diffing .
Index: continuation_info.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/continuation_info.m,v
retrieving revision 1.30
diff -u -t -r1.30 continuation_info.m
--- continuation_info.m	2000/02/10 04:37:37	1.30
+++ continuation_info.m	2000/02/15 07:03:22
@@ -623,7 +623,7 @@
                 LldsInst = partial(Inst)
         ),
         LiveValueType = var(Var, Name, Type, LldsInst),
-        type_util__vars(Type, TypeVars).
+        type_util__real_vars(Type, TypeVars).
 
 %---------------------------------------------------------------------------%
 
@@ -667,7 +667,7 @@
         Layout = closure_arg_info(Type, Inst),
         set__singleton_set(Locations, lval(reg(r, ArgLoc))),
         map__det_insert(VarLocs0, Var, Locations, VarLocs1),
-        type_util__vars(Type, VarTypeVars),
+        type_util__real_vars(Type, VarTypeVars),
         set__insert_list(TypeVars0, VarTypeVars, TypeVars1),
         continuation_info__build_closure_info(Vars, Types, ArgInfos, Layouts,
                 InstMap, VarLocs1, VarLocs, TypeVars1, TypeVars).
Index: hlds_pred.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/hlds_pred.m,v
retrieving revision 1.71
diff -u -t -r1.71 hlds_pred.m
--- hlds_pred.m	2000/02/08 15:07:46	1.71
+++ hlds_pred.m	2000/02/15 07:03:25
@@ -1995,7 +1995,7 @@
         ( 
                 map__search(VarTypeMap, Var, Type)
         ->
-                type_util__vars(Type, TypeVars),
+                type_util__real_vars(Type, TypeVars),
                 (
                         % Optimize common case
                         TypeVars = []
Index: trace.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/trace.m,v
retrieving revision 1.29
diff -u -t -r1.29 trace.m
--- trace.m	1999/12/16 19:06:52	1.29
+++ trace.m	2000/02/15 07:03:28
@@ -714,7 +714,8 @@
         ),
         LiveType = var(Var, Name, Type, LldsInst),
         VarInfo = var_info(direct(Lval), LiveType),
-        type_util__vars(Type, TypeVars),
+        type_util__real_vars(Type, TypeVars),
+
         set__insert_list(Tvars0, TypeVars, Tvars1)
         },
         trace__produce_vars(Vars, VarSet, InstMap, Tvars1, Tvars,
Index: type_util.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/type_util.m,v
retrieving revision 1.79
diff -u -t -r1.79 type_util.m
--- type_util.m	2000/02/08 06:59:28	1.79
+++ type_util.m	2000/02/15 07:04:23
@@ -224,6 +224,13 @@
 :- pred type_util__vars(type, list(tvar)).
 :- mode type_util__vars(in, out) is det.
 
+        % Return a list of the type variables of a type,
+        % ignoring any type variables if the variable in
+        % question is a type-info
+
+:- pred type_util__real_vars(type, list(tvar)).
+:- mode type_util__real_vars(in, out) is det.
+
         % type_list_subsumes(TypesA, TypesB, Subst) succeeds iff the list
         % TypesA subsumes (is more general than) TypesB, producing a
         % type substitution which when applied to TypesA will give TypesB.
@@ -993,6 +1000,14 @@
 
 type_util__vars(Type, Tvars) :-
         term__vars(Type, Tvars).
+
+type_util__real_vars(Type, Tvars) :-
+        ( is_introduced_type_info_type(Type) ->
+                % for these types, we don't add the type parameters
+                Tvars = []
+        ;
+                type_util__vars(Type, Tvars)
+        ).
 
 %-----------------------------------------------------------------------------%
 
cvs diff: Diffing notes


dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) | If your thesis is utterly vacuous
PhD student,                    | Use first-order predicate calculus.
Dept. of Comp. Sci. & Soft. Eng.|     With sufficient formality
The University of Melbourne     |     The sheerist banality
Australia                       | Will be hailed by the critics: "Miraculous!"
                                |     -- Anon.
--------------------------------------------------------------------------
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