[m-rev.] [reuse] trivial diff: clean up some of the renaming procedures

Nancy Mazur Nancy.Mazur at cs.kuleuven.ac.be
Tue Jun 29 15:11:32 AEST 2004


Hi,


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


Estimated hours taken: 1
Branches: reuse

Merge the variable and type-variable renaming procedures into one single
procedure for each of the alias and reuse-types concerned. 

pa_alias_as.m:
pa_alias_set.m:
pa_datastruct.m:
pa_prelim_run.m:
pa_selector.m:
sr_data.m:
sr_indirect.m:
sr_top.m:


Index: pa_alias_as.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/pa_alias_as.m,v
retrieving revision 1.1.2.42
diff -u -r1.1.2.42 pa_alias_as.m
--- pa_alias_as.m	28 Jun 2004 06:56:45 -0000	1.1.2.42
+++ pa_alias_as.m	29 Jun 2004 05:00:22 -0000
@@ -101,26 +101,12 @@
 		list(prog_var)::in, list((type))::in, 
 		alias_as::in, alias_as::out) is det.
 
+:- func to_type_renaming(list((type)), list((type))) = 
+		substitution(tvar_type).
+
 	% Rename the abstract description according to the renaming
 	% mapping of prog_vars (which maps FROM_VARS to the TO_VARS). 
-	% XXX We should ensure that a renaming of the variables is always
-	% accompanied by a renaming of the type-variables that can possible be
-	% used in the selectors. At some point, the procedures renaming either
-	% the args or the types should all be replaced by one single procedure.
-	% This is the only way to guarantee that a full correct renaming has
-	% taken place. 
-:- pred rename(map(prog_var, prog_var)::in, alias_as::in, alias_as::out) is det.
-
-	% rename_types(FromTypes, ToTypes, Alias0, Alias).
-	% Rename all the typevariables occurring in the aliases using the
-	% mapping from FromTypes to ToTypes. 
-:- pred rename_types(list((type))::in, list((type))::in, 
-		alias_as::in, alias_as::out) is det.
-
-	% rename_types(Substitution, Alias0, Alias). 
-	% Rename all the type-variables occurring in the aliases using the
-	% substitution mapping. 
-:- pred rename_types(term__substitution(tvar_type)::in, 
+:- pred rename(map(prog_var, prog_var)::in, maybe(substitution(tvar_type))::in,
 		alias_as::in, alias_as::out) is det.
 
 	% The call equal(Alias1,Alias2) succeeds if both abstract
@@ -409,47 +395,26 @@
 	pred_info_arg_types(PredInfo, FormalTypes), 
 	proc_info_headvars(ProcInfo, FormalVars),
 	map__from_corresponding_lists(FormalVars, ActualVars, Dict), 
-	pa_alias_as__rename(Dict, FormalAlias, FormalAlias1),
-	pa_alias_as__rename_types(FormalTypes,  ActualTypes, 
-			FormalAlias1, ActualAlias).
-
-rename(MapVar, ASin, ASout):-
-	(
-		ASin = real_as(Aliases)
-	->
-		rename(MapVar, Aliases, RAliases), 
-		wrap(RAliases, ASout)
-	;
-		% ASin is bottom or top(_)
-		ASout = ASin 
-	).
-
-rename_types(FromTypes, ToTypes, ASin, ASout) :- 
-	(
-		ASin = real_as(AliasSet0)
-	-> 
-		assoc_list__from_corresponding_lists(FromTypes, ToTypes, 
-				FromToTypes), 
-		list__foldl(rename_type_det, FromToTypes, 
-				map__init, Substitution), 
-		rename_types(Substitution, AliasSet0, 
-				AliasSet),
-		ASout = real_as(AliasSet)
-	; 
-		ASout = ASin 	% bottom or top
-	).
-
-rename_types(Substitution, A0, A) :- 
-	(
-		A0 = real_as(AliasSet0)
-	-> 
-		rename_types(Substitution, AliasSet0, 
-				AliasSet), 
-		A = real_as(AliasSet)
-	; 
-		A = A0
-	).
-			
+	pa_alias_as__rename(Dict, 
+		yes(to_type_renaming(FormalTypes, ActualTypes)), 
+		FormalAlias, ActualAlias).
+
+to_type_renaming(FromTypes, ToTypes) = Substitution :- 
+	assoc_list__from_corresponding_lists(FromTypes, 
+		ToTypes, FromToTypes), 
+	list__foldl(
+		(pred(P::in, S0::in, S::out) is det :- 
+			P = F - T, 
+			( 
+			 	term__unify(F, T, S0, S1) 
+			-> 	S = S1
+			; 	S = S0
+		)), FromToTypes, map__init, Substitution).
+
+rename(_, _, top(M), top(M)). 
+rename(_, _, bottom, bottom). 
+rename(MapVar, MaybeTypeSubst, real_as(Aliases0), real_as(Aliases)):- 
+	pa_alias_set__rename(MapVar, MaybeTypeSubst, Aliases0, Aliases).
 
 equal(AS1, AS2):-
 	(
Index: pa_alias_set.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/pa_alias_set.m,v
retrieving revision 1.1.2.16
diff -u -r1.1.2.16 pa_alias_set.m
--- pa_alias_set.m	27 Jun 2004 10:06:28 -0000	1.1.2.16
+++ pa_alias_set.m	29 Jun 2004 05:00:23 -0000
@@ -50,14 +50,10 @@
 	% Rename the prog_vars occurring in the alias_set, using
 	% a map that maps the to-be-replaced-vars with on the
 	% new prog_vars. 
-:- pred rename(map(prog_var,prog_var)::in, alias_set::in, 
-		alias_set::out) is det. 
+:- pred rename(map(prog_var,prog_var)::in, 
+		maybe(substitution(tvar_type))::in, 
+		alias_set::in, alias_set::out) is det. 
 	
-	% Rename the types occurring in the alias_set, applying
-	% the given substitution to each of the types encountered. 
-:- pred rename_types(term__substitution(tvar_type)::in, 
-		alias_set::in, alias_set::out) is det.
-
 	% Equality test. Needed for the fixpoint computation. 
 :- pred equal(alias_set::in, alias_set::in) is semidet. 
 
@@ -346,12 +342,12 @@
 		Datastructs = [] 
 	). 
 
-rename(Dict, AliasSet0, AliasSet):-
+rename(Dict, MaybeTypeSubst, AliasSet0, AliasSet):-
 	AliasSet0 = alias_set(Size, Map0), 
 	map__foldl(
 		pred(Var0::in, SelectorSet0::in, M0::in, M::out) is det:- 
 		    (
-			alias_set2_rename(Dict, SelectorSet0,
+			alias_set2_rename(Dict, MaybeTypeSubst, SelectorSet0,
 							SelectorSet1),
 			map__lookup(Dict, Var0, Var), 
 			(
@@ -371,9 +367,9 @@
 		Map),
 	AliasSet  = alias_set(Size, Map). 
 
-rename_types(Subst, AliasSet0, AliasSet):- 
-	alias_set_map_values(alias_set2_rename_types(Subst), AliasSet0, 
-			AliasSet). 
+% rename_types(Subst, AliasSet0, AliasSet):- 
+	% alias_set_map_values(alias_set2_rename_types(Subst), AliasSet0, 
+			% AliasSet). 
 
 equal(AliasSet0, AliasSet1):-
 	AliasSet0 = alias_set(Size, Map0), 
@@ -698,9 +694,8 @@
 :- pred alias_set2_project(list(prog_var)::in, alias_set2::in, 
 			alias_set2::out) is det.
 :- pred alias_set2_rename(map(prog_var, prog_var)::in, 
-			alias_set2::in, alias_set2::out) is det.
-:- pred alias_set2_rename_types(term__substitution(tvar_type)::in, 
-			alias_set2::in, alias_set2::out) is det.
+		maybe(substitution(tvar_type))::in, 
+		alias_set2::in, alias_set2::out) is det.
 :- pred alias_set2_equal(alias_set2::in, alias_set2::in) is semidet.
 :- pred alias_set2_add(alias_set2::in, alias_set2::in, 
 			alias_set2::out) is det.
@@ -803,23 +798,22 @@
 		Size),	
 	AliasSet = alias_sel_set(Size, Map). 
 
-alias_set2_rename(Dict, AliasSet0, AliasSet):- 
-	alias_set2_map_values(data_set_rename(Dict), AliasSet0, AliasSet).
-
-alias_set2_rename_types(Subst, AliasSet0, AliasSet):- 
-	AliasSet0 = alias_sel_set(Size, Map0), 
+alias_set2_rename(Dict, MaybeSubst, AliasSet0, AliasSet):- 
+	AliasSet0 = alias_sel_set(Size, Map0),
 	map__foldl(
 		pred(Sel0::in, DataSet0::in, M0::in, M::out) is det :-
 		(
-			pa_selector__rename_types(Subst, Sel0, Sel), 
-			data_set_rename_types(Subst, DataSet0, DataSet), 
+			pa_selector__maybe_rename_types(
+				MaybeSubst, Sel0, Sel), 
+			data_set_rename(Dict, MaybeSubst, DataSet0, 
+				DataSet), 
 			map__det_insert(M0, Sel, DataSet, M)
 		), 
 		Map0,
 		map__init, 
-		Map), 
+		Map),
 	AliasSet = alias_sel_set(Size, Map). 
-
+		
 alias_set2_equal(AliasSet0, AliasSet1):- 
 	AliasSet0 = alias_sel_set(Size, Map0), 
 	AliasSet1  = alias_sel_set(Size, Map), 
@@ -1103,9 +1097,8 @@
 :- pred data_set_project(list(prog_var)::in, 
 				data_set::in, data_set::out) is det.
 :- pred data_set_rename(map(prog_var, prog_var)::in, 
-				data_set::in, data_set::out) is det.
-:- pred data_set_rename_types(term__substitution(tvar_type)::in, 
-				data_set::in, data_set::out) is det.
+		maybe(substitution(tvar_type))::in, 
+		data_set::in, data_set::out) is det.
 :- pred data_set_equal(data_set::in, data_set::in) is semidet.
 :- pred data_set_add(data_set::in, data_set::in, data_set::out) is det.
 :- pred data_set_termshift(data_set::in, selector::in, data_set::out) is det.
@@ -1155,11 +1148,9 @@
 		),
 		DataSet0, 
 		DataSet). 
-data_set_rename(Dict, DataSet0, DataSet) :- 
-	data_set_map(pa_datastruct__rename(Dict), DataSet0, DataSet).
-data_set_rename_types(Subst, DataSet0, DataSet):-
-	data_set_map(pa_datastruct__rename_types(Subst), 
-			DataSet0, DataSet). 
+data_set_rename(Dict, MaybeSubst, DataSet0, DataSet) :- 
+	data_set_map(pa_datastruct__rename(Dict, MaybeSubst), 
+			DataSet0, DataSet).
 data_set_equal(DataSet0, DataSet1):-
 	DataSet0 = datastructs(Size0, Data0), 
 	DataSet1 = datastructs(Size0, Data1), 
Index: pa_datastruct.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/pa_datastruct.m,v
retrieving revision 1.1.2.13
diff -u -r1.1.2.13 pa_datastruct.m
--- pa_datastruct.m	25 Jun 2004 06:23:26 -0000	1.1.2.13
+++ pa_datastruct.m	29 Jun 2004 05:00:23 -0000
@@ -26,7 +26,7 @@
 :- import_module hlds__hlds_pred.
 :- import_module parse_tree__prog_data.
 
-:- import_module map, term.
+:- import_module map, term, std_util.
 
 %-------------------------------------------------------------------%
 %-- exported types
@@ -72,11 +72,9 @@
 :- pred equal(datastruct::in, datastruct::in) is semidet.
 
 	% Rename the variable of the given datastruct.
-:- pred rename(map(prog_var,prog_var)::in, datastruct::in, 
-		datastruct::out) is det.
-
-:- pred rename_types(term__substitution(tvar_type)::in, 
-		datastruct::in, datastruct::out) is det. 
+:- pred rename(map(prog_var,prog_var)::in, 
+		maybe(substitution(tvar_type))::in, 
+		datastruct::in, datastruct::out) is det.
 
 :- pred normalize_wti(module_info::in, proc_info::in, 
 		datastruct::in, datastruct::out) is det.
@@ -107,15 +105,11 @@
 % selector(cel(_Var, Sel)) = Sel.
 
 
-rename(MAP, DATAin, DATAout) :-
-	DATAin = selected_cel(VAR, SEL),
-	map__lookup(MAP, VAR, RVAR),
-	DATAout = selected_cel(RVAR, SEL).
-
-rename_types(Subst, Data0, Data) :- 
-	Data0 = selected_cel(Var, Sel0), 
-	pa_selector__rename_types(Subst, Sel0, Sel), 
-	Data = selected_cel(Var, Sel). 
+rename(ProgVarMap, MaybeSubst, Data0, Data) :-
+	Data0 = selected_cel(Var0, Sel0),
+	map__lookup(ProgVarMap, Var0, Var),
+	pa_selector__maybe_rename_types(MaybeSubst, Sel0, Sel), 
+	Data = selected_cel(Var, Sel).
 
 equal(D1, D2):- D1 = D2.
 
Index: pa_prelim_run.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/pa_prelim_run.m,v
retrieving revision 1.1.2.12
diff -u -r1.1.2.12 pa_prelim_run.m
--- pa_prelim_run.m	25 Jun 2004 02:33:50 -0000	1.1.2.12
+++ pa_prelim_run.m	29 Jun 2004 05:00:23 -0000
@@ -123,21 +123,17 @@
 			PredId, ProcId, ModuleInfo),
 
 			% rename the headvars: 
-		maybe_write_string(VeryVerbose, "Renaming HeadVars..."),
+		maybe_write_string(VeryVerbose, "Renaming HeadVars, Types..."),
 		{ proc_info_headvars(ProcInfo0, ProcHeadVars) }, 
 		{ list__map(term__coerce_var, HeadVars, CHVars) },
 		{ map__from_corresponding_lists(CHVars, ProcHeadVars,
 			MapHeadVars) }, 
-		{ pa_alias_as__rename(MapHeadVars, Alias0, Alias1) },
-		maybe_write_string(VeryVerbose, "done.\n"),
-	
-		% rename the types: 
-		maybe_write_string(VeryVerbose, "Renaming Types..."),
 		{ pred_info_arg_types(PredInfo0, ArgTypes) },
-		{ pa_alias_as__rename_types(Types, ArgTypes, 
-			Alias1, Alias) },
+		{ pa_alias_as__rename(MapHeadVars, 
+			yes(to_type_renaming(Types, ArgTypes)), 
+			Alias0, Alias) }, 
 		maybe_write_string(VeryVerbose, "done.\n"),
-
+	
 		% Record the alias in the aliastable. 
 		{ alias_as_table_set_alias(proc(PredId, ProcId), Alias,
 			AliasTable0, AliasTable) }
Index: pa_selector.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/pa_selector.m,v
retrieving revision 1.1.2.17
diff -u -r1.1.2.17 pa_selector.m
--- pa_selector.m	25 Jun 2004 06:23:26 -0000	1.1.2.17
+++ pa_selector.m	29 Jun 2004 05:00:23 -0000
@@ -18,7 +18,7 @@
 :- import_module hlds__hlds_module.
 :- import_module parse_tree__prog_data.
 
-:- import_module list, int, term.
+:- import_module list, int, term, std_util.
 
 %-------------------------------------------------------------------%
 %-- exported types
@@ -66,7 +66,7 @@
 :- pred less_or_equal(module_info::in, selector::in, selector::in, 
 		(type)::in, selector::out) is semidet.
 
-:- pred rename_types(term__substitution(tvar_type)::in, 
+:- pred maybe_rename_types(maybe(term__substitution(tvar_type))::in, 
 		selector::in, selector::out) is det.
 
 	% normalize with type information
@@ -135,10 +135,11 @@
 	list__append(S2, EXT , S1). 
 
 
-rename_types(Subst, Sel0, Sel):- 
-	list__map(unit_selector_rename_types(Subst), Sel0, Sel).
+maybe_rename_types(no, S, S).
+maybe_rename_types(yes(Subst), S0, S) :-
+	list__map(unit_selector_rename_types(Subst), S0, S).
 
-:- pred unit_selector_rename_types(term__substitution(tvar_type)::in,
+:- pred unit_selector_rename_types(substitution(tvar_type)::in,
 		unit_sel::in, unit_sel::out) is det.
 
 unit_selector_rename_types(Subst, US0, US) :- 
Index: sr_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/sr_data.m,v
retrieving revision 1.1.2.29
diff -u -r1.1.2.29 sr_data.m
--- sr_data.m	27 Jun 2004 10:45:27 -0000	1.1.2.29
+++ sr_data.m	29 Jun 2004 05:00:26 -0000
@@ -126,9 +126,7 @@
 	% Rename the reuse condition given a map from FromVars, to
 	% ToVars.
 :- pred reuse_condition_rename(map(prog_var, prog_var)::in, 
-		reuse_condition::in, reuse_condition::out) is det.
-
-:- pred reuse_condition_rename_types(term__substitution(tvar_type)::in, 
+		maybe(substitution(tvar_type))::in, 
 		reuse_condition::in, reuse_condition::out) is det.
 
 	% Print the reuse-condition.
@@ -156,15 +154,12 @@
 :- pred memo_reuse_equal(memo_reuse::in, memo_reuse::in) is semidet.
 :- pred memo_reuse_init(memo_reuse::out) is det.
 :- pred memo_reuse_top(memo_reuse::in) is semidet.
-:- pred memo_reuse_rename(proc_info::in, list(prog_var)::in, 
+:- pred memo_reuse_rename(map(prog_var, prog_var)::in, 
+		maybe(substitution(tvar_type))::in, 
 		memo_reuse::in, memo_reuse::out) is det.
-:- pred memo_reuse_rename(map(prog_var, prog_var)::in, memo_reuse::in,
-		memo_reuse::out) is det.
 	% memo_reuse_rename_types(FromTypes, ToTypes, Memo0, Memo).
 	% Rename all the types occurring in the memo_reuse from FromTypes, 
 	% to ToTypes.
-:- pred memo_reuse_rename_types(list((type))::in, list((type))::in, 
-		memo_reuse::in, memo_reuse::out) is det.
 :- pred memo_reuse_print(memo_reuse::in, sym_name::in, proc_info::in,
 		pred_info::in, io__state::di, io__state::uo) is det.
 :- pred memo_reuse_print_dump(memo_reuse::in, proc_info::in, 
@@ -301,14 +296,14 @@
 		Condition = condition(Nodes_set, LUiHVs, LAiHVs)
 	).
 
-reuse_condition_rename(Dict, Cin, Cout) :- 
+reuse_condition_rename(Dict, MaybeSubst, Cin, Cout) :- 
 	(
 		Cin = condition(Nodes, LUiH, LAiH)
 	->
 		% rename the nodes:
 		set__to_sorted_list(Nodes, NodesList), 
 		list__map(
-			pa_datastruct__rename(Dict),
+			pa_datastruct__rename(Dict, MaybeSubst),
 			NodesList,
 			RenNodesList),
 		% rename the datastructures
@@ -319,34 +314,13 @@
 			ListRenLUiH),
 		set__list_to_set(ListRenLUiH, RenLUiH),
 		% rename the alias
-		pa_alias_as__rename(Dict, LAiH, RenLAiH),
+		pa_alias_as__rename(Dict, MaybeSubst, LAiH, RenLAiH),
 		set__list_to_set(RenNodesList, RenNodes),
 		Cout = condition(RenNodes, RenLUiH, RenLAiH)
 	;
 		Cout = Cin
 	).
 
-reuse_condition_rename_types(Subst, Cond0, Cond):-
-	(
-		Cond0 = condition(Nodes0, LUiH0, LAiH0),
-		% rename the selectors of the nodes
-		set__to_sorted_list(Nodes0, NodesList0), 
-		list__map(
-			pa_datastruct__rename_types(Subst), 
-			NodesList0, 
-			NodesList), 
-		set__list_to_set(NodesList, Nodes), 
-		% LUiH needs no renaming:
-		LUiH = LUiH0, 
-		% rename the selector of the local aliases
-		pa_alias_as__rename_types(Subst, LAiH0, LAiH), 
-		% combine the whole stuff
-		Cond = condition(Nodes, LUiH, LAiH)
-	;
-		Cond0 = always, 
-		Cond = always
-	).
-
 reuse_condition_print(_, _, always) -->
 	io__write_string("always").
 reuse_condition_print(ProcInfo, PredInfo, condition(Nodes, LUiH, LAiH)) -->
@@ -508,44 +482,22 @@
 memo_reuse_init(no).
 memo_reuse_top(no).
 
-memo_reuse_rename(ProcInfo, ActualVars, MEMOin, MEMOout):- 
-	proc_info_headvars(ProcInfo, FormalVars),
-	map__from_corresponding_lists(FormalVars, ActualVars, Dict),
-	memo_reuse_rename(Dict, MEMOin, MEMOout).
+% memo_reuse_rename(ProcInfo, ActualVars, MEMOin, MEMOout):- 
+	% proc_info_headvars(ProcInfo, FormalVars),
+	% map__from_corresponding_lists(FormalVars, ActualVars, Dict),
+	% memo_reuse_rename(Dict, MEMOin, MEMOout).
 
-memo_reuse_rename(Dict, Memo0, Memo) :- 
+memo_reuse_rename(Dict, MaybeSubst, Memo0, Memo) :- 
 	(
 		Memo0 = yes(Cond0)
 	->
 		list__map(
-			reuse_condition_rename(Dict), 
+			reuse_condition_rename(Dict, MaybeSubst), 
 			Cond0, 
 			Cond),
 		Memo = yes(Cond)
 	;
 		Memo = Memo0
-	).
-
-memo_reuse_rename_types(FromTypes, ToTypes, Memo0, Memo) :-
-	assoc_list__from_corresponding_lists(FromTypes, ToTypes, 
-				FromToTypes), 
-	list__foldl(pa_sr_util__rename_type_det, FromToTypes, 
-			map__init, Substitution), 
-	memo_reuse_rename_types_2(Substitution, Memo0, Memo). 
-
-:- pred memo_reuse_rename_types_2(term__substitution(tvar_type)::in, 
-		memo_reuse::in, memo_reuse::out) is det.
-memo_reuse_rename_types_2(Subst, Memo0, Memo) :- 
-	(
-		Memo0 = yes(Conditions0),
-		list__map(
-			reuse_condition_rename_types(Subst), 
-			Conditions0, 
-			Conditions), 
-		Memo = yes(Conditions)
-	;
-		Memo0 = no, 
-		Memo = no
 	).
 
 memo_reuse_print(MemoReuse, Name, ProcInfo, PredInfo) --> 
Index: sr_indirect.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/sr_indirect.m,v
retrieving revision 1.1.2.33
diff -u -r1.1.2.33 sr_indirect.m
--- sr_indirect.m	24 Jun 2004 06:05:10 -0000	1.1.2.33
+++ sr_indirect.m	29 Jun 2004 05:00:26 -0000
@@ -568,11 +568,12 @@
 		Info = Info0, 
 		YesNo = no
 	;
-		memo_reuse_rename(ProcInfo0, ActualVars, FormalMemo, 
-					Memo0), 
-		pred_info_arg_types(PredInfo, FormalTypes) ,
-		memo_reuse_rename_types(FormalTypes, ActualTypes, 
-					Memo0, Memo),
+		proc_info_headvars(ProcInfo0, FormalVars), 
+		pred_info_arg_types(PredInfo, FormalTypes),
+		memo_reuse_rename(
+			map__from_corresponding_lists(FormalVars, ActualVars),
+			yes(to_type_renaming(FormalTypes, ActualTypes)), 
+			FormalMemo, Memo), 
 		% 3. compute the Live variables upon a procedure entry:
 		% 3.a. compute the full live set at the program point of
 		%      the call.
Index: sr_top.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Attic/sr_top.m,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 sr_top.m
--- sr_top.m	24 Jun 2004 06:05:10 -0000	1.1.2.4
+++ sr_top.m	29 Jun 2004 05:00:27 -0000
@@ -163,19 +163,15 @@
 			PredId, ProcId, Module0),
 
 			% rename the headvars: 
-		maybe_write_string(VeryVerbose, "Renaming HeadVars..."),
+		maybe_write_string(VeryVerbose, "Renaming HeadVars/Types..."),
 		{ proc_info_headvars(ProcInfo0, ProcHeadVars) }, 
 		{ list__map(term__coerce_var, HeadVars, CHVars) },
 		{ map__from_corresponding_lists(CHVars, ProcHeadVars,
 			MapHeadVars) }, 
-		{ sr_data__memo_reuse_rename(MapHeadVars, Reuse, Reuse1) },
-		maybe_write_string(VeryVerbose, "done.\n"),
-	
-		% rename the types: 
-		maybe_write_string(VeryVerbose, "Renaming Types..."),
 		{ pred_info_arg_types(PredInfo0, ArgTypes) },
-		{ sr_data__memo_reuse_rename_types(Types, ArgTypes, 
-			Reuse1, Reuse2) },
+		{ sr_data__memo_reuse_rename(MapHeadVars, 
+			yes(to_type_renaming(Types, ArgTypes)), 
+			Reuse, Reuse2) },
 		maybe_write_string(VeryVerbose, "done.\n"),
 
 		% create the reuse-version of the procedure


-- 
nancy.mazur at cs.kuleuven.ac.be ------------ Katholieke Universiteit Leuven -
tel: +32-16-327596 - fax: +32-16-327996 ------- Dept. of Computer Science -
--------------------------------------------------------------------------
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