[m-dev.] for review: reordering for existential types [2]

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Jun 11 02:18:55 AEST 1999


On 11-Jun-1999, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> compiler/quantification.m:
>	Include the new type_info variables field in the nonlocals for a
>	complicated unify.

Sorry, the diff I posted here for quantification.m was the wrong one
(it was from a different change).  Here's the correct diff for
quantification.m, to match the above log message.

Index: quantification.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/quantification.m,v
retrieving revision 1.64
diff -u -u -r1.64 quantification.m
--- quantification.m	1999/03/13 01:29:10	1.64
+++ quantification.m	1999/06/07 23:08:18
@@ -318,10 +318,12 @@
 		unify(Var, UnifyRHS, Mode, Unification, UnifyContext)) -->
 	quantification__get_outside(OutsideVars),
 	quantification__get_lambda_outside(LambdaOutsideVars),
+	{ quantification__get_unify_typeinfos(Unification0, TypeInfoVars) },
 	implicitly_quantify_unify_rhs(UnifyRHS0, Unification0, Context,
 		UnifyRHS, Unification),
 	quantification__get_nonlocals(VarsUnifyRHS),
-	{ set__insert(VarsUnifyRHS, Var, GoalVars) },
+	{ set__insert(VarsUnifyRHS, Var, GoalVars0) },
+	{ set__insert_list(GoalVars0, TypeInfoVars, GoalVars) },
 	quantification__update_seen_vars(GoalVars),
 	{ set__intersect(GoalVars, OutsideVars, NonLocalVars1) },
 	{ set__intersect(GoalVars, LambdaOutsideVars, NonLocalVars2) },
@@ -619,10 +621,15 @@
 		set(prog_var), set(prog_var), set(prog_var)).
 :- mode quantification__goal_vars_2(in, in, in, out, out) is det.
 
-quantification__goal_vars_2(unify(A, B, _, _, _), Set0, LambdaSet0,
+quantification__goal_vars_2(unify(A, B, _, Unification, _), Set0, LambdaSet0,
 		Set, LambdaSet) :-
 	set__insert(Set0, A, Set1),
-	quantification__unify_rhs_vars(B, Set1, LambdaSet0, Set, LambdaSet).
+	( Unification = complicated_unify(_, _, TypeInfoVars) ->
+		set__insert_list(Set1, TypeInfoVars, Set2)
+	;
+		Set2 = Set1
+	),
+	quantification__unify_rhs_vars(B, Set2, LambdaSet0, Set, LambdaSet).
 
 quantification__goal_vars_2(higher_order_call(PredVar, ArgVars, _, _, _, _),
 		Set0, LambdaSet, Set, LambdaSet) :-
@@ -700,6 +707,16 @@
 	quantification__goal_vars(Goal, GoalVars),
 	set__delete_list(GoalVars, LambdaVars, GoalVars1),
 	set__union(LambdaSet0, GoalVars1, LambdaSet).
+
+:- pred quantification__get_unify_typeinfos(unification, list(prog_var)).
+:- mode quantification__get_unify_typeinfos(in, out) is det.
+
+quantification__get_unify_typeinfos(Unification, TypeInfoVars) :-
+	( Unification = complicated_unify(_, _, TypeInfoVars0) ->
+		TypeInfoVars = TypeInfoVars0
+	;
+		TypeInfoVars = []
+	).
 
 %-----------------------------------------------------------------------------%
 
-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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