[m-rev.] diff: misc module cleanups

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed May 4 17:41:51 AEST 2005


compiler/exprn_aux.m:
	Use state variables to represent substitution counts.

compiler/unify_gen.m:
	Switch to four-space indentation to avoid lots of code being squeezed
	against the right margin. Make other changes to conform to our coding
	standards.

compiler/var_locn.m:
	Make comments conform to our coding standards.

Zoltan.

cvs diff: Diffing .
Index: exprn_aux.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/exprn_aux.m,v
retrieving revision 1.55
diff -u -b -r1.55 exprn_aux.m
--- exprn_aux.m	24 Mar 2005 02:00:24 -0000	1.55
+++ exprn_aux.m	3 May 2005 07:40:37 -0000
@@ -327,165 +327,154 @@
 	exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval, Rval0, Rval,
 		0, _SubstCount).
 
-exprn_aux__substitute_lval_in_instr(OldLval, NewLval, Instr0, Instr, N0, N) :-
+exprn_aux__substitute_lval_in_instr(OldLval, NewLval, Instr0, Instr, !N) :-
 	Instr0 = Uinstr0 - Comment,
 	exprn_aux__substitute_lval_in_uinstr(OldLval, NewLval,
-		Uinstr0, Uinstr, N0, N),
+		Uinstr0, Uinstr, !N),
 	Instr = Uinstr - Comment.
 
 :- pred exprn_aux__substitute_lval_in_uinstr(lval::in, lval::in,
 	instr::in, instr::out, int::in, int::out) is det.
 
-exprn_aux__substitute_lval_in_uinstr(OldLval, NewLval, Uinstr0, Uinstr, N0, N)
-		:-
+exprn_aux__substitute_lval_in_uinstr(OldLval, NewLval, Uinstr0, Uinstr, !N) :-
 	(
 		Uinstr0 = comment(_Comment),
-		Uinstr = Uinstr0,
-		N = N0
+		Uinstr = Uinstr0
 	;
 		Uinstr0 = livevals(LvalSet0),
 		set__to_sorted_list(LvalSet0, Lvals0),
 		list__map_foldl(
 			exprn_aux__substitute_lval_in_lval_count(OldLval,
 				NewLval),
-			Lvals0, Lvals, N0, N),
+			Lvals0, Lvals, !N),
 		set__list_to_set(Lvals, LvalSet),
 		Uinstr = livevals(LvalSet)
 	;
 		Uinstr0 = block(TempR, TempF, Instrs0),
 		list__map_foldl(
 			exprn_aux__substitute_lval_in_instr(OldLval, NewLval),
-			Instrs0, Instrs, N0, N),
+			Instrs0, Instrs, !N),
 		Uinstr = block(TempR, TempF, Instrs)
 	;
 		Uinstr0 = assign(Lval0, Rval0),
 		exprn_aux__substitute_lval_in_lval_count(OldLval, NewLval,
-			Lval0, Lval, N0, N1),
+			Lval0, Lval, !N),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval0, Rval, N1, N),
+			Rval0, Rval, !N),
 		Uinstr = assign(Lval, Rval)
 	;
 		Uinstr0 = call(_, _, _, _, _, _),
-		Uinstr = Uinstr0,
-		N = N0
+		Uinstr = Uinstr0
 	;
 		Uinstr0 = mkframe(_, _),
-		Uinstr = Uinstr0,
-		N = N0
+		Uinstr = Uinstr0
 	;
 		Uinstr0 = label(_),
-		Uinstr = Uinstr0,
-		N = N0
+		Uinstr = Uinstr0
 	;
 		Uinstr0 = goto(_),
-		Uinstr = Uinstr0,
-		N = N0
+		Uinstr = Uinstr0
 	;
 		Uinstr0 = computed_goto(Rval0, Labels),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval0, Rval, N0, N),
+			Rval0, Rval, !N),
 		Uinstr = computed_goto(Rval, Labels)
 	;
 		Uinstr0 = c_code(Code, LiveLvals0),
 		exprn_aux__substitute_lval_in_live_lval_info(OldLval, NewLval,
-			LiveLvals0, LiveLvals, N0, N),
+			LiveLvals0, LiveLvals, !N),
 		Uinstr = c_code(Code, LiveLvals)
 	;
 		Uinstr0 = if_val(Rval0, CodeAddr),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval0, Rval, N0, N),
+			Rval0, Rval, !N),
 		Uinstr = if_val(Rval, CodeAddr)
 	;
 		Uinstr0 = incr_hp(Lval0, MaybeTag, MO, Rval0, TypeCtor),
 		exprn_aux__substitute_lval_in_lval_count(OldLval, NewLval,
-			Lval0, Lval, N0, N1),
+			Lval0, Lval, !N),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval0, Rval, N1, N),
+			Rval0, Rval, !N),
 		Uinstr = incr_hp(Lval, MaybeTag, MO, Rval, TypeCtor)
 	;
 		Uinstr0 = mark_hp(Lval0),
 		exprn_aux__substitute_lval_in_lval_count(OldLval, NewLval,
-			Lval0, Lval, N0, N),
+			Lval0, Lval, !N),
 		Uinstr = mark_hp(Lval)
 	;
 		Uinstr0 = restore_hp(Rval0),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval0, Rval, N0, N),
+			Rval0, Rval, !N),
 		Uinstr = restore_hp(Rval)
 	;
 		Uinstr0 = free_heap(Rval0),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval0, Rval, N0, N),
+			Rval0, Rval, !N),
 		Uinstr = free_heap(Rval)
 	;
 		Uinstr0 = store_ticket(Lval0),
 		exprn_aux__substitute_lval_in_lval_count(OldLval, NewLval,
-			Lval0, Lval, N0, N),
+			Lval0, Lval, !N),
 		Uinstr = store_ticket(Lval)
 	;
 		Uinstr0 = reset_ticket(Rval0, Reason),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval0, Rval, N0, N),
+			Rval0, Rval, !N),
 		Uinstr = reset_ticket(Rval, Reason)
 	;
 		Uinstr0 = prune_ticket,
-		Uinstr = Uinstr0,
-		N = N0
+		Uinstr = Uinstr0
 	;
 		Uinstr0 = discard_ticket,
-		Uinstr = Uinstr0,
-		N = N0
+		Uinstr = Uinstr0
 	;
 		Uinstr0 = mark_ticket_stack(Lval0),
 		exprn_aux__substitute_lval_in_lval_count(OldLval, NewLval,
-			Lval0, Lval, N0, N),
+			Lval0, Lval, !N),
 		Uinstr = mark_ticket_stack(Lval)
 	;
 		Uinstr0 = prune_tickets_to(Rval0),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval0, Rval, N0, N),
+			Rval0, Rval, !N),
 		Uinstr = prune_tickets_to(Rval)
 %	;
 %		% discard_tickets_to(_) is used only in hand-written code
 %		Uinstr0 = discard_tickets_to(Rval0),
 %		exprn_aux__substitute_lval_in_rval(OldLval, NewLval,
-%			Rval0, Rval, N0, N),
+%			Rval0, Rval, !N),
 %		Uinstr = discard_tickets_to(Rval)
 	;
 		Uinstr0 = incr_sp(_, _),
-		Uinstr = Uinstr0,
-		N = N0
+		Uinstr = Uinstr0
 	;
 		Uinstr0 = decr_sp(_),
-		Uinstr = Uinstr0,
-		N = N0
+		Uinstr = Uinstr0
 	;
 		Uinstr0 = pragma_c(Decls, Components0, MayCallMercury,
 			MaybeLabel1, MaybeLabel2, MaybeLabel3, MaybeLabel4,
 			ReferStackSlot, MayDupl),
 		list__map_foldl(exprn_aux__substitute_lval_in_component(
-			OldLval, NewLval), Components0, Components, N0, N),
+			OldLval, NewLval), Components0, Components, !N),
 		Uinstr = pragma_c(Decls, Components, MayCallMercury,
 			MaybeLabel1, MaybeLabel2, MaybeLabel3, MaybeLabel4,
 			ReferStackSlot, MayDupl)
 	;
 		Uinstr0 = init_sync_term(Lval0, BranchCount),
 		exprn_aux__substitute_lval_in_lval_count(OldLval, NewLval,
-			Lval0, Lval, N0, N),
+			Lval0, Lval, !N),
 		Uinstr = init_sync_term(Lval, BranchCount)
 	;
 		Uinstr0 = fork(_, _, _),
-		Uinstr = Uinstr0,
-		N = N0
+		Uinstr = Uinstr0
 	;
 		Uinstr0 = join_and_terminate(Lval0),
 		exprn_aux__substitute_lval_in_lval_count(OldLval, NewLval,
-			Lval0, Lval, N0, N),
+			Lval0, Lval, !N),
 		Uinstr = join_and_terminate(Lval)
 	;
 		Uinstr0 = join_and_continue(Lval0, Label),
 		exprn_aux__substitute_lval_in_lval_count(OldLval, NewLval,
-			Lval0, Lval, N0, N),
+			Lval0, Lval, !N),
 		Uinstr = join_and_continue(Lval, Label)
 	).
 
@@ -494,34 +483,31 @@
 	is det.
 
 exprn_aux__substitute_lval_in_component(OldLval, NewLval,
-		Component0, Component, N0, N) :-
+		Component0, Component, !N) :-
 	(
 		Component0 = pragma_c_inputs(Inputs0),
 		list__map_foldl(exprn_aux__substitute_lval_in_pragma_c_input(
-			OldLval, NewLval), Inputs0, Inputs, N0, N),
+			OldLval, NewLval), Inputs0, Inputs, !N),
 		Component = pragma_c_inputs(Inputs)
 	;
 		Component0 = pragma_c_outputs(Outputs0),
 		list__map_foldl(exprn_aux__substitute_lval_in_pragma_c_output(
-			OldLval, NewLval), Outputs0, Outputs, N0, N),
+			OldLval, NewLval), Outputs0, Outputs, !N),
 		Component = pragma_c_outputs(Outputs)
 	;
 		Component0 = pragma_c_user_code(_, _),
-		Component = Component0,
-		N = N0
+		Component = Component0
 	;
 		Component0 = pragma_c_raw_code(Code, LvalSet0),
 		exprn_aux__substitute_lval_in_live_lval_info(OldLval, NewLval,
-			LvalSet0, LvalSet, N0, N),
+			LvalSet0, LvalSet, !N),
 		Component = pragma_c_raw_code(Code, LvalSet)
 	;
 		Component0 = pragma_c_fail_to(_),
-		Component = Component0,
-		N = N0
+		Component = Component0
 	;
 		Component0 = pragma_c_noop,
-		Component = Component0,
-		N = N0
+		Component = Component0
 	).
 
 :- pred exprn_aux__substitute_lval_in_live_lval_info(lval::in, lval::in,
@@ -529,215 +515,200 @@
 	is det.
 
 exprn_aux__substitute_lval_in_live_lval_info(_OldLval, _NewLval,
-		no_live_lvals_info, no_live_lvals_info, N, N).
+		no_live_lvals_info, no_live_lvals_info, !N).
 exprn_aux__substitute_lval_in_live_lval_info(OldLval, NewLval,
-		live_lvals_info(LvalSet0), live_lvals_info(LvalSet), N0, N) :-
+		live_lvals_info(LvalSet0), live_lvals_info(LvalSet), !N) :-
 	Lvals0 = set__to_sorted_list(LvalSet0),
 	list__map_foldl(
 		exprn_aux__substitute_lval_in_lval_count(OldLval, NewLval),
-		Lvals0, Lvals, N0, N),
+		Lvals0, Lvals, !N),
 	set__list_to_set(Lvals, LvalSet).
 
 :- pred exprn_aux__substitute_lval_in_pragma_c_input(lval::in, lval::in,
 	pragma_c_input::in, pragma_c_input::out, int::in, int::out) is det.
 
 exprn_aux__substitute_lval_in_pragma_c_input(OldLval, NewLval, Out0, Out,
-		N0, N) :-
+		!N) :-
 	Out0 = pragma_c_input(Name, VarType, OrigType, Rval0, MaybeForeign),
 	exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval, Rval0, Rval,
-		N0, N),
+		!N),
 	Out = pragma_c_input(Name, VarType, OrigType, Rval, MaybeForeign).
 
 :- pred exprn_aux__substitute_lval_in_pragma_c_output(lval::in, lval::in,
 	pragma_c_output::in, pragma_c_output::out, int::in, int::out) is det.
 
 exprn_aux__substitute_lval_in_pragma_c_output(OldLval, NewLval, Out0, Out,
-		N0, N) :-
+		!N) :-
 	Out0 = pragma_c_output(Lval0, VarType, OrigType, Name, MaybeForeign),
 	exprn_aux__substitute_lval_in_lval_count(OldLval, NewLval, Lval0, Lval,
-		N0, N),
+		!N),
 	Out = pragma_c_output(Lval, VarType, OrigType, Name, MaybeForeign).
 
 :- pred exprn_aux__substitute_lval_in_rval_count(lval::in, lval::in,
 	rval::in, rval::out, int::in, int::out) is det.
 
-exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval, Rval0, Rval,
-		N0, N) :-
+exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval, Rval0, Rval, !N) :-
 	(
 		Rval0 = lval(Lval0),
 		exprn_aux__substitute_lval_in_lval_count(OldLval, NewLval,
-			Lval0, Lval, N0, N),
+			Lval0, Lval, !N),
 		Rval = lval(Lval)
 	;
 		Rval0 = var(_Var),
-		Rval = Rval0,
-		N = N0
+		Rval = Rval0
 	;
 		Rval0 = mkword(Tag, Rval1),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval1, Rval2, N0, N),
+			Rval1, Rval2, !N),
 		Rval = mkword(Tag, Rval2)
 	;
 		Rval0 = const(_Const),
-		Rval = Rval0,
-		N = N0
+		Rval = Rval0
 	;
 		Rval0 = unop(Unop, Rval1),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval1, Rval2, N0, N),
+			Rval1, Rval2, !N),
 		Rval = unop(Unop, Rval2)
 	;
 		Rval0 = binop(Binop, Rval1, Rval2),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval1, Rval3, N0, N1),
+			Rval1, Rval3, !N),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval2, Rval4, N1, N),
+			Rval2, Rval4, !N),
 		Rval = binop(Binop, Rval3, Rval4)
 	;
 		Rval0 = mem_addr(MemRef0),
 		exprn_aux__substitute_lval_in_mem_ref(OldLval, NewLval,
-			MemRef0, MemRef, N0, N),
+			MemRef0, MemRef, !N),
 		Rval = mem_addr(MemRef)
 	).
 
 :- pred exprn_aux__substitute_lval_in_mem_ref(lval::in, lval::in,
 	mem_ref::in, mem_ref::out, int::in, int::out) is det.
 
-exprn_aux__substitute_lval_in_mem_ref(OldLval, NewLval, MemRef0, MemRef,
-		N0, N) :-
+exprn_aux__substitute_lval_in_mem_ref(OldLval, NewLval, MemRef0, MemRef, !N) :-
 	(
 		MemRef0 = stackvar_ref(_SlotNum),
-		MemRef = MemRef0,
-		N = N0
+		MemRef = MemRef0
 	;
 		MemRef0 = framevar_ref(_SlotNum),
-		MemRef = MemRef0,
-		N = N0
+		MemRef = MemRef0
 	;
 		MemRef0 = heap_ref(Rval0, Tag, FieldNum),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval0, Rval, N0, N),
+			Rval0, Rval, !N),
 		MemRef = heap_ref(Rval, Tag, FieldNum)
 	).
 
 :- pred exprn_aux__substitute_lval_in_lval_count(lval::in, lval::in,
 	lval::in, lval::out, int::in, int::out) is det.
 
-exprn_aux__substitute_lval_in_lval_count(OldLval, NewLval, Lval0, Lval,
-		N0, N) :-
+exprn_aux__substitute_lval_in_lval_count(OldLval, NewLval, Lval0, Lval, !N) :-
 	( Lval0 = OldLval ->
 		Lval = NewLval,
-		N = N0 + 1
+		!:N = !.N + 1
 	;
 		exprn_aux__substitute_lval_in_lval_count_2(OldLval, NewLval,
-			Lval0, Lval, N0, N)
+			Lval0, Lval, !N)
 	).
 
 :- pred exprn_aux__substitute_lval_in_lval_count_2(lval::in, lval::in,
 	lval::in, lval::out, int::in, int::out) is det.
 
 exprn_aux__substitute_lval_in_lval_count_2(OldLval, NewLval, Lval0, Lval,
-		N0, N) :-
+		!N) :-
 	(
 		Lval0 = reg(_Type, _RegNum),
-		Lval = Lval0,
-		N = N0
+		Lval = Lval0
 	;
 		Lval0 = succip,
-		Lval = succip,
-		N = N0
+		Lval = succip
 	;
 		Lval0 = maxfr,
-		Lval = maxfr,
-		N = N0
+		Lval = maxfr
 	;
 		Lval0 = curfr,
-		Lval = curfr,
-		N = N0
+		Lval = curfr
 	;
 		Lval0 = hp,
-		Lval = hp,
-		N = N0
+		Lval = hp
 	;
 		Lval0 = sp,
-		Lval = sp,
-		N = N0
+		Lval = sp
 	;
 		Lval0 = temp(_Type, _TmpNum),
-		Lval = Lval0,
-		N = N0
+		Lval = Lval0
 	;
 		Lval0 = stackvar(_SlotNum),
-		Lval = Lval0,
-		N = N0
+		Lval = Lval0
 	;
 		Lval0 = framevar(_SlotNum),
-		Lval = Lval0,
-		N = N0
+		Lval = Lval0
 	;
 		Lval0 = succip(Rval0),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval0, Rval, N0, N),
+			Rval0, Rval, !N),
 		Lval = succip(Rval)
 	;
 		Lval0 = redoip(Rval0),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval0, Rval, N0, N),
+			Rval0, Rval, !N),
 		Lval = redoip(Rval)
 	;
 		Lval0 = redofr(Rval0),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval0, Rval, N0, N),
+			Rval0, Rval, !N),
 		Lval = redofr(Rval)
 	;
 		Lval0 = succfr(Rval0),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval0, Rval, N0, N),
+			Rval0, Rval, !N),
 		Lval = succfr(Rval)
 	;
 		Lval0 = prevfr(Rval0),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval0, Rval, N0, N),
+			Rval0, Rval, !N),
 		Lval = prevfr(Rval)
 	;
 		Lval0 = field(Tag, Rval1, Rval2),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval1, Rval3, N0, N1),
+			Rval1, Rval3, !N),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval2, Rval4, N1, N),
+			Rval2, Rval4, !N),
 		Lval = field(Tag, Rval3, Rval4)
 	;
 		Lval0 = mem_ref(Rval0),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval0, Rval, N0, N),
+			Rval0, Rval, !N),
 		Lval = mem_ref(Rval)
 	;
 		Lval0 = lvar(_Var),
-		Lval = Lval0,
-		N = N0
+		Lval = Lval0
 	).
 
 :- pred exprn_aux__substitute_lval_in_args(lval::in, lval::in,
 	list(maybe(rval))::in, list(maybe(rval))::out, int::in, int::out)
 	is det.
 
-exprn_aux__substitute_lval_in_args(_OldLval, _NewLval, [], [], N, N).
+exprn_aux__substitute_lval_in_args(_OldLval, _NewLval, [], [], !N).
 exprn_aux__substitute_lval_in_args(OldLval, NewLval, [M0 | Ms0], [M | Ms],
-		N0, N) :-
-	exprn_aux__substitute_lval_in_arg(OldLval, NewLval, M0, M, N0, N1),
-	exprn_aux__substitute_lval_in_args(OldLval, NewLval, Ms0, Ms, N1, N).
+		!N) :-
+	exprn_aux__substitute_lval_in_arg(OldLval, NewLval, M0, M, !N),
+	exprn_aux__substitute_lval_in_args(OldLval, NewLval, Ms0, Ms, !N).
 
 :- pred exprn_aux__substitute_lval_in_arg(lval::in, lval::in,
 	maybe(rval)::in, maybe(rval)::out, int::in, int::out) is det.
 
-exprn_aux__substitute_lval_in_arg(OldLval, NewLval, M0, M, N0, N) :-
-	( M0 = yes(Rval0) ->
+exprn_aux__substitute_lval_in_arg(OldLval, NewLval, MaybeRval0, MaybeRval,
+		!N) :-
+	(
+		MaybeRval0 = yes(Rval0),
 		exprn_aux__substitute_lval_in_rval_count(OldLval, NewLval,
-			Rval0, Rval, N0, N),
-		M = yes(Rval)
+			Rval0, Rval, !N),
+		MaybeRval = yes(Rval)
 	;
-		M = M0,
-		N = N0
+		MaybeRval0 = no,
+		MaybeRval = MaybeRval0
 	).
 
 exprn_aux__substitute_rval_in_rval(OldRval, NewRval, Rval0, Rval) :-
@@ -883,23 +854,23 @@
 :- pred exprn_aux__substitute_rval_in_arg(rval::in, rval::in,
 	maybe(rval)::in, maybe(rval)::out) is det.
 
-exprn_aux__substitute_rval_in_arg(OldRval, NewRval, M0, M) :-
+exprn_aux__substitute_rval_in_arg(OldRval, NewRval, MaybeRval0, MaybeRval) :-
 	(
-		M0 = yes(Rval0)
-	->
+		MaybeRval0 = yes(Rval0),
 		exprn_aux__substitute_rval_in_rval(OldRval, NewRval,
 			Rval0, Rval),
-		M = yes(Rval)
+		MaybeRval = yes(Rval)
 	;
-		M = M0
+		MaybeRval0 = no,
+		MaybeRval = MaybeRval0
 	).
 
 %------------------------------------------------------------------------------%
 
-exprn_aux__substitute_vars_in_rval([], Rval, Rval).
-exprn_aux__substitute_vars_in_rval([Var - Sub | Rest], Rval0, Rval) :-
-	exprn_aux__substitute_rval_in_rval(var(Var), Sub, Rval0, Rval1),
-	exprn_aux__substitute_vars_in_rval(Rest, Rval1, Rval).
+exprn_aux__substitute_vars_in_rval([], !Rval).
+exprn_aux__substitute_vars_in_rval([Var - Sub | Rest], !Rval) :-
+	exprn_aux__substitute_rval_in_rval(var(Var), Sub, !Rval),
+	exprn_aux__substitute_vars_in_rval(Rest, !Rval).
 
 % When we substitute one set of rvals for another, we face the problem
 % that the substitution may not be idempotent. We finesse this problem by
@@ -907,11 +878,11 @@
 % the replacement rvals for these unique rvals. We guarantee the uniqueness
 % of these rvals by using framevars with negative numbers for them.
 
-exprn_aux__substitute_rvals_in_rval(RvalPairs, Rval0, Rval) :-
+exprn_aux__substitute_rvals_in_rval(RvalPairs, !Rval) :-
 	exprn_aux__substitute_rvals_in_rval_1(RvalPairs, 0,
 		RvalUniqPairs, UniqRvalPairs),
-	exprn_aux__substitute_rvals_in_rval_2(RvalUniqPairs, Rval0, Rval1),
-	exprn_aux__substitute_rvals_in_rval_2(UniqRvalPairs, Rval1, Rval).
+	exprn_aux__substitute_rvals_in_rval_2(RvalUniqPairs, !Rval),
+	exprn_aux__substitute_rvals_in_rval_2(UniqRvalPairs, !Rval).
 
 :- pred exprn_aux__substitute_rvals_in_rval_1(assoc_list(rval, rval)::in,
 	int::in, assoc_list(rval, rval)::out, assoc_list(rval, rval)::out)
@@ -928,17 +899,15 @@
 :- pred exprn_aux__substitute_rvals_in_rval_2(assoc_list(rval, rval)::in,
 	rval::in, rval::out) is det.
 
-exprn_aux__substitute_rvals_in_rval_2([], Rval, Rval).
-exprn_aux__substitute_rvals_in_rval_2([Left - Right | Rest], Rval0, Rval2) :-
-	exprn_aux__substitute_rval_in_rval(Left, Right, Rval0, Rval1),
-	exprn_aux__substitute_rvals_in_rval_2(Rest, Rval1, Rval2).
+exprn_aux__substitute_rvals_in_rval_2([], !Rval).
+exprn_aux__substitute_rvals_in_rval_2([Left - Right | Rest], !Rval) :-
+	exprn_aux__substitute_rval_in_rval(Left, Right, !Rval),
+	exprn_aux__substitute_rvals_in_rval_2(Rest, !Rval).
 
 %---------------------------------------------------------------------------%
 
 exprn_aux__simplify_rval(Rval0, Rval) :-
-	(
-		exprn_aux__simplify_rval_2(Rval0, Rval1)
-	->
+	( exprn_aux__simplify_rval_2(Rval0, Rval1) ->
 		exprn_aux__simplify_rval(Rval1, Rval)
 	;
 		Rval = Rval0
@@ -981,14 +950,14 @@
 
 :- pred exprn_aux__simplify_arg(maybe(rval)::in, maybe(rval)::out) is det.
 
-exprn_aux__simplify_arg(MR0, MR) :-
+exprn_aux__simplify_arg(MaybeRval0, MaybeRval) :-
 	(
-		MR0 = yes(Rval0),
+		MaybeRval0 = yes(Rval0),
 		exprn_aux__simplify_rval_2(Rval0, Rval)
 	->
-		MR = yes(Rval)
+		MaybeRval = yes(Rval)
 	;
-		MR = MR0
+		MaybeRval = MaybeRval0
 	).
 
 %-----------------------------------------------------------------------------%
Index: unify_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/unify_gen.m,v
retrieving revision 1.148
diff -u -b -r1.148 unify_gen.m
--- unify_gen.m	22 Mar 2005 06:40:30 -0000	1.148
+++ unify_gen.m	3 May 2005 07:39:28 -0000
@@ -1,4 +1,6 @@
-%---------------------------------------------------------------------------%
+%---------------------------------------------------------------------------e
+% vim: ft=mercury ts=4 sw=4 et
+%---------------------------------------------------------------------------e
 % Copyright (C) 1994-2005 The University of Melbourne.
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
@@ -74,7 +76,8 @@
 :- import_module string.
 :- import_module term.
 
-:- type uni_val		--->	ref(prog_var)
+:- type uni_val
+    --->    ref(prog_var)
 			;	lval(lval).
 
 %---------------------------------------------------------------------------%
@@ -210,16 +213,15 @@
 	ConsIdName = hlds_out__cons_id_to_string(ConsId),
 	(
 		Reverse = no,
-		string__append_list(["checking that ", VarName,
-			" has functor ", ConsIdName], Comment),
+        string__append_list(["checking that ", VarName, " has functor ",
+            ConsIdName], Comment),
 		CommentCode = node([comment(Comment) - ""]),
 		Tag = code_info__cons_id_to_tag(!.CI, Var, ConsId),
 		unify_gen__generate_tag_test_rval_2(Tag, Rval, TestRval)
 	;
 		Reverse = yes(TestConsId),
-		string__append_list(["checking that ", VarName,
-			" has functor ", ConsIdName, " (inverted test)"],
-			Comment),
+        string__append_list(["checking that ", VarName, " has functor ",
+            ConsIdName, " (inverted test)"], Comment),
 		CommentCode = node([comment(Comment) - ""]),
 		Tag = code_info__cons_id_to_tag(!.CI, Var, TestConsId),
 		unify_gen__generate_tag_test_rval_2(Tag, Rval, NegTestRval),
@@ -365,13 +367,15 @@
 	code_info__assign_const_to_var(Var, const(float_const(Float)), !CI).
 unify_gen__generate_construction_2(no_tag, Var, Args, Modes, _, _, Code,
 		!CI) :-
-	( Args = [Arg], Modes = [Mode] ->
+    (
+        Args = [Arg],
+        Modes = [Mode]
+    ->
 		Type = code_info__variable_type(!.CI, Arg),
-		unify_gen__generate_sub_unify(ref(Var), ref(Arg),
-			Mode, Type, Code, !CI)
+        unify_gen__generate_sub_unify(ref(Var), ref(Arg), Mode, Type, Code,
+            !CI)
 	;
-		error("unify_gen__generate_construction_2: no_tag: " ++
-			"arity != 1")
+        error("unify_gen__generate_construction_2: no_tag: arity != 1")
 	).
 unify_gen__generate_construction_2(single_functor,
 		Var, Args, Modes, Size, GoalInfo, Code, !CI) :-
@@ -382,8 +386,7 @@
 		Var, Args, Modes, Size, _, Code, !CI) :-
 	code_info__get_module_info(!.CI, ModuleInfo),
 	unify_gen__var_types(!.CI, Args, ArgTypes),
-	unify_gen__generate_cons_args(Args, ArgTypes, Modes, ModuleInfo,
-		Rvals),
+    unify_gen__generate_cons_args(Args, ArgTypes, Modes, ModuleInfo, Rvals),
 	unify_gen__construct_cell(Var, Ptag, Rvals, Size, Code, !CI).
 unify_gen__generate_construction_2(shared_remote_tag(Ptag, Sectag),
 		Var, Args, Modes, Size, _, Code, !CI) :-
@@ -400,9 +403,10 @@
 		mkword(Bits1, unop(mkbody, const(int_const(Num1)))), !CI).
 unify_gen__generate_construction_2(type_ctor_info_constant(ModuleName,
 		TypeName, TypeArity), Var, Args, _Modes, _, _, empty, !CI) :-
-	( Args = [] ->
-		true
+    (
+        Args = []
 	;
+        Args = [_ | _],
 		error("unify_gen: type-info constant has args")
 	),
 	RttiTypeCtor = rtti_type_ctor(ModuleName, TypeName, TypeArity),
@@ -411,21 +415,22 @@
 		const(data_addr_const(DataAddr, no)), !CI).
 unify_gen__generate_construction_2(base_typeclass_info_constant(ModuleName,
 		ClassId, Instance), Var, Args, _Modes, _, _, empty, !CI) :-
-	( Args = [] ->
-		true
+    (
+        Args = []
 	;
+        Args = [_ | _],
 		error("unify_gen: typeclass-info constant has args")
 	),
 	TCName = generate_class_name(ClassId),
 	code_info__assign_const_to_var(Var,
 		const(data_addr_const(rtti_addr(tc_rtti_id(TCName,
-			base_typeclass_info(ModuleName, Instance))),
-			no)), !CI).
+            base_typeclass_info(ModuleName, Instance))), no)), !CI).
 unify_gen__generate_construction_2(tabling_pointer_constant(PredId, ProcId),
 		Var, Args, _Modes, _, _, empty, !CI) :-
-	( Args = [] ->
-		true
+    (
+        Args = []
 	;
+        Args = [_ | _],
 		error("unify_gen: tabling pointer constant has args")
 	),
 	code_info__get_module_info(!.CI, ModuleInfo),
@@ -437,9 +442,10 @@
 unify_gen__generate_construction_2(
 		deep_profiling_proc_layout_tag(PredId, ProcId),
 		Var, Args, _Modes, _, _, empty, !CI) :-
-	( Args = [] ->
-		true
+    (
+        Args = []
 	;
+        Args = [_ | _],
 		error("unify_gen: deep_profiling_proc_static has args")
 	),
 	code_info__get_module_info(!.CI, ModuleInfo),
@@ -456,9 +462,10 @@
 		const(data_addr_const(DataAddr, no)), !CI).
 unify_gen__generate_construction_2(table_io_decl_tag(PredId, ProcId),
 		Var, Args, _Modes, _, _, empty, !CI) :-
-	( Args = [] ->
-		true
+    (
+        Args = []
 	;
+        Args = [_ | _],
 		error("unify_gen: table_io_decl has args")
 	),
 	code_info__get_module_info(!.CI, ModuleInfo),
@@ -468,9 +475,10 @@
 		const(data_addr_const(DataAddr, no)), !CI).
 unify_gen__generate_construction_2(reserved_address(RA),
 		Var, Args, _Modes, _, _, empty, !CI) :-
-	( Args = [] ->
-		true
+    (
+        Args = []
 	;
+        Args = [_ | _],
 		error("unify_gen: reserved_address constant has args")
 	),
 	code_info__assign_const_to_var(Var,
@@ -494,31 +502,33 @@
 	map__lookup(Preds, PredId, PredInfo),
 	pred_info_procedures(PredInfo, Procs),
 	map__lookup(Procs, ProcId, ProcInfo),
-%
-% We handle currying of a higher-order pred variable as a special case.
-% We recognize
-%
-%	P = l(P0, X, Y, Z)
-%
-% where
-%
-%	l(P0, A, B, C, ...) :- P0(A, B, C, ...).	% higher-order call
-%
-% as a special case, and generate special code to construct the
-% new closure P from the old closure P0 by appending the args X, Y, Z.
-% The advantage of this optimization is that when P is called, we
-% will only need to do one indirect call rather than two.
-% Its disadvantage is that the cost of creating the closure P is greater.
-% Whether this is a net win depend on the number of times P is called.
-%
-% The pattern that this optimization looks for happens rarely at the moment.
-% The reason is that although we allow the creation of closures with a simple
-% syntax (e.g. P0 = append4([1])), we don't allow their extension with a
-% similarly simple syntax (e.g. P = call(P0, [2])). In fact, typecheck.m
-% contains code to detect such constructs, because it does not have code
-% to typecheck them (you get a message about call/2 should be used as a goal,
-% not an expression).
-%
+
+    %
+    % We handle currying of a higher-order pred variable as a special case.
+    % We recognize
+    %
+    %   P = l(P0, X, Y, Z)
+    %
+    % where
+    %
+    %   l(P0, A, B, C, ...) :- P0(A, B, C, ...).    % higher-order call
+    %
+    % as a special case, and generate special code to construct the
+    % new closure P from the old closure P0 by appending the args X, Y, Z.
+    % The advantage of this optimization is that when P is called, we
+    % will only need to do one indirect call rather than two.
+    % Its disadvantage is that the cost of creating the closure P is greater.
+    % Whether this is a net win depend on the number of times P is called.
+    %
+    % The pattern that this optimization looks for happens rarely at the moment.
+    % The reason is that although we allow the creation of closures with a
+    % simple syntax (e.g. P0 = append4([1])), we don't allow their extension
+    % with a similarly simple syntax (e.g. P = call(P0, [2])). In fact,
+    % typecheck.m contains code to detect such constructs, because it does not
+    % have code to typecheck them (you get a message about call/2 should be
+    % used as a goal, not an expression).
+    %
+
 	proc_info_goal(ProcInfo, ProcInfoGoal),
 	proc_info_interface_code_model(ProcInfo, CodeModel),
 	proc_info_headvars(ProcInfo, ProcHeadVars),
@@ -534,8 +544,11 @@
 			% and semidet is not compatible with nondet,
 			% since the arguments go in different registers.
 			% But det is compatible with nondet.
-		( CodeModel = CallCodeModel
-		; CodeModel = model_non, CallCodeModel = model_det
+        (
+            CodeModel = CallCodeModel
+        ;
+            CodeModel = model_non,
+            CallCodeModel = model_det
 		),
 			% This optimization distorts deep profiles, so don't
 			% perform it in deep profiling grades.
@@ -543,12 +556,13 @@
 		globals__lookup_bool_option(Globals, profile_deep, Deep),
 		Deep = no
 	->
-		( CallArgs = [] ->
-			% if there are no new arguments, we can just use the
-			% old closure
+        (
+            CallArgs = [],
+            % If there are no new arguments, we can just use the old closure.
 			code_info__assign_var_to_var(Var, CallPred, !CI),
 			Code = empty
 		;
+            CallArgs = [_ | _],
 			code_info__get_next_label(LoopStart, !CI),
 			code_info__get_next_label(LoopTest, !CI),
 			code_info__acquire_reg(r, LoopCounter, !CI),
@@ -561,15 +575,12 @@
 			list__length(CallArgs, NumNewArgs),
 			NumNewArgs_Rval = const(int_const(NumNewArgs)),
 			NumNewArgsPlusThree = NumNewArgs + 3,
-			NumNewArgsPlusThree_Rval =
-				const(int_const(NumNewArgsPlusThree)),
+            NumNewArgsPlusThree_Rval = const(int_const(NumNewArgsPlusThree)),
 			code_info__produce_variable(CallPred, OldClosureCode,
 				OldClosure, !CI),
 			NewClosureCode = node([
-				comment("build new closure from old closure")
-					- "",
-				assign(NumOldArgs,
-					lval(field(yes(0), OldClosure, Two)))
+                comment("build new closure from old closure") - "",
+                assign(NumOldArgs, lval(field(yes(0), OldClosure, Two)))
 					- "get number of arguments",
 				incr_hp(NewClosure, no, no,
 					binop(+, lval(NumOldArgs),
@@ -582,11 +593,9 @@
 					lval(field(yes(0), OldClosure, One)))
 					- "set closure code pointer",
 				assign(field(yes(0), lval(NewClosure), Two),
-					binop(+, lval(NumOldArgs),
-						NumNewArgs_Rval))
+                    binop(+, lval(NumOldArgs), NumNewArgs_Rval))
 					- "set new number of arguments",
-				assign(NumOldArgs, binop(+, lval(NumOldArgs),
-					Three))
+                assign(NumOldArgs, binop(+, lval(NumOldArgs), Three))
 					- "set up loop limit",
 				assign(LoopCounter, Three)
 					- "initialize loop counter",
@@ -596,22 +605,16 @@
 				% This is why we jump to the loop condition
 				% test.
 				goto(label(LoopTest))
-					- ("enter the copy loop " ++
-					"at the conceptual top"),
+                    - ("enter the copy loop at the conceptual top"),
 				label(LoopStart) - "start of loop",
-				assign(field(yes(0), lval(NewClosure),
-						lval(LoopCounter)),
-					lval(field(yes(0), OldClosure,
-						lval(LoopCounter))))
+                assign(field(yes(0), lval(NewClosure), lval(LoopCounter)),
+                    lval(field(yes(0), OldClosure, lval(LoopCounter))))
 					- "copy old hidden argument",
-				assign(LoopCounter,
-					binop(+, lval(LoopCounter), One))
+                assign(LoopCounter, binop(+, lval(LoopCounter), One))
 					- "increment loop counter",
 				label(LoopTest)
-					- ("do we have more old arguments " ++
-					"to copy?"),
-				if_val(binop(<, lval(LoopCounter),
-					lval(NumOldArgs)),
+                    - ("do we have more old arguments to copy?"),
+                if_val(binop(<, lval(LoopCounter), lval(NumOldArgs)),
 					label(LoopStart))
 					- "repeat the loop?"
 			]),
@@ -620,19 +623,14 @@
 			code_info__release_reg(LoopCounter, !CI),
 			code_info__release_reg(NumOldArgs, !CI),
 			code_info__release_reg(NewClosure, !CI),
-			code_info__assign_lval_to_var(Var, NewClosure,
-				AssignCode, !CI),
-			Code =
-				tree(OldClosureCode,
-				tree(NewClosureCode,
-				tree(ExtraArgsCode,
-				     AssignCode)))
+            code_info__assign_lval_to_var(Var, NewClosure, AssignCode, !CI),
+            Code = tree_list([OldClosureCode, NewClosureCode, ExtraArgsCode,
+                     AssignCode])
 		)
 	;
 		CodeAddr = code_info__make_entry_label(!.CI, ModuleInfo,
 			PredId, ProcId, no),
-		code_util__extract_proc_label_from_code_addr(CodeAddr,
-			ProcLabel),
+        code_util__extract_proc_label_from_code_addr(CodeAddr, ProcLabel),
 		(
 			EvalMethod = normal,
 			CallArgsRval = const(code_addr_const(CodeAddr))
@@ -641,21 +639,18 @@
 			rl__get_c_interface_rl_proc_name(ModuleInfo,
 				proc(PredId, ProcId), RLProcName),
 			rl__proc_name_to_string(RLProcName, RLProcNameStr),
-			InputTypes = list__map(code_info__variable_type(!.CI),
-				Args),
-			rl__schema_to_string(ModuleInfo,
-				InputTypes, InputSchemaStr),
+            InputTypes = list__map(code_info__variable_type(!.CI), Args),
+            rl__schema_to_string(ModuleInfo, InputTypes, InputSchemaStr),
 			AditiCallArgs = [
 				const(string_const(RLProcNameStr)),
 				const(string_const(InputSchemaStr))
 			],
 			code_info__add_static_cell_natural_types(AditiCallArgs,
 				CallArgsDataAddr, !CI),
-			CallArgsRval =
-				const(data_addr_const(CallArgsDataAddr, no))
+            CallArgsRval = const(data_addr_const(CallArgsDataAddr, no))
 		),
-		continuation_info__generate_closure_layout(
-			ModuleInfo, PredId, ProcId, ClosureInfo),
+        continuation_info__generate_closure_layout( ModuleInfo, PredId, ProcId,
+            ClosureInfo),
 		module_info_name(ModuleInfo, ModuleName),
 		goal_info_get_context(GoalInfo, Context),
 		term__context_file(Context, FileName),
@@ -674,10 +669,9 @@
 		code_info__add_closure_layout(Data, !CI),
 		% For now, closures always have zero size, and the size slot
 		% is never looked at.
-		code_info__add_static_cell(ClosureLayoutRvalsTypes,
-			ClosureDataAddr, !CI),
-		ClosureLayoutRval =
-			const(data_addr_const(ClosureDataAddr, no)),
+        code_info__add_static_cell(ClosureLayoutRvalsTypes, ClosureDataAddr,
+            !CI),
+        ClosureLayoutRval = const(data_addr_const(ClosureDataAddr, no)),
 		list__length(Args, NumArgs),
 		proc_info_arg_info(ProcInfo, ArgInfo),
 		unify_gen__generate_pred_args(Args, ArgInfo, PredArgs),
@@ -700,16 +694,14 @@
 	code_info__produce_variable(Var, Code0, Value, !CI),
 	One = const(int_const(1)),
 	Code1 = node([
-		assign(field(yes(0), lval(NewClosure), lval(LoopCounter)),
-			Value)
+        assign(field(yes(0), lval(NewClosure), lval(LoopCounter)), Value)
 			- "set new argument field",
-		assign(LoopCounter,
-			binop(+, lval(LoopCounter), One))
+        assign(LoopCounter, binop(+, lval(LoopCounter), One))
 			- "increment argument counter"
 	]),
-	Code = tree(tree(Code0, Code1), Code2),
-	unify_gen__generate_extra_closure_args(Vars, LoopCounter,
-		NewClosure, Code2, !CI).
+    unify_gen__generate_extra_closure_args(Vars, LoopCounter, NewClosure,
+        Code2, !CI),
+    Code = tree_list([Code0, Code1, Code2]).
 
 :- pred unify_gen__generate_pred_args(list(prog_var)::in, list(arg_info)::in,
 	list(maybe(rval))::out) is det.
@@ -731,10 +723,7 @@
 	list(uni_mode)::in, module_info::in, list(maybe(rval))::out) is det.
 
 unify_gen__generate_cons_args(Vars, Types, Modes, ModuleInfo, Args) :-
-	(
-		unify_gen__generate_cons_args_2(Vars, Types, Modes,
-			ModuleInfo, Args0)
-	->
+    ( unify_gen__generate_cons_args_2(Vars, Types, Modes, ModuleInfo, Args0) ->
 		Args = Args0
 	;
 		error("unify_gen__generate_cons_args: length mismatch")
@@ -759,8 +748,7 @@
 	;
 		Rval = no
 	),
-	unify_gen__generate_cons_args_2(Vars, Types, UniModes, ModuleInfo,
-		RVals).
+    unify_gen__generate_cons_args_2(Vars, Types, UniModes, ModuleInfo, RVals).
 
 :- pred unify_gen__construct_cell(prog_var::in, tag::in, list(maybe(rval))::in,
 	maybe(term_size_value)::in, code_tree::out,
@@ -867,11 +855,13 @@
 		Code = empty
 	;
 		Tag = table_io_decl_tag(_, _),
-		error("unify_gen__generate_det_deconstruction: " ++
-			"table_io_decl_tag")
+        error("unify_gen__generate_det_deconstruction: table_io_decl_tag")
 	;
 		Tag = no_tag,
-		( Args = [Arg], Modes = [Mode] ->
+        (
+            Args = [Arg],
+            Modes = [Mode]
+        ->
 			VarType = code_info__variable_type(!.CI, Var),
 			( is_dummy_argument_type(VarType) ->
 				% We must handle this case specially. If we
@@ -885,20 +875,19 @@
 				% io__state.
 
 				( variable_is_forward_live(!.CI, Arg) ->
-					code_info__assign_const_to_var(Arg,
-						const(int_const(0)), !CI)
+                    code_info__assign_const_to_var(Arg, const(int_const(0)),
+                        !CI)
 				;
 					true
 				),
 				Code = empty
 			;
 				ArgType = code_info__variable_type(!.CI, Arg),
-				unify_gen__generate_sub_unify(ref(Var),
-					ref(Arg), Mode, ArgType, Code, !CI)
+                unify_gen__generate_sub_unify(ref(Var), ref(Arg),
+                    Mode, ArgType, Code, !CI)
 			)
 		;
-			error("unify_gen__generate_det_deconstruction: " ++
-				"no_tag: arity != 1")
+            error("unify_gen__generate_det_deconstruction: no_tag: arity != 1")
 		)
 	;
 		Tag = single_functor,
@@ -908,19 +897,19 @@
 	;
 		Tag = unshared_tag(Ptag),
 		Rval = var(Var),
-		unify_gen__make_fields_and_argvars(Args, Rval, 0,
-			Ptag, Fields, ArgVars),
+        unify_gen__make_fields_and_argvars(Args, Rval, 0, Ptag, Fields,
+            ArgVars),
 		unify_gen__var_types(!.CI, Args, ArgTypes),
-		unify_gen__generate_unify_args(Fields, ArgVars,
-			Modes, ArgTypes, Code, !CI)
+        unify_gen__generate_unify_args(Fields, ArgVars, Modes, ArgTypes, Code,
+            !CI)
 	;
 		Tag = shared_remote_tag(Ptag, _Sectag1),
 		Rval = var(Var),
-		unify_gen__make_fields_and_argvars(Args, Rval, 1,
-			Ptag, Fields, ArgVars),
+        unify_gen__make_fields_and_argvars(Args, Rval, 1, Ptag, Fields,
+            ArgVars),
 		unify_gen__var_types(!.CI, Args, ArgTypes),
-		unify_gen__generate_unify_args(Fields, ArgVars,
-			Modes, ArgTypes, Code, !CI)
+        unify_gen__generate_unify_args(Fields, ArgVars, Modes, ArgTypes, Code,
+            !CI)
 	;
 		Tag = shared_local_tag(_Ptag, _Sectag2),
 		Code = empty % if this is det, then nothing happens
@@ -932,8 +921,8 @@
 		% important for tag tests, not for det deconstructions,
 		% so here we just recurse on the real representation.
 		Tag = shared_with_reserved_addresses(_RAs, ThisTag),
-		unify_gen__generate_det_deconstruction_2(Var, Cons, Args,
-			Modes, ThisTag, Code, !CI)
+        unify_gen__generate_det_deconstruction_2(Var, Cons, Args, Modes,
+            ThisTag, Code, !CI)
 	).
 
 %---------------------------------------------------------------------------%
@@ -952,16 +941,12 @@
 	code_info__remember_position(!.CI, AfterUnify),
 	code_info__generate_failure(FailCode, !CI),
 	code_info__reset_to_position(AfterUnify, !CI),
-	unify_gen__generate_det_deconstruction(Var, Tag, Args, Modes,
-		DeconsCode, !CI),
+    unify_gen__generate_det_deconstruction(Var, Tag, Args, Modes, DeconsCode,
+        !CI),
 	SuccessLabelCode = node([
 		label(SuccLab) - ""
 	]),
-	Code =
-		tree(TagTestCode,
-		tree(FailCode,
-		tree(SuccessLabelCode,
-		     DeconsCode))).
+    Code = tree_list([TagTestCode, FailCode, SuccessLabelCode, DeconsCode]).
 
 %---------------------------------------------------------------------------%
 
Index: var_locn.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/var_locn.m,v
retrieving revision 1.24
diff -u -b -r1.24 var_locn.m
--- var_locn.m	22 Mar 2005 06:40:32 -0000	1.24
+++ var_locn.m	3 May 2005 07:27:15 -0000
@@ -36,294 +36,326 @@
 
 :- type var_locn_info.
 
-%	init_state(Arguments, Liveness, VarSet, VarTypes, StackSlots,
-%			FollowVars, Opts, VarLocnInfo)
-%		Produces an initial state of the VarLocnInfo given
-%		an association list of variables and lvalues. The initial
-%		state places the given variables at their corresponding
-%		locations, with the exception of variables which are not in
-%		Liveness (this corresponds to input arguments that are not
-%		used in the body). The VarSet parameter contains a mapping from
-%		variables to names, which is used when code is generated
-%		to provide meaningful comments. VarTypes gives the types of
-%		of all the procedure's variables. StackSlots maps each variable
-%		to its stack slot, if it has one. FollowVars is the initial
-%		follow_vars set; such sets give guidance as to what lvals
-%		(if any) each variable will be needed in next. Opts gives
-%		the table of options; this is used to decide what expressions
-%		are considered constants.
-
+	% init_state(Arguments, Liveness, VarSet, VarTypes, StackSlots,
+	%	FollowVars, Opts, VarLocnInfo)
+	%
+	% Produces an initial state of the VarLocnInfo given
+	% an association list of variables and lvalues. The initial
+	% state places the given variables at their corresponding
+	% locations, with the exception of variables which are not in
+	% Liveness (this corresponds to input arguments that are not
+	% used in the body). The VarSet parameter contains a mapping from
+	% variables to names, which is used when code is generated
+	% to provide meaningful comments. VarTypes gives the types of
+	% of all the procedure's variables. StackSlots maps each variable
+	% to its stack slot, if it has one. FollowVars is the initial
+	% follow_vars set; such sets give guidance as to what lvals
+	% (if any) each variable will be needed in next. Opts gives
+	% the table of options; this is used to decide what expressions
+	% are considered constants.
+	%
 :- pred init_state(assoc_list(prog_var, lval)::in, set(prog_var)::in,
 	prog_varset::in, vartypes::in, stack_slots::in, abs_follow_vars::in,
 	option_table::in, var_locn_info::out) is det.
 
-%	reinit_state(VarLocs, !VarLocnInfo)
-%		Produces a new state of the VarLocnInfo in which the static
-%		and mostly static information (stack slot map, follow vars map,
-%		varset, option settings) comes from VarLocnInfo0 but the
-%		dynamic state regarding variable locations is thrown away
-%		and then rebuilt from the information in VarLocs, an
-%		association list of variables and lvals. The new state
-%		places the given variables at their corresponding locations.
-
+	% reinit_state(VarLocs, !VarLocnInfo)
+	%
+	% Produces a new state of the VarLocnInfo in which the static
+	% and mostly static information (stack slot map, follow vars map,
+	% varset, option settings) comes from VarLocnInfo0 but the
+	% dynamic state regarding variable locations is thrown away
+	% and then rebuilt from the information in VarLocs, an
+	% association list of variables and lvals. The new state
+	% places the given variables at their corresponding locations.
+	%
 :- pred reinit_state(assoc_list(prog_var, lval)::in,
 	var_locn_info::in, var_locn_info::out) is det.
 
-%	clobber_all_regs(OkToDeleteAny, !VarLocnInfo)
-%		Modifies the state VarLocnInfo0 to produce VarLocnInfo
-%		in which all variables stored in registers are clobbered.
-%		Aborts if this deletes the last record of the state of a
-%		variable unless OkToDeleteAny is `yes'.
-
+	% clobber_all_regs(OkToDeleteAny, !VarLocnInfo)
+	%
+	% Modifies the state VarLocnInfo0 to produce VarLocnInfo
+	% in which all variables stored in registers are clobbered.
+	% Aborts if this deletes the last record of the state of a
+	% variable unless OkToDeleteAny is `yes'.
+	%
 :- pred clobber_all_regs(bool::in,
 	var_locn_info::in, var_locn_info::out) is det.
 
-%	clobber_regs(Regs, !VarLocnInfo)
-%		Modifies the state VarLocnInfo0 to produce VarLocnInfo
-%		in which all variables stored in Regs (a list of lvals
-%		which should contain only registers) are clobbered.
-
+	% clobber_regs(Regs, !VarLocnInfo)
+	%
+	% Modifies the state VarLocnInfo0 to produce VarLocnInfo
+	% in which all variables stored in Regs (a list of lvals
+	% which should contain only registers) are clobbered.
+	%
 :- pred clobber_regs(list(lval)::in,
 	var_locn_info::in, var_locn_info::out) is det.
 
-%	set_magic_var_location(Var, Lval, !VarLocnInfo)
-%		Modifies VarLocnInfo0 to produce VarLocnInfo in which
-%		Var is *magically* stored in Lval. Does not care if Lval
-%		is already in use; it overwrites it with the new information.
-%		Used to implement the ends of erroneous branches.
-
+	% set_magic_var_location(Var, Lval, !VarLocnInfo)
+	%
+	% Modifies VarLocnInfo0 to produce VarLocnInfo in which
+	% Var is *magically* stored in Lval. Does not care if Lval
+	% is already in use; it overwrites it with the new information.
+	% Used to implement the ends of erroneous branches.
+	%
 :- pred set_magic_var_location(prog_var::in, lval::in,
 	var_locn_info::in, var_locn_info::out) is det.
 
-%	check_and_set_magic_var_location(Var, Lval, !VarLocnInfo)
-%		Modifies VarLocnInfo0 to produce VarLocnInfo in which
-%		Var is *magically* stored in Lval. (The caller usually
-%		generates code to perform this magic.) Aborts if Lval
-%		is already in use.
-
+	% check_and_set_magic_var_location(Var, Lval, !VarLocnInfo)
+	%
+	% Modifies VarLocnInfo0 to produce VarLocnInfo in which
+	% Var is *magically* stored in Lval. (The caller usually
+	% generates code to perform this magic.) Aborts if Lval
+	% is already in use.
+	%
 :- pred check_and_set_magic_var_location(prog_var::in, lval::in,
 	var_locn_info::in, var_locn_info::out) is det.
 
-%	lval_in_use(VarLocnInfo, Lval)
-%		Succeeds iff Lval, which should be a register or stack slot,
-%		holds (a path to) a variable or is otherwise reserved.
-
+	% lval_in_use(VarLocnInfo, Lval)
+	%
+	% Succeeds iff Lval, which should be a register or stack slot,
+	% holds (a path to) a variable or is otherwise reserved.
+	%
 :- pred lval_in_use(var_locn_info::in, lval::in) is semidet.
 
-%	var_becomes_dead(Var, FirstTime, !VarLocnInfo)
-%		Frees any code generator resources used by Var in VarLocnInfo0
-%		to produce VarLocnInfo. FirstTime should be no if this same
-%		operation may already have been executed on Var; otherwise,
-%		var_becomes_dead will throw an exception if it does
-%		not know about Var.
-
+	% var_becomes_dead(Var, FirstTime, !VarLocnInfo)
+	%
+	% Frees any code generator resources used by Var in VarLocnInfo0
+	% to produce VarLocnInfo. FirstTime should be no if this same
+	% operation may already have been executed on Var; otherwise,
+	% var_becomes_dead will throw an exception if it does
+	% not know about Var.
+	%
 :- pred var_becomes_dead(prog_var::in, bool::in,
 	var_locn_info::in, var_locn_info::out) is det.
 
-%	assign_var_to_var(Var, AssignedVar, !VarLocnInfo)
-%		Reflects the effect of the assignment Var := AssignedVar in the
-%		state of VarLocnInfo0 to yield VarLocnInfo.
-
+	% assign_var_to_var(Var, AssignedVar, !VarLocnInfo)
+	%
+	% Reflects the effect of the assignment Var := AssignedVar in the
+	% state of VarLocnInfo0 to yield VarLocnInfo.
+	%
 :- pred assign_var_to_var(prog_var::in, prog_var::in,
 	var_locn_info::in, var_locn_info::out) is det.
 
-%	assign_lval_to_var(Var, Lval, StaticCellInfo, Code, !VarLocnInfo)
-%		Reflects the effect of the assignment Var := lval(Lval) in the
-%		state of VarLocnInfo0 to yield VarLocnInfo; any code required
-%		to effect the assignment will be returned in Code.
-
+	% assign_lval_to_var(Var, Lval, StaticCellInfo, Code, !VarLocnInfo)
+	%
+	% Reflects the effect of the assignment Var := lval(Lval) in the
+	% state of VarLocnInfo0 to yield VarLocnInfo; any code required
+	% to effect the assignment will be returned in Code.
+	%
 :- pred assign_lval_to_var(prog_var::in, lval::in,
 	static_cell_info::in, code_tree::out,
 	var_locn_info::in, var_locn_info::out) is det.
 
-%	assign_const_to_var(Var, ConstRval, !VarLocnInfo)
-%		Reflects the effect of the assignment Var := const(ConstRval)
-%		in the state of VarLocnInfo0 to yield VarLocnInfo.
-
+	% assign_const_to_var(Var, ConstRval, !VarLocnInfo)
+	%
+	% Reflects the effect of the assignment Var := const(ConstRval)
+	% in the state of VarLocnInfo0 to yield VarLocnInfo.
+	%
 :- pred assign_const_to_var(prog_var::in, rval::in,
 	var_locn_info::in, var_locn_info::out) is det.
 
-%	assign_expr_to_var(Var, Rval, Code, !VarLocnInfo)
-%		Generates code to execute the assignment Var := Expr, and
-%		updates the state of VarLocnInfo0 accordingly.
-%
-%		Expr must contain no lvals, although it may (and typically
-%		will) refer to the values of other variables through rvals
-%		of the form var(_).
-
+	% assign_expr_to_var(Var, Rval, Code, !VarLocnInfo)
+	%
+	% Generates code to execute the assignment Var := Expr, and
+	% updates the state of VarLocnInfo0 accordingly.
+	%
+	% Expr must contain no lvals, although it may (and typically
+	% will) refer to the values of other variables through rvals
+	% of the form var(_).
+	%
 :- pred assign_expr_to_var(prog_var::in, rval::in, code_tree::out,
 	var_locn_info::in, var_locn_info::out) is det.
 
-%	assign_cell_to_var(Var, ReserveWordAtStart, Ptag, Vector, SizeInfo,
-%			TypeMsg, Code, !StaticCellInfo, !VarLocnInfo)
-%		Generates code to assign to Var a pointer, tagged by Ptag, to
-%		the cell whose contents are given by the other arguments,
-%		and updates the state of VarLocnInfo0 accordingly.
-%		If ReserveWordAtStart is yes, and the cell is allocated on
-%		the heap (rather than statically), then reserve an extra
-%		word immediately before the allocated object, for the
-%		garbage collector to use to hold a forwarding pointer.
-%		If SizeInfo is yes(SizeVal), then reserve an extra word
-%		immediately before the allocated object (regardless
-%		of whether it is allocated statically or dynamically),
-%		and initialize this word with the value determined by
-%		SizeVal.
-%		NOTE: ReserveWordAtStart and SizeInfo should not both be
-%		yes / yes(_), because that will cause an obvious conflict!
-
+	% assign_cell_to_var(Var, ReserveWordAtStart, Ptag, Vector, SizeInfo,
+	%	TypeMsg, Code, !StaticCellInfo, !VarLocnInfo)
+	%
+	% Generates code to assign to Var a pointer, tagged by Ptag, to
+	% the cell whose contents are given by the other arguments,
+	% and updates the state of VarLocnInfo0 accordingly.
+	% If ReserveWordAtStart is yes, and the cell is allocated on
+	% the heap (rather than statically), then reserve an extra
+	% word immediately before the allocated object, for the
+	% garbage collector to use to hold a forwarding pointer.
+	% If SizeInfo is yes(SizeVal), then reserve an extra word
+	% immediately before the allocated object (regardless
+	% of whether it is allocated statically or dynamically),
+	% and initialize this word with the value determined by
+	% SizeVal.
+	% NOTE: ReserveWordAtStart and SizeInfo should not both be
+	% yes / yes(_), because that will cause an obvious conflict!
+	%
 :- pred assign_cell_to_var(prog_var::in, bool::in, tag::in,
-	list(maybe(rval))::in, maybe(term_size_value)::in, string::in,
-	code_tree::out, static_cell_info::in, static_cell_info::out,
-	var_locn_info::in, var_locn_info::out) is det.
-
-%	place_var(Var, Lval, Code, !VarLocnInfo)
-%		Produces Code and a modified version of VarLocnInfo0,
-%		VarLocnInfo which places the value of Var in Lval.
+	list(maybe(rval))::in, maybe(term_size_value)::in,
+	string::in, code_tree::out, static_cell_info::in,
+	static_cell_info::out, var_locn_info::in, var_locn_info::out) is det.
 
+	% place_var(Var, Lval, Code, !VarLocnInfo)
+	%
+	% Produces Code and a modified version of VarLocnInfo0,
+	% VarLocnInfo which places the value of Var in Lval.
+	%
 :- pred place_var(prog_var::in, lval::in, code_tree::out,
 		var_locn_info::in, var_locn_info::out) is det.
 
-%	place_vars(VarLocns, Code, !VarLocnInfo)
-%		Produces Code and a modified version of VarLocnInfo0,
-%		VarLocnInfo which places the value of each variable
-%		mentioned in VarLocns into the corresponding location.
-
+	% place_vars(VarLocns, Code, !VarLocnInfo)
+	%
+	% Produces Code and a modified version of VarLocnInfo0,
+	% VarLocnInfo which places the value of each variable
+	% mentioned in VarLocns into the corresponding location.
+	%
 :- pred place_vars(assoc_list(prog_var, lval)::in, code_tree::out,
 	var_locn_info::in, var_locn_info::out) is det.
 
-%	produce_var(Var, Rval, Code, !VarLocnInfo)
-%		Return the preferred way to refer to the value of Var
-%		(which may be a const rval, or the value in an lval).
-%
-% 		If Var is currently a cached expression, then produce_var
-%		will generate Code to evaluate the expression and put it
-%		into an lval. (Since the code generator can ask for a variable
-%		to be produced more than once, this is necessary to prevent
-%		the expression, which may involve a possibly large number
-%		of operations, from being evaluated several times.) Otherwise,
-%		Code will be empty.
-
+	% produce_var(Var, Rval, Code, !VarLocnInfo)
+	%
+	% Return the preferred way to refer to the value of Var
+	% (which may be a const rval, or the value in an lval).
+	%
+	% If Var is currently a cached expression, then produce_var
+	% will generate Code to evaluate the expression and put it
+	% into an lval. (Since the code generator can ask for a variable
+	% to be produced more than once, this is necessary to prevent
+	% the expression, which may involve a possibly large number
+	% of operations, from being evaluated several times.) Otherwise,
+	% Code will be empty.
+	%
 :- pred produce_var(prog_var::in, rval::out, code_tree::out,
 	var_locn_info::in, var_locn_info::out) is det.
 
-%	produce_var_in_reg(Var, Lval, Code, !VarLocnInfo)
-%		Produces a code fragment Code to evaluate Var if necessary
-%		and provide it as an Lval of the form reg(_).
-
+	% produce_var_in_reg(Var, Lval, Code, !VarLocnInfo)
+	%
+	% Produces a code fragment Code to evaluate Var if necessary
+	% and provide it as an Lval of the form reg(_).
+	%
 :- pred produce_var_in_reg(prog_var::in, lval::out, code_tree::out,
 	var_locn_info::in, var_locn_info::out) is det.
 
-%	produce_var_in_reg_or_stack(Var, FollowVars, Lval, Code, !VarLocnInfo)
-%		Produces a code fragment Code to evaluate Var if necessary
-%		and provide it as an Lval of the form reg(_), stackvar(_),
-%		or framevar(_).
-
+	% produce_var_in_reg_or_stack(Var, FollowVars, Lval, Code, !VarLocnInfo)
+	%
+	% Produces a code fragment Code to evaluate Var if necessary
+	% and provide it as an Lval of the form reg(_), stackvar(_),
+	% or framevar(_).
+	%
 :- pred produce_var_in_reg_or_stack(prog_var::in, lval::out,
 	code_tree::out, var_locn_info::in, var_locn_info::out) is det.
 
-%	acquire_reg(Lval, !VarLocnInfo)
-%		Finds an unused register and marks it as 'in use'.
-
+	% acquire_reg(Lval, !VarLocnInfo)
+	%
+	% Finds an unused register and marks it as 'in use'.
+	%
 :- pred acquire_reg(lval::out,
 	var_locn_info::in, var_locn_info::out) is det.
 
-%	acquire_reg_require_given(Reg, Lval, !VarLocInfo)
-%		Marks Reg, which must be an unused register, as 'in use'.
-
+	% acquire_reg_require_given(Reg, Lval, !VarLocInfo)
+	%
+	% Marks Reg, which must be an unused register, as 'in use'.
+	%
 :- pred acquire_reg_require_given(lval::in,
 	var_locn_info::in, var_locn_info::out) is det.
 
-%	acquire_reg_prefer_given(Pref, Lval, !VarLocInfo)
-%		Finds an unused register, and marks it as 'in use'.
-%		If Pref itself is free, assigns that.
-
+	% acquire_reg_prefer_given(Pref, Lval, !VarLocInfo)
+	%
+	% Finds an unused register, and marks it as 'in use'.
+	% If Pref itself is free, assigns that.
+	%
 :- pred acquire_reg_prefer_given(int::in, lval::out,
 	var_locn_info::in, var_locn_info::out) is det.
 
-%	acquire_reg_start_at_given(Start, Lval, !VarLocInfo)
-%		Finds an unused register, and marks it as 'in use'.
-%		It starts the search at the one numbered Start,
-%		continuing towards higher register numbers.
-
+	% acquire_reg_start_at_given(Start, Lval, !VarLocInfo)
+	%
+	% Finds an unused register, and marks it as 'in use'.
+	% It starts the search at the one numbered Start,
+	% continuing towards higher register numbers.
+	%
 :- pred acquire_reg_start_at_given(int::in, lval::out,
 	var_locn_info::in, var_locn_info::out) is det.
 
-%	release_reg(Lval, !VarLocnInfo)
-%		Marks a previously acquired reg as no longer 'in use'.
-
+	% release_reg(Lval, !VarLocnInfo)
+	%
+	% Marks a previously acquired reg as no longer 'in use'.
+	%
 :- pred release_reg(lval::in, var_locn_info::in, var_locn_info::out) is det.
 
-%	lock_regs(N, Exceptions, !VarLocnInfo)
-%		Prevents registers r1 through rN from being reused, even if
-%		there are no variables referring to them, with the exceptions
-%		of the registers named in Exceptions, which however can only be
-%		used to store their corresponding variables. Should be followed
-%		by a call to unlock_regs.
-
+	% lock_regs(N, Exceptions, !VarLocnInfo)
+	%
+	% Prevents registers r1 through rN from being reused, even if
+	% there are no variables referring to them, with the exceptions
+	% of the registers named in Exceptions, which however can only be
+	% used to store their corresponding variables. Should be followed
+	% by a call to unlock_regs.
+	%
 :- pred lock_regs(int::in, assoc_list(prog_var, lval)::in,
 	var_locn_info::in, var_locn_info::out) is det.
 
-%	unlock_regs(!VarLocnInfo)
-%		Undoes a lock operation.
-
+	% unlock_regs(!VarLocnInfo)
+	%
+	% Undoes a lock operation.
+	%
 :- pred unlock_regs(var_locn_info::in, var_locn_info::out) is det.
 
-%	clear_r1(Code)
-%		Produces a code fragment Code to move whatever is in r1
-%		to some other register, if r1 is live.  This is used
-%		prior to semidet pragma c_codes.
-
+	% clear_r1(Code)
+	%
+	% Produces a code fragment Code to move whatever is in r1
+	% to some other register, if r1 is live.  This is used
+	% prior to semidet pragma c_codes.
+	%
 :- pred clear_r1(code_tree::out, var_locn_info::in, var_locn_info::out) is det.
 
-%	materialize_vars_in_lval(Lval, FinalLval, Code,
-%			!VarLocnInfo)
-%		For every variable in Lval, substitutes the value of the
-%		variable and returns it as FinalLval. If we need to save the
-%		values of some of the substituted variables somewhere so as to
-%		prevent them from being evaluated again (and again ...), the
-%		required code will be returned in Code.
-
+	% materialize_vars_in_lval(Lval, FinalLval, Code, !VarLocnInfo)
+	%
+	% For every variable in Lval, substitutes the value of the
+	% variable and returns it as FinalLval. If we need to save the
+	% values of some of the substituted variables somewhere so as to
+	% prevent them from being evaluated again (and again ...), the
+	% required code will be returned in Code.
+	%
 :- pred materialize_vars_in_lval(lval::in, lval::out, code_tree::out,
 	var_locn_info::in, var_locn_info::out) is det.
 
-%	get_var_locations(VarLocnInfo, Locations)
-%		Returns a map from each live variable that occurs in
-%		VarLocnInfo to the set of locations in which it may be found
-%		(which may be empty, if the variable's value is either a known
-%		constant, or an as-yet unevaluated expression).
-
+	% get_var_locations(VarLocnInfo, Locations)
+	%
+	% Returns a map from each live variable that occurs in
+	% VarLocnInfo to the set of locations in which it may be found
+	% (which may be empty, if the variable's value is either a known
+	% constant, or an as-yet unevaluated expression).
+	%
 :- pred get_var_locations(var_locn_info::in, map(prog_var, set(lval))::out)
 	is det.
 
-%	get_stack_slots(VarLocnInfo, StackSlots)
-%		Returns the table mapping each variable to its stack slot
-%		(if any).
-
+	% get_stack_slots(VarLocnInfo, StackSlots)
+	%
+	% Returns the table mapping each variable to its stack slot
+	% (if any).
+	%
 :- pred get_stack_slots(var_locn_info::in, stack_slots::out) is det.
 
-%	get_follow_vars(VarLocnInfo, FollowVars)
-%		Returns the table mapping each variable to the lval (if any)
-%		where it is desired next.
-
+	% get_follow_vars(VarLocnInfo, FollowVars)
+	%
+	% Returns the table mapping each variable to the lval (if any)
+	% where it is desired next.
+	%
 :- pred get_follow_var_map(var_locn_info::in, abs_follow_vars_map::out) is det.
 
-%	get_next_non_reserved(VarLocnInfo, NonRes)
-%		Returns the number of the first register which is free for
-%		general use. It does not reserve the register.
-
+	% get_next_non_reserved(VarLocnInfo, NonRes)
+	%
+	% Returns the number of the first register which is free for
+	% general use. It does not reserve the register.
+	%
 :- pred get_next_non_reserved(var_locn_info::in, int::out) is det.
 
-%	set_follow_vars(FollowVars)
-%		Sets the table mapping each variable to the lval (if any)
-%		where it is desired next, and the number of the first
-%		non-reserved register.
-
+	% set_follow_vars(FollowVars)
+	%
+	% Sets the table mapping each variable to the lval (if any)
+	% where it is desired next, and the number of the first
+	% non-reserved register.
+	%
 :- pred set_follow_vars(abs_follow_vars::in,
 	var_locn_info::in, var_locn_info::out) is det.
 
-%	max_reg_in_use(MaxReg)
-%		Returns the number of the highest numbered rN register in use.
-
+	% max_reg_in_use(MaxReg)
+	%
+	% Returns the number of the highest numbered rN register in use.
+	%
 :- pred max_reg_in_use(var_locn_info::in, int::out) is det.
 
 %----------------------------------------------------------------------------%
@@ -811,8 +843,8 @@
 	).
 
 :- pred assign_dynamic_cell_to_var(prog_var::in, bool::in, tag::in,
-	list(maybe(rval))::in, maybe(int)::in, string::in, code_tree::out,
-	var_locn_info::in, var_locn_info::out) is det.
+	list(maybe(rval))::in, maybe(int)::in, string::in,
+	code_tree::out, var_locn_info::in, var_locn_info::out) is det.
 
 assign_dynamic_cell_to_var(Var, ReserveWordAtStart, Ptag, Vector, MaybeOffset,
 		TypeMsg, Code, !VLI) :-
@@ -821,17 +853,21 @@
 	select_preferred_reg_or_stack_check(!.VLI, Var, Lval),
 	get_var_name(!.VLI, Var, VarName),
 	list__length(Vector, Size),
-	( ReserveWordAtStart = yes ->
-		( MaybeOffset = yes(_) ->
+	(
+		ReserveWordAtStart = yes,
+		(
+			MaybeOffset = yes(_),
 			% Accurate GC and term profiling both want to own
 			% the word before this object
 			sorry(this_file, "accurate GC combined with " ++
 				"term size profiling")
 		;
+			MaybeOffset = no,
 			TotalOffset = yes(1)
 		),
 		TotalSize = Size + 1
 	;
+		ReserveWordAtStart = no,
 		TotalOffset = MaybeOffset,
 		TotalSize = Size
 	),
cvs diff: Diffing notes
--------------------------------------------------------------------------
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