diff (use of map__set)

Zoltan Somogyi zs at cs.mu.oz.au
Mon Apr 7 13:41:34 AEST 1997


Replace calls to map__set with calls to either map__det_insert or
map__det_update. In some cases this required a small amount of code
reorganization.

Zoltan.

cvs diff: Diffing compiler
Index: compiler/arg_info.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/arg_info.m,v
retrieving revision 1.20
diff -u -r1.20 arg_info.m
--- arg_info.m	1996/11/22 08:32:07	1.20
+++ arg_info.m	1997/04/06 13:29:15
@@ -80,9 +80,9 @@
 	generate_proc_arg_info(ProcInfo0, Method, ArgTypes, ModuleInfo0,
 		ProcInfo),
 
-	map__set(ProcTable0, ProcId, ProcInfo, ProcTable),
+	map__det_update(ProcTable0, ProcId, ProcInfo, ProcTable),
 	pred_info_set_procedures(PredInfo0, ProcTable, PredInfo),
-	map__set(PredTable0, PredId, PredInfo, PredTable),
+	map__det_update(PredTable0, PredId, PredInfo, PredTable),
 	module_info_set_preds(ModuleInfo0, PredTable, ModuleInfo1),
 
 	generate_proc_list_arg_info(PredId, ProcIds, Method,
Index: compiler/atsort.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/atsort.m,v
retrieving revision 1.7
diff -u -r1.7 atsort.m
--- atsort.m	1995/08/02 07:52:36	1.7
+++ atsort.m	1997/04/06 13:29:17
@@ -266,7 +266,7 @@
 atsort__map_delete_this_element([Node | Nodes], Elt, Map0, Map) :-
 	( map__search(Map0, Node, List0) ->
 		list__delete_all(List0, Elt, List1),
-		map__set(Map0, Node, List1, Map1)
+		map__det_update(Map0, Node, List1, Map1)
 	;
 		Map1 = Map0
 	),
Index: compiler/clause_to_proc.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/clause_to_proc.m,v
retrieving revision 1.13
diff -u -r1.13 clause_to_proc.m
--- clause_to_proc.m	1997/02/23 06:05:24	1.13
+++ clause_to_proc.m	1997/04/06 13:29:18
@@ -54,7 +54,7 @@
 maybe_add_default_modes([PredId | PredIds], Preds0, Preds) :-
 	map__lookup(Preds0, PredId, PredInfo0),
 	maybe_add_default_mode(PredInfo0, PredInfo),
-	map__set(Preds0, PredId, PredInfo, Preds1),
+	map__det_update(Preds0, PredId, PredInfo, Preds1),
 	maybe_add_default_modes(PredIds, Preds1, Preds).
 
 maybe_add_default_mode(PredInfo0, PredInfo) :-
@@ -125,7 +125,7 @@
 copy_clauses_to_procs_2([ProcId | ProcIds], ClausesInfo, Procs0, Procs) :-
 	map__lookup(Procs0, ProcId, Proc0),
 	copy_clauses_to_proc(ProcId, ClausesInfo, Proc0, Proc),
-	map__set(Procs0, ProcId, Proc, Procs1),
+	map__det_update(Procs0, ProcId, Proc, Procs1),
 	copy_clauses_to_procs_2(ProcIds, ClausesInfo, Procs1, Procs).
 
 copy_clauses_to_proc(ProcId, ClausesInfo, Proc0, Proc) :-
Index: compiler/code_exprn.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/code_exprn.m,v
retrieving revision 1.46
diff -u -r1.46 code_exprn.m
--- code_exprn.m	1997/02/13 23:57:16	1.46
+++ code_exprn.m	1997/04/06 13:29:19
@@ -237,11 +237,12 @@
 	(
 		map__search(Vars0, V, evaled(Vals0))
 	->
-		set__insert(Vals0, L, Vals)
+		set__insert(Vals0, L, Vals),
+		map__det_update(Vars0, V, evaled(Vals), Vars1)
 	;
-		set__singleton_set(Vals, L)
+		set__singleton_set(Vals, L),
+		map__det_insert(Vars0, V, evaled(Vals), Vars1)
 	),
-	map__set(Vars0, V, evaled(Vals), Vars1),
 	(
 		L = lval(Loc),
 		Loc = reg(_, _)
@@ -925,18 +926,17 @@
 		{ string__append("code_exprn__cache_exprn: existing definition of variable ", Name, Msg) },
 		{ error(Msg) }
 	;
-		[]
-	),
-	code_exprn__add_rval_reg_dependencies(Rval),
-	(
-		{ exprn_aux__vars_in_rval(Rval, []) }
-	->
-		{ set__singleton_set(Rvals, Rval) },
-		{ map__set(Vars0, Var, evaled(Rvals), Vars) }
-	;
-		{ map__set(Vars0, Var, cached(Rval), Vars) }
-	),
-	code_exprn__set_vars(Vars).
+		code_exprn__add_rval_reg_dependencies(Rval),
+		(
+			{ exprn_aux__vars_in_rval(Rval, []) }
+		->
+			{ set__singleton_set(Rvals, Rval) },
+			{ map__det_insert(Vars0, Var, evaled(Rvals), Vars) }
+		;
+			{ map__det_insert(Vars0, Var, cached(Rval), Vars) }
+		),
+		code_exprn__set_vars(Vars)
+	).
 
 %------------------------------------------------------------------------------%
 
@@ -977,7 +977,7 @@
 			% but we do need to reserve the registers
 			% needed to access Lval
 		code_exprn__add_lval_reg_dependencies(Lval),
-		{ map__set(Vars0, Var, Stat0, Vars) },
+		{ map__det_update(Vars0, Var, Stat0, Vars) },
 		code_exprn__set_vars(Vars),
 		{ Code = empty }
 	;
Index: compiler/common.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/common.m,v
retrieving revision 1.37
diff -u -r1.37 common.m
--- common.m	1997/02/23 06:05:38	1.37
+++ common.m	1997/04/06 13:29:19
@@ -494,7 +494,7 @@
 		;
 			goal_info_get_context(GoalInfo, Context),
 			ThisCall = call_args(Context, InputArgs, OutputArgs),
-			map__set(SeenCalls0, SeenCall,
+			map__det_update(SeenCalls0, SeenCall,
 				[ThisCall | SeenCallsList0], SeenCalls),
 			CommonInfo = common(Eqv0, Structs0,
 				Structs1, SeenCalls),
@@ -504,7 +504,7 @@
 	;
 		goal_info_get_context(GoalInfo, Context),
 		ThisCall = call_args(Context, InputArgs, OutputArgs),
-		map__set(SeenCalls0, SeenCall, [ThisCall], SeenCalls),
+		map__det_insert(SeenCalls0, SeenCall, [ThisCall], SeenCalls),
 		CommonInfo = common(Eqv0, Structs0, Structs1, SeenCalls),
 		Goal = Goal0,
 		Info3 = Info0
Index: compiler/cse_detection.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/cse_detection.m,v
retrieving revision 1.40
diff -u -r1.40 cse_detection.m
--- cse_detection.m	1997/02/23 06:05:43	1.40
+++ cse_detection.m	1997/04/06 13:29:20
@@ -157,9 +157,9 @@
 		proc_info_set_variables(ProcInfo1, Varset, ProcInfo2),
 		proc_info_set_vartypes(ProcInfo2, VarTypes, ProcInfo),
 
-		map__set(ProcTable0, ProcId, ProcInfo, ProcTable),
+		map__det_update(ProcTable0, ProcId, ProcInfo, ProcTable),
 		pred_info_set_procedures(PredInfo0, ProcTable, PredInfo),
-		map__set(PredTable0, PredId, PredInfo, PredTable),
+		map__det_update(PredTable0, PredId, PredInfo, PredTable),
 		module_info_set_preds(ModuleInfo0, PredTable, ModuleInfo)
 	).
 
Index: compiler/dead_proc_elim.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/dead_proc_elim.m,v
retrieving revision 1.25
diff -u -r1.25 dead_proc_elim.m
--- dead_proc_elim.m	1997/03/06 05:08:59	1.25
+++ dead_proc_elim.m	1997/04/06 13:29:21
@@ -370,7 +370,8 @@
 	( proc(PredId, ProcId) = CurrProc ->
 		% if it's reachable and recursive, then we can't
 		% eliminate or inline it
-		NewNotation = no
+		NewNotation = no,
+		map__set(Needed0, proc(PredId, ProcId), NewNotation, Needed)
 	; map__search(Needed0, proc(PredId, ProcId), OldNotation) ->
 		(
 			OldNotation = no,
@@ -379,11 +380,13 @@
 			OldNotation = yes(Count0),
 			Count is Count0 + 1,
 			NewNotation = yes(Count)
-		)
+		),
+		map__det_update(Needed0, proc(PredId, ProcId), NewNotation,
+			Needed)
 	;
-		NewNotation = yes(1)
-	),
-	map__set(Needed0, proc(PredId, ProcId), NewNotation, Needed).
+		NewNotation = yes(1),
+		map__set(Needed0, proc(PredId, ProcId), NewNotation, Needed)
+	).
 dead_proc_elim__examine_expr(pragma_c_code(_, _, PredId, ProcId, _, _, _),
 		_CurrProc, Queue0, Queue, Needed0, Needed) :-
 	queue__put(Queue0, proc(PredId, ProcId), Queue),
Index: compiler/det_analysis.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/det_analysis.m,v
retrieving revision 1.112
diff -u -r1.112 det_analysis.m
--- det_analysis.m	1997/02/23 06:05:55	1.112
+++ det_analysis.m	1997/04/06 13:29:22
@@ -258,9 +258,9 @@
 	proc_info_set_inferred_determinism(Proc1, Detism, Proc),
 
 		%  Put back the new proc_info structure.
-	map__set(Procs0, ProcId, Proc, Procs),
+	map__det_update(Procs0, ProcId, Proc, Procs),
 	pred_info_set_procedures(Pred0, Procs, Pred),
-	map__set(Preds0, PredId, Pred, Preds),
+	map__det_update(Preds0, PredId, Pred, Preds),
 	module_info_set_preds(ModuleInfo0, Preds, ModuleInfo).
 
 %-----------------------------------------------------------------------------%
Index: compiler/dnf.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/dnf.m,v
retrieving revision 1.17
diff -u -r1.17 dnf.m
--- dnf.m	1997/02/23 06:06:09	1.17
+++ dnf.m	1997/04/06 13:29:23
@@ -114,7 +114,7 @@
 	list__delete_all(Markers1, request(dnf), Markers2),
 	pred_info_set_marker_list(PredInfo1, [done(dnf) | Markers2], PredInfo),
 
-	map__set(PredTable1, PredId, PredInfo, PredTable),
+	map__det_update(PredTable1, PredId, PredInfo, PredTable),
 	module_info_set_preds(ModuleInfo1, PredTable, ModuleInfo).
 
 :- pred dnf__transform_procs(list(proc_id)::in, pred_id::in,
@@ -133,12 +133,12 @@
 	dnf__transform_proc(ProcInfo1, PredInfo0, MaybeNonAtomic,
 		ModuleInfo0, ModuleInfo1, ProcInfo, NewPredIds0, NewPredIds1),
 
-	map__set(ProcTable0, ProcId, ProcInfo, ProcTable),
+	map__det_update(ProcTable0, ProcId, ProcInfo, ProcTable),
 	pred_info_set_procedures(PredInfo0, ProcTable, PredInfo),
 	% We must look up the pred table again
 	% since dnf__transform_proc may have added new predicates
 	module_info_preds(ModuleInfo1, PredTable1),
-	map__set(PredTable1, PredId, PredInfo, PredTable),
+	map__det_update(PredTable1, PredId, PredInfo, PredTable),
 	module_info_set_preds(ModuleInfo1, PredTable, ModuleInfo2),
 
 	dnf__transform_procs(ProcIds, PredId, MaybeNonAtomic,
Index: compiler/excess.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/excess.m,v
retrieving revision 1.19
diff -u -r1.19 excess.m
--- excess.m	1997/02/23 06:06:16	1.19
+++ excess.m	1997/04/06 13:29:23
@@ -163,7 +163,7 @@
 		)
 	->
 		map__init(Subn0),
-		map__set(Subn0, LocalVar, ReplacementVar, Subn),
+		map__det_insert(Subn0, LocalVar, ReplacementVar, Subn),
 		goal_util__rename_vars_in_goals(Goals0, no, Subn, Goals1),
 		goal_util__rename_vars_in_goals(RevGoals0, no, Subn, RevGoals1),
 		ElimVars1 = [LocalVar | ElimVars0]
Index: compiler/fact_table.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/fact_table.m,v
retrieving revision 1.4
diff -u -r1.4 fact_table.m
--- fact_table.m	1997/03/06 05:09:02	1.4
+++ fact_table.m	1997/04/06 13:29:25
@@ -876,7 +876,7 @@
 	->
 		proc_info_set_inferred_determinism(ProcInfo0, Determinism, 
 			ProcInfo),
-		map__set(ProcTable0, ProcID, ProcInfo, ProcTable1)
+		map__det_update(ProcTable0, ProcID, ProcInfo, ProcTable1)
 	;
 		ProcTable1 = ProcTable0
 	},
@@ -1165,7 +1165,7 @@
 	),
 	{ proc_info_set_inferred_determinism(ProcInfo0, Determinism, 
 	    ProcInfo)},
-	{ map__set(ProcTable0, ProcID, ProcInfo, ProcTable1) },
+	{ map__det_update(ProcTable0, ProcID, ProcInfo, ProcTable1) },
 	infer_determinism_pass_2(ProcStreams, ProcFiles, ExistsAllInMode,
 		ProcTable1, ProcTable).
 
Index: compiler/follow_vars.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/follow_vars.m,v
retrieving revision 1.39
diff -u -r1.39 follow_vars.m
--- follow_vars.m	1997/02/23 06:06:23	1.39
+++ follow_vars.m	1997/04/06 13:29:25
@@ -70,7 +70,7 @@
 	(
 		Mode = top_out
 	->
-		map__set(Follow0, Var, Reg, Follow1)
+		map__det_insert(Follow0, Var, Reg, Follow1)
 	;
 		Follow0 = Follow1
 	),
Index: compiler/frameopt.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/frameopt.m,v
retrieving revision 1.55
diff -u -r1.55 frameopt.m
--- frameopt.m	1997/01/15 01:10:17	1.55
+++ frameopt.m	1997/04/06 13:29:26
@@ -592,7 +592,7 @@
 	),
 	BlockInfo = block_info(BlockLabel, BlockInstrs, SideLabels,
 		MaybeFallThrough, Type),
-	map__set(BlockMap0, Label, BlockInfo, BlockMap1),
+	map__det_update(BlockMap0, Label, BlockInfo, BlockMap1),
 	analyze_block_map_2(Labels, BlockMap1, FirstLabel, BlockMap,
 		KeepFrame1, KeepFrame).
 
@@ -697,7 +697,7 @@
 			Instrs),
 		BlockInfo = block_info(Label, Instrs, [SecondLabel], no,
 			ordinary(yes)),
-		map__set(BlockMap0, Label, BlockInfo, BlockMap1)
+		map__det_update(BlockMap0, Label, BlockInfo, BlockMap1)
 	;
 		BlockMap1 = BlockMap0
 	),
@@ -871,7 +871,7 @@
 rev_map_side_labels([Label | Labels], SourceLabel, RevMap0, RevMap) :-
 	( map__search(RevMap0, Label, OtherSources0) ->
 		OtherSources = [SourceLabel | OtherSources0],
-		map__set(RevMap0, Label, OtherSources, RevMap1)
+		map__det_update(RevMap0, Label, OtherSources, RevMap1)
 	;
 		OtherSources = [SourceLabel],
 		map__det_insert(RevMap0, Label, OtherSources, RevMap1)
@@ -985,7 +985,8 @@
 		;
 			BlockInfo = block_info(Label0, [LabelInstr],
 				SideLabels0, MaybeFallThrough0, ordinary(no)),
-			map__set(BlockMap0, Label0, BlockInfo, BlockMap1),
+			map__det_update(BlockMap0, Label0, BlockInfo,
+				BlockMap1),
 			process_frame_delay(Labels0, BlockMap1,
 				ParMap0, FallIntoParallel0, FramedLabels,
 				FrameSize, Msg, ProcLabel, N0,
Index: compiler/goal_util.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/goal_util.m,v
retrieving revision 1.34
diff -u -r1.34 goal_util.m
--- goal_util.m	1997/02/23 06:06:25	1.34
+++ goal_util.m	1997/04/06 13:29:27
@@ -102,7 +102,7 @@
 		;
 			Varset2 = Varset1
 		),
-		map__set(Subn0, V, NV, Subn1),
+		map__det_insert(Subn0, V, NV, Subn1),
 		(
 			map__search(OldVarTypes, V, VT)
 		->
Index: compiler/higher_order.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/higher_order.m,v
retrieving revision 1.24
diff -u -r1.24 higher_order.m
--- higher_order.m	1997/03/03 05:50:48	1.24
+++ higher_order.m	1997/04/06 13:29:28
@@ -512,8 +512,8 @@
 				PredVars = PredVars0
 			)
 		;
-			map__set(PredVars0, LVar, yes(PredId, ProcId, Args),
-								PredVars)
+			map__det_insert(PredVars0, LVar,
+				yes(PredId, ProcId, Args), PredVars)
 		)
 	;
 		PredVars = PredVars0	
@@ -769,7 +769,8 @@
 		create_new_pred(Request, NewPred, NextHOid0, NextHOid1,
 						Module0, Module1, IO0, IO1),
 		set__singleton_set(SpecVersions0, NewPred),
-		map__set(NewPreds0, CalledPredProcId, SpecVersions0, NewPreds1)
+		map__det_insert(NewPreds0, CalledPredProcId, SpecVersions0,
+			NewPreds1)
 	),
 	create_new_preds(Requests, NewPreds1, NewPreds, PredsToFix1, PredsToFix,
 			NextHOid1, NextHOid, Module1, Module, IO1, IO).
Index: compiler/hlds_module.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/hlds_module.m,v
retrieving revision 1.19
diff -u -r1.19 hlds_module.m
--- hlds_module.m	1997/04/02 05:28:14	1.19
+++ hlds_module.m	1997/04/06 13:29:29
@@ -1349,29 +1349,38 @@
 
 			% insert the pred_id into the pred name index
 		( map__search(Pred_N_Index0, Name, N_PredIdList0) ->
-			N_PredIdList = [PredId | N_PredIdList0]
-		;
-			N_PredIdList = [PredId]
+			N_PredIdList = [PredId | N_PredIdList0],
+			map__det_update(Pred_N_Index0, Name, N_PredIdList,
+				Pred_N_Index)
+		;
+			N_PredIdList = [PredId],
+			map__det_insert(Pred_N_Index0, Name, N_PredIdList,
+				Pred_N_Index)
 		),
-		map__set(Pred_N_Index0, Name, N_PredIdList, Pred_N_Index),
 
 			% insert it into the pred name/arity index
 		NA = Name / Arity,
 		( map__search(Pred_NA_Index0, NA, NA_PredIdList0) ->
-			NA_PredIdList = [PredId | NA_PredIdList0]
-		;
-			NA_PredIdList = [PredId]
+			NA_PredIdList = [PredId | NA_PredIdList0],
+			map__det_update(Pred_NA_Index0, NA, NA_PredIdList,	
+				Pred_NA_Index)
+		;
+			NA_PredIdList = [PredId],
+			map__det_insert(Pred_NA_Index0, NA, NA_PredIdList,	
+				Pred_NA_Index)
 		),
-		map__set(Pred_NA_Index0, NA, NA_PredIdList, Pred_NA_Index),
 
 			% insert it into the pred module:name/arity index
 		MNA = module_name_arity(Module, Name, Arity),
 		( map__search(Pred_MNA_Index0, MNA, MNA_PredIdList0) ->
-			MNA_PredIdList = [PredId | MNA_PredIdList0]
-		;
-			MNA_PredIdList = [PredId]
+			MNA_PredIdList = [PredId | MNA_PredIdList0],
+			map__det_update(Pred_MNA_Index0, MNA, MNA_PredIdList,
+				Pred_MNA_Index)
+		;
+			MNA_PredIdList = [PredId],
+			map__det_insert(Pred_MNA_Index0, MNA, MNA_PredIdList,
+				Pred_MNA_Index)
 		),
-		map__set(Pred_MNA_Index0, MNA, MNA_PredIdList, Pred_MNA_Index),
 
 		Func_N_Index = Func_N_Index0,
 		Func_NA_Index = Func_NA_Index0,
@@ -1381,30 +1390,39 @@
 
 			% insert the pred_id into the func name index
 		( map__search(Func_N_Index0, Name, N_PredIdList0) ->
-			N_PredIdList = [PredId | N_PredIdList0]
-		;
-			N_PredIdList = [PredId]
+			N_PredIdList = [PredId | N_PredIdList0],
+			map__det_update(Func_N_Index0, Name, N_PredIdList,
+				Func_N_Index)
+		;
+			N_PredIdList = [PredId],
+			map__det_insert(Func_N_Index0, Name, N_PredIdList,
+				Func_N_Index)
 		),
-		map__set(Func_N_Index0, Name, N_PredIdList, Func_N_Index),
 
 			% insert it into the func name/arity index
 		FuncArity is Arity - 1,
 		NA = Name / FuncArity,
 		( map__search(Func_NA_Index0, NA, NA_PredIdList0) ->
-			NA_PredIdList = [PredId | NA_PredIdList0]
-		;
-			NA_PredIdList = [PredId]
+			NA_PredIdList = [PredId | NA_PredIdList0],
+			map__det_update(Func_NA_Index0, NA, NA_PredIdList,
+				Func_NA_Index)
+		;
+			NA_PredIdList = [PredId],
+			map__det_insert(Func_NA_Index0, NA, NA_PredIdList,
+				Func_NA_Index)
 		),
-		map__set(Func_NA_Index0, NA, NA_PredIdList, Func_NA_Index),
 
 			% insert it into the func module:name/arity index
 		MNA = module_name_arity(Module, Name, FuncArity),
 		( map__search(Func_MNA_Index0, MNA, MNA_PredIdList0) ->
-			MNA_PredIdList = [PredId | MNA_PredIdList0]
-		;
-			MNA_PredIdList = [PredId]
+			MNA_PredIdList = [PredId | MNA_PredIdList0],
+			map__det_update(Func_MNA_Index0, MNA, MNA_PredIdList,
+				Func_MNA_Index)
+		;
+			MNA_PredIdList = [PredId],
+			map__det_insert(Func_MNA_Index0, MNA, MNA_PredIdList,
+				Func_MNA_Index)
 		),
-		map__set(Func_MNA_Index0, MNA, MNA_PredIdList, Func_MNA_Index),
 
 		Pred_N_Index = Pred_N_Index0,
 		Pred_NA_Index = Pred_NA_Index0,
@@ -1415,7 +1433,7 @@
 	PredIds = [PredId | PredIds0],
 
 		% save the pred_info for this pred_id
-	map__set(Preds0, PredId, PredInfo, Preds),
+	map__det_insert(Preds0, PredId, PredInfo, Preds),
 
 	PredicateTable = predicate_table(Preds, NextPredId, PredIds,
 				Pred_N_Index, Pred_NA_Index, Pred_MNA_Index,
Index: compiler/hlds_pred.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/hlds_pred.m,v
retrieving revision 1.27
diff -u -r1.27 hlds_pred.m
--- hlds_pred.m	1997/03/06 05:09:08	1.27
+++ hlds_pred.m	1997/04/06 13:29:30
@@ -411,7 +411,7 @@
 	map__init(Procs0),
 	proc_info_declared_determinism(ProcInfo, MaybeDetism),
 	next_mode_id(Procs0, MaybeDetism, ProcId),
-	map__set(Procs0, ProcId, ProcInfo, Procs),
+	map__det_insert(Procs0, ProcId, ProcInfo, Procs),
 	list__length(Types, Arity),
 	proc_info_variables(ProcInfo, VarSet),
 	proc_info_vartypes(ProcInfo, VarTypes),
Index: compiler/inlining.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/inlining.m,v
retrieving revision 1.59
diff -u -r1.59 inlining.m
--- inlining.m	1997/03/06 05:09:09	1.59
+++ inlining.m	1997/04/06 13:29:30
@@ -317,9 +317,9 @@
 	proc_info_set_vartypes(ProcInfo1, VarTypes, ProcInfo2),
 	proc_info_set_goal(ProcInfo2, Goal, ProcInfo),
 
-	map__set(ProcTable0, ProcId, ProcInfo, ProcTable),
+	map__det_update(ProcTable0, ProcId, ProcInfo, ProcTable),
 	pred_info_set_procedures(PredInfo0, ProcTable, PredInfo),
-	map__set(PredTable0, PredId, PredInfo, PredTable),
+	map__det_update(PredTable0, PredId, PredInfo, PredTable),
 	module_info_set_preds(ModuleInfo0, PredTable, ModuleInfo).
 
 %-----------------------------------------------------------------------------%
Index: compiler/jumpopt.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/jumpopt.m,v
retrieving revision 1.38
diff -u -r1.38 jumpopt.m
--- jumpopt.m	1997/01/18 05:26:13	1.38
+++ jumpopt.m	1997/04/06 13:29:31
@@ -136,7 +136,7 @@
 		Instr = label(Label),
 		opt_util__is_forkproceed_next(Instrs, Sdprocmap, Between)
 	->
-		map__set(Forkmap0, Label, Between, Forkmap1)
+		map__det_insert(Forkmap0, Label, Between, Forkmap1)
 	;
 		Forkmap1 = Forkmap0
 	),
Index: compiler/lambda.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/lambda.m,v
retrieving revision 1.24
diff -u -r1.24 lambda.m
--- lambda.m	1997/02/23 06:06:43	1.24
+++ lambda.m	1997/04/06 13:29:32
@@ -97,10 +97,10 @@
 					ProcInfo, PredInfo1, ModuleInfo1),
 
 	pred_info_procedures(PredInfo1, ProcTable1),
-	map__set(ProcTable1, ProcId, ProcInfo, ProcTable),
+	map__det_update(ProcTable1, ProcId, ProcInfo, ProcTable),
 	pred_info_set_procedures(PredInfo1, ProcTable, PredInfo),
 	module_info_preds(ModuleInfo1, PredTable1),
-	map__set(PredTable1, PredId, PredInfo, PredTable),
+	map__det_update(PredTable1, PredId, PredInfo, PredTable),
 	module_info_set_preds(ModuleInfo1, PredTable, ModuleInfo).
 
 :- pred lambda__process_proc_2(proc_info, pred_info, module_info,
Index: compiler/live_vars.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/live_vars.m,v
retrieving revision 1.61
diff -u -r1.61 live_vars.m
--- live_vars.m	1997/02/23 06:06:46	1.61
+++ live_vars.m	1997/04/06 13:29:33
@@ -552,7 +552,7 @@
 
 allocate_same_stack_slot([], _Slot, StackSlots, StackSlots).
 allocate_same_stack_slot([Var | Vars], Slot, StackSlots0, StackSlots) :-
-	map__set(StackSlots0, Var, Slot, StackSlots1),
+	map__det_insert(StackSlots0, Var, Slot, StackSlots1),
 	allocate_same_stack_slot(Vars, Slot, StackSlots1, StackSlots).
 
 %-----------------------------------------------------------------------------%
Index: compiler/make_hlds.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/make_hlds.m,v
retrieving revision 1.225
diff -u -r1.225 make_hlds.m
--- make_hlds.m	1997/03/06 05:09:22	1.225
+++ make_hlds.m	1997/04/06 13:29:34
@@ -560,7 +560,7 @@
 	module_info_preds(Module0, Preds0),
 	map__lookup(Preds0, PredId, PredInfo0),
 	pred_info_mark_as_external(PredInfo0, PredInfo),
-	map__set(Preds0, PredId, PredInfo, Preds),
+	map__det_update(Preds0, PredId, PredInfo, Preds),
 	module_info_set_preds(Module0, Preds, Module1),
 	module_mark_preds_as_external(PredIds, Module1, Module).
 
@@ -697,9 +697,10 @@
 		Status = Status1 
 	},
 	{ hlds_data__set_type_defn(TVarSet, Args, Body, Status, Context, T) },
+	{ TypeId = Name - Arity },
 	(
 		% if there was an existing non-abstract definition for the type
-		{ map__search(Types0, Name - Arity, T2) },
+		{ map__search(Types0, TypeId, T2) },
 		{ hlds_data__get_type_defn_tparams(T2, Params) },
 		{ hlds_data__get_type_defn_body(T2, Body_2) },
 		{ hlds_data__get_type_defn_context(T2, OrigContext) },
@@ -718,8 +719,7 @@
 			;
 				hlds_data__set_type_defn(TVarSet, Params,
 					Body_2, OrigStatus, OrigContext, T3),
-				TypeId = Name - Arity,
-				map__set(Types0, TypeId, T3, Types),
+				map__det_update(Types0, TypeId, T3, Types),
 				module_info_set_types(Module0, Types, Module)
 			}
 		;
@@ -735,7 +735,6 @@
 				OrigContext)
 		)
 	;
-		{ TypeId = Name - Arity },
 		{ map__set(Types0, TypeId, T, Types) },
 		(
 			{ Body = du_type(ConsList, _, _) }
@@ -852,6 +851,7 @@
 
 :- pred add_abstract_export(module_info, type, type_id, module_info).
 :- mode add_abstract_export(in, in, in, out) is det.
+
 add_abstract_export(Module0, Type, TypeId, Module) :-
 	module_info_shape_info(Module0, Shape_Info0),
 	Shape_Info0 = shape_info(Shapes, Abs_Exports0, SpecialPredShapes),
@@ -929,10 +929,10 @@
 			map__search(Ctors1, UnqualifiedConsId,
 				UnqualifiedConsDefns)
 		->
-			map__set(Ctors1, UnqualifiedConsId,
+			map__det_update(Ctors1, UnqualifiedConsId,
 				[ConsDefn | UnqualifiedConsDefns], Ctors2)
 		;
-			map__set(Ctors1, UnqualifiedConsId, 
+			map__det_insert(Ctors1, UnqualifiedConsId, 
 				[ConsDefn], Ctors2)
 		)
 	;
@@ -1057,7 +1057,8 @@
 					PredInfo0, PredInfo) },
 				{ predicate_table_get_preds(PredicateTable1,
 					Preds1) },
-				{ map__set(Preds1, PredId, PredInfo, Preds) },
+				{ map__det_update(Preds1, PredId, PredInfo,
+					Preds) },
 				{ predicate_table_set_preds(PredicateTable1,
 					Preds, PredicateTable) }
 			;
@@ -1171,7 +1172,7 @@
 	unify_proc__generate_clause_info(SpecialPredId, Type, TypeBody,
 				Module1, ClausesInfo),
 	pred_info_set_clauses_info(PredInfo1, ClausesInfo, PredInfo),
-	map__set(Preds0, PredId, PredInfo, Preds),
+	map__det_update(Preds0, PredId, PredInfo, Preds),
 	module_info_set_preds(Module1, Preds, Module).
 
 :- pred add_special_pred_decl_list(list(special_pred_id),
@@ -1253,7 +1254,7 @@
 	next_mode_id(Procs0, MaybeDet, ModeId),
 	proc_info_init(Arity, ArgModes, MaybeArgLives, MaybeDet, Context,
 			NewProc),
-	map__set(Procs0, ModeId, NewProc, Procs),
+	map__det_insert(Procs0, ModeId, NewProc, Procs),
 	pred_info_set_procedures(PredInfo0, Procs, PredInfo).
 
 %-----------------------------------------------------------------------------%
@@ -1328,7 +1329,7 @@
 	{ ArgLives = no },
 	{ add_new_proc(PredInfo0, Arity, Modes, ArgLives, MaybeDet, MContext,
 			PredInfo, _) },
-	{ map__set(Preds0, PredId, PredInfo, Preds) },
+	{ map__det_update(Preds0, PredId, PredInfo, Preds) },
 	{ predicate_table_set_preds(PredicateTable1, Preds, PredicateTable) },
 	{ module_info_set_predicate_table(ModuleInfo0, PredicateTable,
 		ModuleInfo) }.
@@ -1546,7 +1547,7 @@
 		;
 			PredInfo = PredInfo5
 		),
-		map__set(Preds0, PredId, PredInfo, Preds),
+		map__det_update(Preds0, PredId, PredInfo, Preds),
 		predicate_table_set_preds(PredicateTable1, Preds,
 			PredicateTable),
 		module_info_set_predicate_table(ModuleInfo0, PredicateTable,
@@ -1678,7 +1679,7 @@
 				PredInfo2) },
 			{ pred_info_set_goal_type(PredInfo2, pragmas, 
 				PredInfo) },
-			{ map__set(Preds0, PredId, PredInfo, Preds) },
+			{ map__det_update(Preds0, PredId, PredInfo, Preds) },
 			{ predicate_table_set_preds(PredicateTable1, Preds, 
 				PredicateTable) },
 			{ module_info_set_predicate_table(ModuleInfo0, 
@@ -1746,7 +1747,7 @@
 	pred_info_get_marker_list(PredInfo0, MarkerList0),
 	pragma_set_markers_2(Markers, MarkerList0, MarkerList),
 	pred_info_set_marker_list(PredInfo0, MarkerList, PredInfo),
-	map__set(PredTable0, PredId, PredInfo, PredTable1),
+	map__det_update(PredTable0, PredId, PredInfo, PredTable1),
 	pragma_set_markers(PredTable1, PredIds, Markers, PredTable).
 
 :- pred pragma_set_markers_2(list(marker_status), list(marker_status),
@@ -2939,7 +2940,7 @@
 			{ VarTypes = VarTypes0 }
 		)
 	;
-		{ map__set(VarTypes0, Var, Type, VarTypes) }
+		{ map__det_insert(VarTypes0, Var, Type, VarTypes) }
 	).
 
 	% Add new type variables for those introduced by a type qualification.
Index: compiler/modules.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/modules.m,v
retrieving revision 1.32
diff -u -r1.32 modules.m
--- modules.m	1997/02/28 05:30:35	1.32
+++ modules.m	1997/04/06 13:29:35
@@ -1114,7 +1114,7 @@
 	;
 		read_dependencies(Module, Search, IntDeps, ImplDeps, FactDeps, 
 				Error),
-		{ map__set(DepsMap0, Module, 
+		{ map__det_insert(DepsMap0, Module, 
 		    deps(no, Error, IntDeps, ImplDeps, FactDeps), DepsMap) },
 		{ Done = no }
 	).
Index: compiler/passes_aux.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/passes_aux.m,v
retrieving revision 1.16
diff -u -r1.16 passes_aux.m
--- passes_aux.m	1997/03/05 07:11:05	1.16
+++ passes_aux.m	1997/04/06 13:29:35
@@ -189,9 +189,9 @@
 		State9 = State0
 	),
 
-	map__set(Procs0, ProcId, Proc, Procs),
+	map__det_update(Procs0, ProcId, Proc, Procs),
 	pred_info_set_procedures(Pred0, Procs, Pred),
-	map__set(Preds0, PredId, Pred, Preds),
+	map__det_update(Preds0, PredId, Pred, Preds),
 	module_info_set_preds(ModuleInfo8, Preds, ModuleInfo9),
 
 	process_nonimported_procs(ProcIds, PredId, Task1, Task,
Index: compiler/polymorphism.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/polymorphism.m,v
retrieving revision 1.100
diff -u -r1.100 polymorphism.m
--- polymorphism.m	1997/03/06 05:09:46	1.100
+++ polymorphism.m	1997/04/06 13:29:36
@@ -278,10 +278,10 @@
 					ProcInfo, PredInfo1, ModuleInfo1),
 
 	pred_info_procedures(PredInfo1, ProcTable1),
-	map__set(ProcTable1, ProcId, ProcInfo, ProcTable),
+	map__det_update(ProcTable1, ProcId, ProcInfo, ProcTable),
 	pred_info_set_procedures(PredInfo1, ProcTable, PredInfo),
 	module_info_preds(ModuleInfo1, PredTable1),
-	map__set(PredTable1, PredId, PredInfo, PredTable),
+	map__det_update(PredTable1, PredId, PredInfo, PredTable),
 	module_info_set_preds(ModuleInfo1, PredTable, ModuleInfo2),
 
 	polymorphism__process_procs(PredId, ProcIds, ModuleInfo2, ModuleInfo).
@@ -306,7 +306,7 @@
 	map__lookup(PredTable0, PredId, PredInfo0),
 	pred_info_procedures(PredInfo0, ProcTable0),
 	pred_info_procids(PredInfo0, ProcIds),
-	( ProcIds = [ProcId|_] ->
+	( ProcIds = [ProcId | _] ->
 		map__lookup(ProcTable0, ProcId, ProcInfo),
 		proc_info_vartypes(ProcInfo, VarTypes),
 		proc_info_headvars(ProcInfo, HeadVars),
@@ -327,7 +327,7 @@
 
 		pred_info_set_arg_types(PredInfo0, TypeVarSet, ArgTypes,
 			PredInfo),
-		map__set(PredTable0, PredId, PredInfo, PredTable),
+		map__det_update(PredTable0, PredId, PredInfo, PredTable),
 		module_info_set_preds(ModuleInfo0, PredTable, ModuleInfo1),
 		polymorphism__fixup_preds(PredIds, ModuleInfo1, ModuleInfo)
 	;
Index: compiler/shapes.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/shapes.m,v
retrieving revision 1.40
diff -u -r1.40 shapes.m
--- shapes.m	1997/03/06 05:09:50	1.40
+++ shapes.m	1997/04/06 13:29:37
@@ -168,11 +168,12 @@
 	% Avoid infinite recursion by inserting a 'dummy' shape
 	% so that if the shape is self-referential, it doesn't
 	% cause trouble.
-		map__set(S_Tab0, ShapeId, num(Next_S_Num0) - quad(constant,
-			constant, constant, constant), S_Tab1),
+		map__det_insert(S_Tab0, ShapeId, num(Next_S_Num0) -
+			quad(constant, constant, constant, constant), S_Tab1),
 		shapes__create_shape(Type_Table, ShapeId, Shape,
 			S_Tab1 - Next_S_Num1, S_Tab2 - NextNum),
-		map__set(S_Tab2, ShapeId, num(Next_S_Num0) - Shape, S_Tab)
+		map__det_update(S_Tab2, ShapeId, num(Next_S_Num0) - Shape,
+			S_Tab)
 	).
 
 shapes__do_abstract_exports(HLDS0, HLDS) :-
Index: compiler/simplify.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/simplify.m,v
retrieving revision 1.27
diff -u -r1.27 simplify.m
--- simplify.m	1997/03/24 06:02:23	1.27
+++ simplify.m	1997/04/06 13:29:38
@@ -878,7 +878,7 @@
 	->
 		GoalNeeded = no,
 		map__init(Subn0),
-		map__set(Subn0, LocalVar, ReplacementVar, Subn),
+		map__det_insert(Subn0, LocalVar, ReplacementVar, Subn),
 		goal_util__rename_vars_in_goals(Goals0, no,
 			Subn, Goals),
 		goal_util__rename_vars_in_goals(RevGoals0, no,
Index: compiler/store_alloc.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/store_alloc.m,v
retrieving revision 1.49
diff -u -r1.49 store_alloc.m
--- store_alloc.m	1997/02/23 06:08:02	1.49
+++ store_alloc.m	1997/04/06 13:29:39
@@ -301,7 +301,7 @@
 	->
 		next_free_reg(N0, SeenLvals0, N1),
 		FinalLval = reg(r, N1),
-		map__set(StoreMap0, Var, FinalLval, StoreMap1)
+		map__det_update(StoreMap0, Var, FinalLval, StoreMap1)
 	;
 		N1 = N0,
 		FinalLval = Lval,
@@ -324,7 +324,7 @@
 		SeenLvals1 = SeenLvals0
 	;
 		next_free_reg(N0, SeenLvals0, N1),
-		map__set(StoreMap0, Var, reg(r, N1), StoreMap1),
+		map__det_insert(StoreMap0, Var, reg(r, N1), StoreMap1),
 		set__insert(SeenLvals0, reg(r, N1), SeenLvals1)
 	),
 	store_alloc_allocate_extras(Vars, N1, SeenLvals1, StoreMap1, StoreMap).
Index: compiler/string_switch.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/string_switch.m,v
retrieving revision 1.20
diff -u -r1.20 string_switch.m
--- string_switch.m	1996/12/31 09:58:47	1.20
+++ string_switch.m	1997/04/06 13:29:40
@@ -143,9 +143,9 @@
 	string__hash(String, HashVal0),
 	HashVal is HashVal0 /\ HashMask,
 	( map__search(Map0, HashVal, CaseList0) ->
-		map__set(Map0, HashVal, [Case | CaseList0], Map)
+		map__det_update(Map0, HashVal, [Case | CaseList0], Map)
 	;
-		map__set(Map0, HashVal, [Case], Map)
+		map__det_insert(Map0, HashVal, [Case], Map)
 	).
 
 :- type hash_slot ---> hash_slot(extended_case, int).
@@ -175,12 +175,12 @@
 :- mode string_switch__calc_hash_slots_1(in, in, in, in, out, out) is det.
 
 string_switch__calc_hash_slots_1([], _, Map, LastUsed, Map, LastUsed).
-string_switch__calc_hash_slots_1([HashVal-Cases | Rest], HashMap, Map0, LastUsed0,
-		Map, LastUsed) :-
-	string_switch__calc_hash_slots_2(Cases, HashVal, HashMap, Map0, LastUsed0,
-		Map1, LastUsed1),
-	string_switch__calc_hash_slots_1(Rest, HashMap, Map1, LastUsed1,
-		Map, LastUsed).
+string_switch__calc_hash_slots_1([HashVal-Cases | Rest], HashMap, Map0,
+		LastUsed0, Map, LastUsed) :-
+	string_switch__calc_hash_slots_2(Cases, HashVal, HashMap, Map0,
+		LastUsed0, Map1, LastUsed1),
+	string_switch__calc_hash_slots_1(Rest, HashMap, Map1,
+		LastUsed1, Map, LastUsed).
 
 :- pred string_switch__calc_hash_slots_2(cases_list, int, map(int, cases_list),
 	map(int, hash_slot), int, map(int, hash_slot), int).
@@ -188,19 +188,21 @@
 
 string_switch__calc_hash_slots_2([], _HashVal, _HashMap, Map, LastUsed,
 		Map, LastUsed).
-string_switch__calc_hash_slots_2([Case | Cases], HashVal, HashMap, Map0, LastUsed0,
-		Map, LastUsed) :-
-	string_switch__calc_hash_slots_2(Cases, HashVal, HashMap, Map0, LastUsed0,
-		Map1, LastUsed1),
+string_switch__calc_hash_slots_2([Case | Cases], HashVal, HashMap, Map0,
+		LastUsed0, Map, LastUsed) :-
+	string_switch__calc_hash_slots_2(Cases, HashVal, HashMap, Map0,
+		LastUsed0, Map1, LastUsed1),
 	( map__contains(Map1, HashVal) ->
 		string_switch__follow_hash_chain(Map1, HashVal, ChainEnd),
-		string_switch__next_free_hash_slot(Map1, HashMap, LastUsed1, Next),
+		string_switch__next_free_hash_slot(Map1, HashMap, LastUsed1,
+			Next),
 		map__lookup(Map1, ChainEnd, hash_slot(PrevCase, _)),
-		map__set(Map1, ChainEnd, hash_slot(PrevCase, Next), Map2),
-		map__set(Map2, Next, hash_slot(Case, -1), Map),
+		map__det_update(Map1, ChainEnd, hash_slot(PrevCase, Next),
+			Map2),
+		map__det_insert(Map2, Next, hash_slot(Case, -1), Map),
 		LastUsed = Next
 	;
-		map__set(Map1, HashVal, hash_slot(Case, -1), Map),
+		map__det_insert(Map1, HashVal, hash_slot(Case, -1), Map),
 		LastUsed = LastUsed1
 	).
 
Index: compiler/switch_detection.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/switch_detection.m,v
retrieving revision 1.66
diff -u -r1.66 switch_detection.m
--- switch_detection.m	1997/02/23 06:08:08	1.66
+++ switch_detection.m	1997/04/06 13:29:40
@@ -86,9 +86,9 @@
 	detect_switches_in_goal(Goal0, InstMap0, VarTypes, ModuleInfo0, Goal),
 
 	proc_info_set_goal(ProcInfo0, Goal, ProcInfo),
-	map__set(ProcTable0, ProcId, ProcInfo, ProcTable),
+	map__det_update(ProcTable0, ProcId, ProcInfo, ProcTable),
 	pred_info_set_procedures(PredInfo0, ProcTable, PredInfo),
-	map__set(PredTable0, PredId, PredInfo, PredTable),
+	map__det_update(PredTable0, PredId, PredInfo, PredTable),
 	module_info_set_preds(ModuleInfo0, PredTable, ModuleInfo).
 
 %-----------------------------------------------------------------------------%
@@ -343,11 +343,12 @@
 		Left1 = Left0,
 		conj_list_to_goal(ConjList, GoalInfo, Goal),
 		( map__search(Cases0, Functor, DisjList0) ->
-			DisjList1 = [Goal | DisjList0]
+			DisjList1 = [Goal | DisjList0],
+			map__det_update(Cases0, Functor, DisjList1, Cases1)
 		;
-			DisjList1 = [Goal]
-		),
-		map__set(Cases0, Functor, DisjList1, Cases1)
+			DisjList1 = [Goal],
+			map__det_insert(Cases0, Functor, DisjList1, Cases1)
+		)
 	;
 		MaybeFunctor = no,
 		Left1 = [Goal0 | Left0],
Index: compiler/tag_switch.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/tag_switch.m,v
retrieving revision 1.33
diff -u -r1.33 tag_switch.m
--- tag_switch.m	1997/03/27 03:29:12	1.33
+++ tag_switch.m	1997/04/06 13:29:41
@@ -835,7 +835,7 @@
 		( map__search(PtagCountMap0, Primary, _) ->
 			error("simple tag is shared")
 		;
-			map__set(PtagCountMap0, Primary, none - (-1),
+			map__det_insert(PtagCountMap0, Primary, none - (-1),
 				PtagCountMap1)
 		)
 	; ConsTag = complicated_tag(Primary, Secondary) ->
@@ -848,11 +848,11 @@
 				error("remote tag is shared with non-remote")
 			),
 			int__max(Secondary, MaxSoFar, Max),
-			map__set(PtagCountMap0, Primary, remote - Max,
+			map__det_update(PtagCountMap0, Primary, remote - Max,
 				PtagCountMap1)
 		;
-			map__set(PtagCountMap0, Primary, remote - Secondary,
-				PtagCountMap1)
+			map__det_insert(PtagCountMap0, Primary,
+				remote - Secondary, PtagCountMap1)
 		)
 	; ConsTag = complicated_constant_tag(Primary, Secondary) ->
 		int__max(MaxPrimary0, Primary, MaxPrimary1),
@@ -864,11 +864,11 @@
 				error("local tag is shared with non-local")
 			),
 			int__max(Secondary, MaxSoFar, Max),
-			map__set(PtagCountMap0, Primary, local - Max,
+			map__det_update(PtagCountMap0, Primary, local - Max,
 				PtagCountMap1)
 		;
-			map__set(PtagCountMap0, Primary, local - Secondary,
-				PtagCountMap1)
+			map__det_insert(PtagCountMap0, Primary,
+				local - Secondary, PtagCountMap1)
 		)
 	;
 		error("non-du tag in tag_switch__get_ptag_counts_2")
@@ -892,12 +892,11 @@
 		( map__search(PtagCaseMap0, Primary, _Group) ->
 			error("simple tag is shared")
 		;
-			true
-		),
-		map__init(StagGoalMap0),
-		map__set(StagGoalMap0, -1, Goal, StagGoalMap),
-		map__set(PtagCaseMap0, Primary, none - StagGoalMap,
-			PtagCaseMap1)
+			map__init(StagGoalMap0),
+			map__det_insert(StagGoalMap0, -1, Goal, StagGoalMap),
+			map__det_insert(PtagCaseMap0, Primary,
+				none - StagGoalMap, PtagCaseMap1)
+		)
 	; Tag = complicated_tag(Primary, Secondary) ->
 		( map__search(PtagCaseMap0, Primary, Group) ->
 			Group = StagLoc - StagGoalMap0,
@@ -905,13 +904,18 @@
 				true
 			;
 				error("remote tag is shared with non-remote")
-			)
+			),
+			map__det_insert(StagGoalMap0, Secondary, Goal,
+				StagGoalMap),
+			map__det_update(PtagCaseMap0, Primary,
+				remote - StagGoalMap, PtagCaseMap1)
 		;
-			map__init(StagGoalMap0)
-		),
-		map__set(StagGoalMap0, Secondary, Goal, StagGoalMap),
-		map__set(PtagCaseMap0, Primary, remote - StagGoalMap,
-			PtagCaseMap1)
+			map__init(StagGoalMap0),
+			map__det_insert(StagGoalMap0, Secondary, Goal,
+				StagGoalMap),
+			map__det_insert(PtagCaseMap0, Primary,
+				remote - StagGoalMap, PtagCaseMap1)
+		)
 	; Tag = complicated_constant_tag(Primary, Secondary) ->
 		( map__search(PtagCaseMap0, Primary, Group) ->
 			Group = StagLoc - StagGoalMap0,
@@ -919,13 +923,18 @@
 				true
 			;
 				error("local tag is shared with non-local")
-			)
+			),
+			map__det_insert(StagGoalMap0, Secondary, Goal,
+				StagGoalMap),
+			map__det_update(PtagCaseMap0, Primary,
+				local - StagGoalMap, PtagCaseMap1)
 		;
-			map__init(StagGoalMap0)
-		),
-		map__set(StagGoalMap0, Secondary, Goal, StagGoalMap),
-		map__set(PtagCaseMap0, Primary, local - StagGoalMap,
-			PtagCaseMap1)
+			map__init(StagGoalMap0),
+			map__det_insert(StagGoalMap0, Secondary, Goal,
+				StagGoalMap),
+			map__det_insert(PtagCaseMap0, Primary,
+				local - StagGoalMap, PtagCaseMap1)
+		)
 	;
 		error("non-du tag in tag_switch__group_cases_by_ptag")
 	),
Index: compiler/type_util.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/type_util.m,v
retrieving revision 1.39
diff -u -r1.39 type_util.m
--- type_util.m	1997/02/23 06:08:21	1.39
+++ type_util.m	1997/04/06 13:29:42
@@ -434,7 +434,7 @@
 				Bindings = Bindings0
 			;
 				\+ term__occurs(SubstBindingOfX, Y, Bindings0),
-				map__set(Bindings0, Y, SubstBindingOfX,
+				map__det_insert(Bindings0, Y, SubstBindingOfX,
 					Bindings)
 			)
 		)
@@ -447,7 +447,7 @@
 				Bindings = Bindings0
 			;
 				\+ term__occurs(SubstBindingOfY, X, Bindings0),
-				map__set(Bindings0, X, SubstBindingOfY,
+				map__det_insert(Bindings0, X, SubstBindingOfY,
 					Bindings)
 			)
 		;
@@ -456,7 +456,7 @@
 			( X = Y ->
 				Bindings = Bindings0
 			; 
-				map__set(Bindings0, X, term__variable(Y),
+				map__det_insert(Bindings0, X, term__variable(Y),
 					Bindings)
 			)
 		)
@@ -472,7 +472,7 @@
 	;
 		\+ term__occurs_list(As, X, Bindings0),
 		\+ list__member(X, HeadTypeParams),
-		map__set(Bindings0, X, term__functor(F, As, C), Bindings)
+		map__det_insert(Bindings0, X, term__functor(F, As, C), Bindings)
 	).
 
 type_unify(term__functor(F, As, C), term__variable(X), HeadTypeParams,
@@ -485,7 +485,7 @@
 	;
 		\+ term__occurs_list(As, X, Bindings0),
 		\+ list__member(X, HeadTypeParams),
-		map__set(Bindings0, X, term__functor(F, As, C), Bindings)
+		map__det_insert(Bindings0, X, term__functor(F, As, C), Bindings)
 	).
 
 type_unify(term__functor(FX, AsX, _CX), term__functor(FY, AsY, _CY),
@@ -562,7 +562,7 @@
 			Bindings = Bindings0
 		;
 			\+ list__member(Var, HeadTypeParams),
-			map__set(Bindings0, Var, term__variable(HeadVar),
+			map__det_insert(Bindings0, Var, term__variable(HeadVar),
 				Bindings)
 		)
 	).
Index: compiler/typecheck.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/typecheck.m,v
retrieving revision 1.191
diff -u -r1.191 typecheck.m
--- typecheck.m	1997/03/23 19:01:11	1.191
+++ typecheck.m	1997/04/06 13:29:43
@@ -249,7 +249,7 @@
 		{
 			MaybePredInfo = yes(PredInfo1),
 			Error1 = Error0,
-			map__set(Preds0, PredId, PredInfo1, Preds),
+			map__det_update(Preds0, PredId, PredInfo1, Preds),
 			module_info_set_preds(ModuleInfo0, Preds, ModuleInfo1)
 		;
 			MaybePredInfo = no,
@@ -1129,7 +1129,7 @@
 		    ArgTypeAssignSet = ArgTypeAssignSet0
 		)
 	    ;
-		map__set(VarTypes0, VarId, Type, VarTypes),
+		map__det_insert(VarTypes0, VarId, Type, VarTypes),
 		type_assign_set_var_types(TypeAssign0, VarTypes, TypeAssign),
 		ArgTypeAssignSet = [TypeAssign - ArgTypes | ArgTypeAssignSet0]
 	    )
@@ -1281,7 +1281,7 @@
 			TypeAssignSet = TypeAssignSet0
 		)
 	;
-		map__set(VarTypes0, VarId, Type, VarTypes),
+		map__det_insert(VarTypes0, VarId, Type, VarTypes),
 		type_assign_set_var_types(TypeAssign0, VarTypes, TypeAssign),
 		TypeAssignSet = [TypeAssign | TypeAssignSet0]
 	).
@@ -1670,7 +1670,7 @@
 		;
 			% Y is a fresh variable which hasn't been
 			% assigned a type yet
-			map__set(VarTypes0, Y, TypeX, VarTypes),
+			map__det_insert(VarTypes0, Y, TypeX, VarTypes),
 			type_assign_set_var_types(TypeAssign0, VarTypes,
 				TypeAssign),
 			TypeAssignSet = [TypeAssign | TypeAssignSet0]
@@ -1681,7 +1681,7 @@
 		->
 			% X is a fresh variable which hasn't been
 			% assigned a type yet
-			map__set(VarTypes0, X, TypeY, VarTypes),
+			map__det_insert(VarTypes0, X, TypeY, VarTypes),
 			type_assign_set_var_types(TypeAssign0, VarTypes,
 				TypeAssign),
 			TypeAssignSet = [TypeAssign | TypeAssignSet0]
@@ -1694,8 +1694,8 @@
 			type_assign_set_typevarset(TypeAssign0, TypeVarSet,
 				TypeAssign1),
 			Type = term__variable(TypeVar),
-			map__set(VarTypes0, X, Type, VarTypes1),
-			map__set(VarTypes1, Y, Type, VarTypes),
+			map__det_insert(VarTypes0, X, Type, VarTypes1),
+			map__det_insert(VarTypes1, Y, Type, VarTypes),
 			type_assign_set_var_types(TypeAssign1, VarTypes,
 				TypeAssign),
 			TypeAssignSet = [TypeAssign | TypeAssignSet0]
@@ -1729,7 +1729,7 @@
 			TypeAssignSet = TypeAssignSet0
 		)
 	;
-		map__set(VarTypes0, Y, ConsType, VarTypes),
+		map__det_insert(VarTypes0, Y, ConsType, VarTypes),
 		type_assign_set_var_types(TypeAssign1, VarTypes, TypeAssign3),
 		TypeAssignSet = [TypeAssign3 - ArgTypes | TypeAssignSet0]
 	).
@@ -2295,7 +2295,7 @@
 expand_types([Var | Vars], TypeSubst, VarTypes0, VarTypes) :-
 	map__lookup(VarTypes0, Var, Type0),
 	term__apply_rec_substitution(Type0, TypeSubst, Type),
-	map__set(VarTypes0, Var, Type, VarTypes1),
+	map__det_update(VarTypes0, Var, Type, VarTypes1),
 	expand_types(Vars, TypeSubst, VarTypes1, VarTypes).
 
 %-----------------------------------------------------------------------------%
Index: compiler/unify_proc.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/unify_proc.m,v
retrieving revision 1.54
diff -u -r1.54 unify_proc.m
--- unify_proc.m	1997/03/06 05:09:52	1.54
+++ unify_proc.m	1997/04/06 13:29:44
@@ -235,9 +235,9 @@
 		proc_info_set_can_process(ProcInfo0, no, ProcInfo1),
 
 		copy_clauses_to_proc(ProcId, ClausesInfo, ProcInfo1, ProcInfo2),
-		map__set(Procs1, ProcId, ProcInfo2, Procs2),
+		map__det_update(Procs1, ProcId, ProcInfo2, Procs2),
 		pred_info_set_procedures(PredInfo1, Procs2, PredInfo2),
-		map__set(Preds0, PredId, PredInfo2, Preds2),
+		map__det_update(Preds0, PredId, PredInfo2, Preds2),
 		module_info_set_preds(ModuleInfo0, Preds2, ModuleInfo2),
 
 		%
@@ -330,9 +330,9 @@
 	pred_info_procedures(PredInfo0, Procs0),
 	map__lookup(Procs0, ProcId, ProcInfo0),
 	proc_info_set_can_process(ProcInfo0, yes, ProcInfo1),
-	map__set(Procs0, ProcId, ProcInfo1, Procs1),
+	map__det_update(Procs0, ProcId, ProcInfo1, Procs1),
 	pred_info_set_procedures(PredInfo0, Procs1, PredInfo1),
-	map__set(Preds0, PredId, PredInfo1, Preds1),
+	map__det_update(Preds0, PredId, PredInfo1, Preds1),
 	module_info_set_preds(ModuleInfo0, Preds1, ModuleInfo1)
 	},
 
@@ -1368,7 +1368,7 @@
 		unify_proc_info(VarSet0, Types0, ModuleInfo),
 		unify_proc_info(VarSet, Types, ModuleInfo)) :-
 	varset__new_var(VarSet0, Var, VarSet),
-	map__set(Types0, Var, Type, Types).
+	map__det_insert(Types0, Var, Type, Types).
 
 unify_proc__info_extract(unify_proc_info(VarSet, Types, _ModuleInfo),
 			VarSet, Types).
Index: compiler/unused_args.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/unused_args.m,v
retrieving revision 1.27
diff -u -r1.27 unused_args.m
--- unused_args.m	1997/03/06 05:09:54	1.27
+++ unused_args.m	1997/04/06 13:29:45
@@ -323,7 +323,7 @@
 		VarInf0 = unused(VarDep0, ArgDep),
 		set__insert_list(VarDep0, Aliases, VarDep),
 		VarInf = unused(VarDep, ArgDep),
-		map__set(UseInf0, Var, VarInf, UseInf)
+		map__det_update(UseInf0, Var, VarInf, UseInf)
 	;
 		UseInf = UseInf0
 	).
Index: compiler/vn_order.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/vn_order.m,v
retrieving revision 1.38
diff -u -r1.38 vn_order.m
--- vn_order.m	1997/01/25 11:44:04	1.38
+++ vn_order.m	1997/04/06 13:29:46
@@ -698,26 +698,26 @@
 	;
 		( map__search(Succmap0, Source, Sinks0) ->
 			vn_order__insert_if_not_there(Sink, Sinks0, Sinks1),
-			map__set(Succmap0, Source, Sinks1, Succmap1)
+			map__det_update(Succmap0, Source, Sinks1, Succmap1)
 		;
-			map__set(Succmap0, Source, [Sink], Succmap1)
+			map__det_insert(Succmap0, Source, [Sink], Succmap1)
 		),
-		( map__search(Succmap0, Sink, _) ->
+		( map__search(Succmap1, Sink, _) ->
 			Succmap = Succmap1
 		;
-			map__set(Succmap1, Sink, [], Succmap)
+			map__det_insert(Succmap1, Sink, [], Succmap)
 		),
 		( map__search(Predmap0, Sink, Sources0) ->
 			vn_order__insert_if_not_there(Source,
 				Sources0, Sources1),
-			map__set(Predmap0, Sink, Sources1, Predmap1)
+			map__det_update(Predmap0, Sink, Sources1, Predmap1)
 		;
-			map__set(Predmap0, Sink, [Source], Predmap1)
+			map__det_insert(Predmap0, Sink, [Source], Predmap1)
 		),
-		( map__search(Predmap0, Source, _) ->
+		( map__search(Predmap1, Source, _) ->
 			Predmap = Predmap1
 		;
-			map__set(Predmap1, Source, [], Predmap)
+			map__det_insert(Predmap1, Source, [], Predmap)
 		)
 	).
 
@@ -743,12 +743,12 @@
 	( map__search(Succmap0, Node, _) ->
 		Succmap = Succmap0
 	;
-		map__set(Succmap0, Node, [], Succmap)
+		map__det_insert(Succmap0, Node, [], Succmap)
 	),
 	( map__search(Predmap0, Node, _) ->
 		Predmap = Predmap0
 	;
-		map__set(Predmap0, Node, [], Predmap)
+		map__det_insert(Predmap0, Node, [], Predmap)
 	).
 
 %-----------------------------------------------------------------------------%
Index: compiler/vn_table.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/vn_table.m,v
retrieving revision 1.13
diff -u -r1.13 vn_table.m
--- vn_table.m	1997/02/24 06:43:04	1.13
+++ vn_table.m	1997/04/06 13:29:47
@@ -325,7 +325,7 @@
 	;
 		Uses1 = [NewUse | Uses0]
 	),
-	map__set(Vn_to_uses_table0, Vn, Uses1, Vn_to_uses_table1),
+	map__det_update(Vn_to_uses_table0, Vn, Uses1, Vn_to_uses_table1),
 	VnTables = vn_tables(NextVn0,
 		Lval_to_vn_table0, Rval_to_vn_table0,
 		Vn_to_rval_table0, Vn_to_uses_table1,
@@ -350,7 +350,7 @@
 		% src_liveval for a shared vn
 		Uses1 = Uses0
 	),
-	map__set(Vn_to_uses_table0, Vn, Uses1, Vn_to_uses_table1),
+	map__det_update(Vn_to_uses_table0, Vn, Uses1, Vn_to_uses_table1),
 	VnTables = vn_tables(NextVn0,
 		Lval_to_vn_table0, Rval_to_vn_table0,
 		Vn_to_rval_table0, Vn_to_uses_table1,
@@ -423,7 +423,8 @@
 		Vn_to_rval_table0, Vn_to_uses_table0,
 		Vn_to_locs_table0, Loc_to_vn_table0),
 	( map__search(Loc_to_vn_table0, Vnlval, _) ->
-		map__set(Lval_to_vn_table0, Vnlval, Vn, Lval_to_vn_table1),
+		map__det_update(Lval_to_vn_table0, Vnlval, Vn,
+			Lval_to_vn_table1),
 		VnTables = vn_tables(NextVn0,
 			Lval_to_vn_table1, Rval_to_vn_table0,
 			Vn_to_rval_table0, Vn_to_uses_table0,
@@ -455,27 +456,30 @@
 	( map__search(Loc_to_vn_table0, Vnlval, OldVn) ->
 
 		% change the forward mapping
-		map__set(Loc_to_vn_table0, Vnlval, Vn, Loc_to_vn_table1),
+		map__det_update(Loc_to_vn_table0, Vnlval, Vn, Loc_to_vn_table1),
 
 		% change the reverse mapping, first for old vn, then the new
 		map__lookup(Vn_to_locs_table0, OldVn, OldLocs0),
 		list__delete_all(OldLocs0, Vnlval, OldLocs1),
-		map__set(Vn_to_locs_table0, OldVn, OldLocs1, Vn_to_locs_table1),
+		map__det_update(Vn_to_locs_table0, OldVn, OldLocs1,
+			Vn_to_locs_table1),
 
-		map__lookup(Vn_to_locs_table0, Vn, NewLocs0),
+		map__lookup(Vn_to_locs_table1, Vn, NewLocs0),
 		list__append(NewLocs0, [Vnlval], NewLocs1),
-		map__set(Vn_to_locs_table1, Vn, NewLocs1, Vn_to_locs_table2)
+		map__det_update(Vn_to_locs_table1, Vn, NewLocs1,
+			Vn_to_locs_table2)
 	;
 		% The search in the condition can fail for newly introduced
 		% templocs
 
 		% change the forward mapping
-		map__set(Loc_to_vn_table0, Vnlval, Vn, Loc_to_vn_table1),
+		map__det_insert(Loc_to_vn_table0, Vnlval, Vn, Loc_to_vn_table1),
 
 		% change the reverse mapping
 		map__lookup(Vn_to_locs_table0, Vn, NewLocs0),
 		list__append(NewLocs0, [Vnlval], NewLocs1),
-		map__set(Vn_to_locs_table0, Vn, NewLocs1, Vn_to_locs_table2)
+		map__det_update(Vn_to_locs_table0, Vn, NewLocs1,
+			Vn_to_locs_table2)
 	),
 	VnTables = vn_tables(NextVn0,
 		Lval_to_vn_table0, Rval_to_vn_table0,
cvs diff: Diffing compiler/notes



More information about the developers mailing list