[m-rev.] for review: debugging infrastructure for the deep profiler

Zoltan Somogyi zs at cs.mu.OZ.AU
Fri Apr 22 16:58:23 AEST 2005


For review by Julien.

Zoltan.

Significantly enhance the infrastructure for debugging problems with the deep
profiler by providing facilities for dumping out some of the main data
structures. These were needed for my recent fix of mercury_deep_profiling.c
in the runtime.

There are no algorithmic changes in the non-debugging parts of the code.

deep_profiler/dump.m:
	New module for containing predicates that dump data structures.
	The first draft was by Julien.

deep_profiler/mdprof_dump.m:
	New program for dumping out the contents of Deep.data files.
	The first draft was by Julien.

deep_profiler/startup.m:
	Provide a mechanism for dumping out the main data structures at three
	stages.

deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_test.m:
	Pass the options to startup to control these dumps.

deep_profiler/measurements.m:
	Provide a mechanism for getting all the counts of a measurement at
	once.

deep_profiler/array_util.m:
	Provide extra modes of some predicates for use in the other modules.

deep_profiler/read_profile.m:
	Fix Julien's fix: handle init predicates as well as the other uci
	predicates.

deep_profiler/profile.m:
	Reorder the arguments of predicates as required to enable the use
	of state variable notation in the callers.

deep_profiler/*.m:
	Conform to the change in profile.m, and use state variable notation
	where this is advantageous.

	Convert some modules to four-space indentation where this eliminates
	excessive indentation or bad line breaks.

deep_profiler/Mmakefile:
	Handle the new mdprof_dump program.

cvs diff: Diffing .
Index: Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/Mmakefile,v
retrieving revision 1.13
diff -u -b -r1.13 Mmakefile
--- Mmakefile	14 Jan 2005 05:53:29 -0000	1.13
+++ Mmakefile	18 Apr 2005 06:24:17 -0000
@@ -16,10 +16,12 @@
 # can be found by `mmc --make'.
 include Mercury.options
 
+ALL_DEEP_MODULES=mdprof_cgi mdprof_test mdprof_dump
+
 ifeq ("$(ENABLE_DEEP_PROFILER)","yes")
 	MAIN_TARGET=all
-	MERCURY_MAIN_MODULES=mdprof_cgi mdprof_test
-	DEPEND=mdprof_cgi.depend mdprof_test.depend
+	MERCURY_MAIN_MODULES=$(ALL_DEEP_MODULES)
+	DEPEND=$(patsubst %,%.depend,$(ALL_DEEP_MODULES))
 	INSTALL=install_cgi_progs
 else
 	MAIN_TARGET=nothing
@@ -28,7 +30,7 @@
 	# include the generated .c files for the deep profiler,
 	# even if deep profiling wasn't enabled on this host.
 	# That implies that we need to make the dependencies.
-	DEPEND=mdprof_cgi.depend mdprof_test.depend
+	DEPEND=$(patsubst %,%.depend,$(ALL_DEEP_MODULES))
 	INSTALL=nothing
 endif
 
@@ -49,7 +51,7 @@
 depend:	$(DEPEND)
 
 .PHONY: all
-all:	mdprof_cgi mdprof_test $(TAGS_FILE_EXISTS)
+all:	$(ALL_DEEP_MODULES) $(TAGS_FILE_EXISTS)
 
 #-----------------------------------------------------------------------------#
 
@@ -61,20 +63,23 @@
 mdprof_cgi:	$(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
 mdprof_test:	$(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
 mdprof_test:	$(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
+mdprof_dump:	$(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
+mdprof_dump:	$(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
 # XXX Should also depend on $(BOEHM_GC_DIR)/libgc(_prof).$A, but only
 # if in .gc(.prof) grade.
 endif
 
 $(cs_subdir)mdprof_cgi_init.c:		$(UTIL_DIR)/mkinit
 $(cs_subdir)mdprof_test_init.c:		$(UTIL_DIR)/mkinit
+$(cs_subdir)mdprof_dump_init.c:		$(UTIL_DIR)/mkinit
 
 #-----------------------------------------------------------------------------#
 
 .PHONY: check
-check:	mdprof_cgi.check mdprof_test.check
+check:	DEPEND=$(patsubst %,%.check,$(ALL_DEEP_MODULES))
 
 .PHONY: ints 
-ints:	mdprof_cgi.ints mdprof_test.ints
+ints:	DEPEND=$(patsubst %,%.ints,$(ALL_DEEP_MODULES))
 
 #-----------------------------------------------------------------------------#
 
@@ -86,29 +91,33 @@
 .PHONY: tags
 tags:	.deep.tags
 
-.deep.tags: $(MTAGS) $(mdprof_cgi.ms) $(mdprof_test.ms) $(LIBRARY_DIR)/*.m
-	$(MTAGS) $(mdprof_cgi.ms) $(mdprof_test.ms) $(LIBRARY_DIR)/*.m
+DEEP_MS = $(mdprof_cgi.ms) $(mdprof_test.ms) $(mdprof_dump.ms)
+
+.deep.tags: $(MTAGS) $(DEEP_MS) $(LIBRARY_DIR)/*.m
+	$(MTAGS) $(DEEP_MS) $(LIBRARY_DIR)/*.m
 	touch .deep.tags
 
 .PHONY: tags_file_exists
 tags_file_exists:
 	@if test ! -f tags; then echo making tags; \
-	$(MTAGS) $(mdprof_cgi.ms) $(mdprof_test.ms) $(LIBRARY_DIR)/*.m; \
+	$(MTAGS) $(DEEP_MS) $(LIBRARY_DIR)/*.m; \
 	touch .deep.tags; fi
 
 #-----------------------------------------------------------------------------#
 
 .PHONY: dates
 dates:
-	touch $(mdprof_cgi.dates) $(mdprof_test.dates)
+	touch $(mdprof_cgi.dates) $(mdprof_test.dates) $(mdprof_dump.dates)
 
 #-----------------------------------------------------------------------------#
 
 .PHONY: os cs
 os: $(mdprof_cgi.os) $(os_subdir)mdprof_cgi_init.o
 os: $(mdprof_test.os) $(os_subdir)mdprof_test_init.o
+os: $(mdprof_dump.os) $(os_subdir)mdprof_dump_init.o
 cs: $(mdprof_cgi.cs) $(cs_subdir)mdprof_cgi_init.c
 cs: $(mdprof_test.cs) $(cs_subdir)mdprof_test_init.c
+cs: $(mdprof_dump.cs) $(cs_subdir)mdprof_dump_init.c
 
 #-----------------------------------------------------------------------------#
 
Index: array_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/array_util.m,v
retrieving revision 1.5
diff -u -b -r1.5 array_util.m
--- array_util.m	24 Mar 2005 01:10:26 -0000	1.5
+++ array_util.m	18 Apr 2005 07:17:59 -0000
@@ -60,6 +60,8 @@
 	in, array_di, array_uo, in, out) is det.
 :- mode array_foldl2_from_1(pred(in, in, in, out, di, uo) is det,
 	in, in, out, di, uo) is det.
+:- mode array_foldl2_from_1(pred(in, in, in, out, in, out) is det,
+	in, in, out, in, out) is det.
 
 	% Performs a foldl2 on all the elements of the given array
 	% between the two index values given by the first two arguments,
@@ -75,6 +77,8 @@
 	array_di, array_uo, in, out) is det.
 :- mode array_foldl2(in, in, pred(in, in, in, out, di, uo) is det, in,
 	in, out, di, uo) is det.
+:- mode array_foldl2(in, in, pred(in, in, in, out, in, out) is det, in,
+	in, out, in, out) is det.
 
 	% Performs the same computation as list__foldl; the only difference
 	% is that the accumulator is an array and has an array mode.
Index: canonical.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/canonical.m,v
retrieving revision 1.5
diff -u -b -r1.5 canonical.m
--- canonical.m	24 Mar 2005 01:10:27 -0000	1.5
+++ canonical.m	18 Apr 2005 09:36:28 -0000
@@ -260,8 +260,8 @@
 			InitDeep0, InitDeep1, Redirect1, Redirect),
 		PrimePD = PrimePD0 ^ pd_sites := PrimeSites,
 		ProcDynamics1 = InitDeep1 ^ init_proc_dynamics,
-		update_proc_dynamics(u(ProcDynamics1), PrimePDPtr, PrimePD,
-			ProcDynamics),
+		update_proc_dynamics(PrimePDPtr, PrimePD,
+			u(ProcDynamics1), ProcDynamics),
 		InitDeep = InitDeep1 ^ init_proc_dynamics := ProcDynamics,
 		ChosenPDPtr = PrimePDPtr
 	;
@@ -400,8 +400,8 @@
 		lookup_call_site_dynamics(CallSiteDynamics0, FirstCSDPtr,
 			FirstCSD0),
 		FirstCSD = FirstCSD0 ^ csd_caller := ParentPDPtr,
-		update_call_site_dynamics(u(CallSiteDynamics0), FirstCSDPtr,
-			FirstCSD, CallSiteDynamics),
+		update_call_site_dynamics(FirstCSDPtr, FirstCSD,
+			u(CallSiteDynamics0), CallSiteDynamics),
 		InitDeep1 = InitDeep0 ^ init_call_site_dynamics
 			:= CallSiteDynamics,
 		(
@@ -449,8 +449,8 @@
 	PrimeOwn0 = PrimeCSD0 ^ csd_own_prof,
 	list__foldl(accumulate_csd_owns, RestCSDs, PrimeOwn0, PrimeOwn1),
 	PrimeCSD1 = PrimeCSD0 ^ csd_own_prof := PrimeOwn1,
-	update_call_site_dynamics(u(CallSiteDynamics0), PrimeCSDPtr, PrimeCSD1,
-		CallSiteDynamics1),
+	update_call_site_dynamics(PrimeCSDPtr, PrimeCSD1,
+		u(CallSiteDynamics0), CallSiteDynamics1),
 	InitDeep1 = InitDeep0 ^ init_call_site_dynamics := CallSiteDynamics1,
 	(
 		MergeChildren = no,
@@ -467,8 +467,8 @@
 		lookup_call_site_dynamics(CallSiteDynamics2, PrimeCSDPtr,
 			PrimeCSD2),
 		PrimeCSD = PrimeCSD2 ^ csd_callee := ChosenPDPtr,
-		update_call_site_dynamics(u(CallSiteDynamics2),
-			PrimeCSDPtr, PrimeCSD, CallSiteDynamics),
+		update_call_site_dynamics(PrimeCSDPtr, PrimeCSD,
+			u(CallSiteDynamics2), CallSiteDynamics),
 		InitDeep = InitDeep2 ^ init_call_site_dynamics
 			:= CallSiteDynamics
 	).
Index: dump.m
===================================================================
RCS file: dump.m
diff -N dump.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ dump.m	18 Apr 2005 09:22:48 -0000
@@ -0,0 +1,378 @@
+:- module dump.
+
+:- interface.
+
+:- import_module profile.
+
+:- import_module io.
+:- import_module bool.
+
+	% dump_initial_deep(ProfStats, Restrict, DumpCSDs, DumpPDs,
+	%	DumpCSSs, DumpPSs, InitialDeep, !IO):
+	% Dump selected parts of InitialDeep to standard output. The array
+	% of call site dynamics, proc dynamics, call site statics and proc
+	% statics is dumped if the corresponding Dump bool is "yes". If
+	% Restrict is "yes", then the only the elements of the static arrays
+	% that will be dumped are the ones that are referred to from the
+	% dynamic arrays. The statistics and the root node are dumped if
+	% ProfStats is "yes".
+
+:- pred dump_initial_deep(bool::in, bool::in, bool::in, bool::in, bool::in,
+	bool::in, initial_deep::in, io::di, io::uo) is det.
+
+:- implementation.
+
+:- import_module array_util.
+:- import_module measurements.
+
+:- import_module list.
+:- import_module set.
+:- import_module std_util.
+:- import_module string.
+:- import_module svset.
+
+%----------------------------------------------------------------------------%
+
+dump_initial_deep(ProfStats, Restrict, DumpCSDs, DumpPDs, DumpCSSs, DumpPSs,
+		InitialDeep, !IO) :-
+	InitialDeep = initial_deep(Stats, InitRoot, CSDs, PDs, CSSs, PSs),
+	(
+		Restrict = yes,
+		get_static_ptrs_from_dynamic_procs(PDs, UsedPSs, UsedCSSs),
+		Restriction = these(UsedPSs, UsedCSSs)
+	;
+		Restrict = no,
+		Restriction = none
+	),
+	( 
+		ProfStats = yes,
+		dump_init_profile_stats(Stats, !IO),
+		dump_init_root(InitRoot, !IO)
+	;
+		ProfStats = no
+	),
+	(
+		DumpCSDs= yes,
+		dump_init_call_site_dynamics(CSDs, !IO)
+	;
+		DumpCSDs = no
+	),
+	(
+		DumpPDs = yes,
+		dump_init_proc_dynamics(PDs, PSs, !IO)
+	;
+		DumpPDs = no
+	),
+	(
+		DumpCSSs = yes,
+		dump_init_call_site_statics(CSSs, !IO)
+	;
+		DumpCSSs = no
+	),
+	(
+		DumpPSs = yes,
+		dump_init_proc_statics(Restriction, PSs, !IO)
+	;
+		DumpPSs = no
+	).
+	
+%----------------------------------------------------------------------------%
+%
+% Restricting static structures to those referenced by dynamic ones.
+%
+
+:- type restriction
+	---> 	none
+	;	these(set(proc_static_ptr), set(call_site_static_ptr)).
+
+:- pred get_static_ptrs_from_dynamic_procs(proc_dynamics::in,
+	set(proc_static_ptr)::out, set(call_site_static_ptr)::out) is det.
+
+get_static_ptrs_from_dynamic_procs(ProcDynamics, PS_Ptrs, CSS_Ptrs) :-
+	array_foldl2_from_1(get_static_ptrs_from_dynamic_proc,
+		ProcDynamics, set.init, PS_Ptrs, set.init, CSS_Ptrs).
+
+:- pred get_static_ptrs_from_dynamic_proc(int::in, proc_dynamic::in,
+	set(proc_static_ptr)::in, set(proc_static_ptr)::out,
+	set(call_site_static_ptr)::in, set(call_site_static_ptr)::out) is det.
+
+get_static_ptrs_from_dynamic_proc(_, ProcDynamic, !PS_Ptrs, !CSS_Ptrs) :-
+	ProcDynamic = proc_dynamic(PD_ProcStatic, _PDSites),
+	svset.insert(PD_ProcStatic, !PS_Ptrs).	
+
+%----------------------------------------------------------------------------%
+%
+% Code for dumping profile_stats.
+%
+
+:- pred dump_init_profile_stats(profile_stats::in, io::di, io::uo) is det.
+
+dump_init_profile_stats(Stats, !IO) :-
+	Stats = profile_stats(MaxCSD, MaxCSS, MaxPD, MaxPS, TicksPerSec,
+		InstrumentQuanta, UserQuanta, WordSize, Canonical),
+	io.write_string("SECTION PROFILING STATS:\n\n", !IO),
+	io.format("\tmax_csd = %d\n", [i(MaxCSD)], !IO),
+	io.format("\tmax_css = %d\n", [i(MaxCSS)], !IO),
+	io.format("\tmax_pd  = %d\n", [i(MaxPD)],  !IO),
+	io.format("\tmax_ps  = %d\n", [i(MaxPS)],  !IO),
+	io.format("\tticks_per_sec = %d\n", [i(TicksPerSec)], !IO),
+	io.format("\tinstrument_quanta = %d\n", [i(InstrumentQuanta)], !IO),
+	io.format("\tuser_quanta = %d\n", [i(UserQuanta)], !IO),
+	io.format("\tword_size   = %d\n", [i(WordSize)], !IO),
+	io.write_string("\tcanonical = ", !IO),
+	(
+		Canonical = yes,
+		io.write_string("yes\n", !IO)
+	;
+		Canonical = no,
+		io.write_string("no\n", !IO)
+	),
+	io.nl(!IO).
+
+%----------------------------------------------------------------------------%
+
+:- pred dump_init_root(proc_dynamic_ptr::in, io::di, io::uo) is det.
+
+dump_init_root(proc_dynamic_ptr(Root), !IO) :-
+	io.write_string("INITIAL ROOT:\n", !IO),
+	io.format("\tinitial root = %d\n", [i(Root)], !IO),
+	io.nl(!IO).	
+
+%----------------------------------------------------------------------------%
+
+:- pred dump_init_call_site_dynamics(call_site_dynamics::in, io::di, io::uo)
+	is det.
+
+dump_init_call_site_dynamics(CallSiteDynamics, !IO) :-
+	io.write_string("SECTION CALL SITE DYNAMICS:\n\n", !IO),
+	array_foldl_from_1(dump_call_site_dynamic, CallSiteDynamics, !IO).
+
+:- pred dump_call_site_dynamic(int::in, call_site_dynamic::in, io::di, io::uo)
+	is det.
+
+dump_call_site_dynamic(Index, CallSiteDynamic, !IO) :-
+	CallSiteDynamic = call_site_dynamic(CallerPDPtr, CalleePDPtr, Own),
+	CallerPDPtr = proc_dynamic_ptr(CallerPDI),
+	CalleePDPtr = proc_dynamic_ptr(CalleePDI),
+	io.format("csd%d:\n", [i(Index)], !IO),
+	io.format("\tcsd_caller = pd%d\n", [i(CallerPDI)], !IO),
+	io.format("\tcsd_callee = pd%d\n", [i(CalleePDI)], !IO),
+	dump_own_prof_info(Own, !IO),
+	io.nl(!IO).	
+
+:- pred dump_own_prof_info(own_prof_info::in, io::di, io::uo) is det.
+
+dump_own_prof_info(Own, !IO) :-
+	decompress_profile(Own, Calls, Exits, Fails, Redos, Excps,
+		Quanta, Allocs, Words),
+	( Calls = 0 ->
+		true
+	;
+		io.format("\tcalls:\t%d\n", [i(Calls)], !IO)
+	),
+	( Exits = 0 ->
+		true
+	;
+		io.format("\texits:\t%d\n", [i(Exits)], !IO)
+	),
+	( Fails = 0 ->
+		true
+	;
+		io.format("\tfails:\t%d\n", [i(Fails)], !IO)
+	),
+	( Redos = 0 ->
+		true
+	;
+		io.format("\tredos:\t%d\n", [i(Redos)], !IO)
+	),
+	( Excps = 0 ->
+		true
+	;
+		io.format("\texcps:\t%d\n", [i(Excps)], !IO)
+	),
+	( Quanta = 0 ->
+		true
+	;
+		io.format("\tquanta:\t%d\n", [i(Quanta)], !IO)
+	),
+	( Allocs = 0 ->
+		true
+	;
+		io.format("\tallocs:\t%d\n", [i(Allocs)], !IO)
+	),
+	( Words = 0 ->
+		true
+	;
+		io.format("\twords:\t%d\n", [i(Words)], !IO)
+	).
+
+%----------------------------------------------------------------------------%
+	
+:- pred dump_init_proc_dynamics(proc_dynamics::in, proc_statics::in,
+	io::di, io::uo) is det.
+
+dump_init_proc_dynamics(ProcDynamics, ProcStatics, !IO) :-
+	io.write_string("SECTION PROC DYNAMICS:\n\n", !IO),
+	array_foldl_from_1(dump_proc_dynamic(ProcStatics), ProcDynamics, !IO).
+
+:- pred dump_proc_dynamic(proc_statics::in, int::in, proc_dynamic::in,
+	io::di, io::uo) is det.
+
+dump_proc_dynamic(ProcStatics, Index, ProcDynamic, !IO) :-
+	ProcDynamic = proc_dynamic(PSPtr, Sites),
+	PSPtr = proc_static_ptr(PSI),	
+	lookup_proc_statics(ProcStatics, PSPtr, PS),
+	( PS ^ ps_refined_id = "" ->
+		RefinedPSId = "UNKNOWN_PS"
+	;
+		RefinedPSId = PS ^ ps_refined_id
+	),
+	io.format("pd%d:\n", [i(Index)], !IO),
+	io.format("\tpd_proc_static = %d (%s)\n", [i(PSI), s(RefinedPSId)],
+		!IO),
+	array_foldl_from_0(dump_call_site_array_slot, Sites, !IO),
+	io.nl(!IO).	
+
+:- pred dump_call_site_array_slot(int::in, call_site_array_slot::in,
+	io::di, io::uo) is det.
+
+dump_call_site_array_slot(Index, CSA_slot, !IO) :-
+	io.format("\tpd_site[%d] = %s\n",
+		[i(Index), s(call_site_array_slot_to_string(CSA_slot))], !IO).
+
+:- func call_site_array_slot_to_string(call_site_array_slot) = string.
+
+call_site_array_slot_to_string(normal(call_site_dynamic_ptr(CSDI))) = 
+	string.format("normal(csd%d)", [i(CSDI)]).
+call_site_array_slot_to_string(multi(_, _)) = "multi".
+	
+%----------------------------------------------------------------------------%
+
+:- pred dump_init_call_site_statics(call_site_statics::in, io::di, io::uo)
+	is det.
+
+dump_init_call_site_statics(CallStatics, !IO) :-
+	io.write_string("SECTION CALL SITE STATICS:\n\n", !IO),
+	array_foldl_from_1(dump_call_site_static, CallStatics, !IO).
+
+:- pred dump_call_site_static(int::in, call_site_static::in, io::di, io::uo)
+	is det.
+
+dump_call_site_static(Index, CallSiteStatic, !IO) :-
+	CallSiteStatic = call_site_static(ContainerPSPtr, SlotNum, Kind,
+		LineNum, GoalPath),
+	ContainerPSPtr = proc_static_ptr(ContainerPSI),
+	io.format("css%d:\n", [i(Index)], !IO),
+	io.format("\tcss_container\t= ps%d\n", [i(ContainerPSI)],
+		!IO),
+	io.format("\tcss_slot_num\t= <%d>\n", [i(SlotNum)], !IO),
+	io.format("\tcss_line_num\t= <%d>\n", [i(LineNum)], !IO),
+	io.format("\tcss_goal_path\t= <%s>\n", [s(GoalPath)], !IO),
+	io.write_string("\tcss_kind\t= ", !IO),
+	dump_call_site_kind_and_callee(Kind, !IO),
+	io.nl(!IO),
+	io.nl(!IO).
+
+%----------------------------------------------------------------------------%
+
+:- pred dump_init_proc_statics(restriction::in, proc_statics::in,
+	io::di, io::uo) is det.
+
+dump_init_proc_statics(Restriction, ProcStatics, !IO) :-
+	io.write_string("SECTION PROC STATICS:\n\n", !IO),
+	array_foldl_from_1(dump_proc_static(Restriction), ProcStatics, !IO),
+	io.nl(!IO).
+
+:- pred dump_proc_static(restriction::in, int::in, proc_static::in,
+	io::di, io::uo) is det.
+
+dump_proc_static(Restriction, Index, ProcStatic, !IO) :-
+	( 
+		(
+			Restriction = none
+		;
+			Restriction = these(UsedProcStatics, _),
+			set.member(proc_static_ptr(Index), UsedProcStatics)
+		)
+	->	 
+		ProcStatic = proc_static(Id, DeclModule, RefinedId, RawId,
+			FileName, LineNumber, InInterface, Sites, IsZeroed),
+		IdStr = dump_proc_id(Id),
+		io.format("ps%d:\n", [i(Index)], !IO),
+		io.format("\tps_id\t\t= %s", [s(IdStr)], !IO),
+		io.nl(!IO),
+		io.format("\tps_decl_module\t= %s\n", [s(DeclModule)], !IO),
+		( RefinedId = string.append_list([DeclModule, ":", IdStr]) ->
+			% The output is too big already; don't include
+			% redundant information.
+			true
+		;
+			io.format("\tps_refined_id\t= %s\n",
+				[s(RefinedId)], !IO)
+		),
+		( RefinedId \= RawId ->
+			% The output is too big already; don't include
+			% redundant information.
+			true
+		;
+			io.format("\tps_raw_id\t= %s\n", [s(RawId)], !IO)
+		),
+		io.format("\tlocation\t= %s:%d\n",
+			[s(FileName), i(LineNumber)], !IO),
+		(
+			InInterface = yes,
+			io.write_string("\tin_interface\n", !IO)
+		;
+			InInterface = no
+		),
+		IsZeroStr = (IsZeroed = zeroed -> "zeroed" ; "not_zeroed" ),
+		io.format("\t%s\n", [s(IsZeroStr)], !IO),
+		array_foldl_from_0(dump_proc_static_call_sites, Sites, !IO),
+		io.nl(!IO)
+	;
+		true
+	).
+
+:- pred dump_proc_static_call_sites(int::in, call_site_static_ptr::in,
+	io::di, io::uo) is det.
+
+dump_proc_static_call_sites(Slot, CSSPtr, !IO) :-
+	CSSPtr = call_site_static_ptr(CSSI),
+	io.format("\tps_site[%d]: css%d\n", [i(Slot), i(CSSI)], !IO).
+
+%----------------------------------------------------------------------------%
+
+:- func dump_proc_id(proc_id) = string.
+
+dump_proc_id(Proc) = Str :-
+	Proc = user_defined(PredOrFunc, _DeclModule, _DefnModule, Name,
+		Arity, Mode),
+	(
+		PredOrFunc = predicate,
+		Suffix = ""
+	;	
+		PredOrFunc = function,
+		Suffix = "+1"
+	),
+	string.format("%s/%d-%d%s", [s(Name), i(Arity), i(Mode), s(Suffix)],
+		Str).
+dump_proc_id(Proc) = Str :-
+	Proc = uci_pred(Type, _TypeModule, _DefModule, Name, _Arity, _Mode),
+	string.format("%s predicate for type `%s'", [s(Name), s(Type)], Str).
+
+%----------------------------------------------------------------------------%
+
+:- pred dump_call_site_kind_and_callee(call_site_kind_and_callee::in,
+	io::di, io::uo) is det.
+
+dump_call_site_kind_and_callee(normal_call(Ptr, String), !IO) :-
+	Ptr = proc_static_ptr(Val),
+	io.format("normal_call(%d, \"%s\")", [i(Val), s(String)], !IO).
+dump_call_site_kind_and_callee(special_call, !IO) :-
+	io.write_string("special_call", !IO).
+dump_call_site_kind_and_callee(higher_order_call, !IO) :-
+	io.write_string("higher_order_call", !IO).
+dump_call_site_kind_and_callee(method_call, !IO) :-
+	io.write_string("method_call", !IO).
+dump_call_site_kind_and_callee(callback, !IO) :-
+	io.write_string("callback", !IO).
Index: mdprof_cgi.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/mdprof_cgi.m,v
retrieving revision 1.8
diff -u -b -r1.8 mdprof_cgi.m
--- mdprof_cgi.m	24 Mar 2005 01:10:27 -0000	1.8
+++ mdprof_cgi.m	18 Apr 2005 10:01:41 -0000
@@ -289,7 +289,7 @@
 		MaybeStartupStream = no
 	),
 	read_and_startup(Machine, [FileName], Canonical, MaybeStartupStream,
-		Res, !IO),
+		[], Res, !IO),
 	(
 		Res = ok(Deep),
 		try_exec(Cmd, Pref, Deep, HTML, !IO),
@@ -452,7 +452,7 @@
 	CmdPref0 = cmd_pref(Cmd0, Pref0),
 	( Cmd0 = restart ->
 		read_and_startup(Deep0 ^ server_name, [Deep0 ^ data_file_name],
-			Canonical, MaybeStartupStream, MaybeDeep, !IO),
+			Canonical, MaybeStartupStream, [], MaybeDeep, !IO),
 		(
 			MaybeDeep = ok(Deep),
 			MaybeMsg = no,
Index: mdprof_dump.m
===================================================================
RCS file: mdprof_dump.m
diff -N mdprof_dump.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ mdprof_dump.m	18 Apr 2005 07:30:03 -0000
@@ -0,0 +1,169 @@
+:- module mdprof_dump.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io::di, io::uo) is det.
+
+%----------------------------------------------------------------------------%
+%----------------------------------------------------------------------------%
+
+:- implementation.
+
+:- import_module array_util.
+:- import_module dump.
+:- import_module profile.
+:- import_module read_profile.
+
+:- import_module bool.
+:- import_module char.
+:- import_module getopt.
+:- import_module list.
+:- import_module std_util.
+:- import_module string.
+
+%----------------------------------------------------------------------------%
+
+main(!IO) :-
+	io.progname_base("mdprof_dump", ProgName, !IO),
+	io.command_line_arguments(Args0, !IO),
+	OptionOps = option_ops_multi(short_option, long_option, defaults),
+	getopt.process_options(OptionOps, Args0, Args, MaybeOptions),
+	(
+		MaybeOptions = ok(Options),
+		getopt.lookup_bool_option(Options, help, NeedsHelp),
+		(
+			NeedsHelp = yes,
+			usage(ProgName, !IO)
+		;
+			NeedsHelp = no,
+			(
+				Args = [],
+				FileName = "Deep.data",
+				main_2(Options, FileName, !IO)
+			;
+				Args = [FileName],
+				main_2(Options, FileName, !IO)
+			;
+				Args = [_, _ | _],
+				usage(ProgName, !IO)
+			)
+		)
+	;
+		MaybeOptions = error(Message),
+		io.stderr_stream(Stderr, !IO),
+		io.format(Stderr, "%s: %s\n", [s(ProgName), s(Message)], !IO),
+		io.set_exit_status(1, !IO)
+	).
+
+:- pred main_2(option_table(option)::in, string::in, io::di, io::uo) is det.
+
+main_2(Options, FileName, !IO) :-
+	getopt.lookup_bool_option(Options, restrict_statics, Restrict),
+	getopt.lookup_bool_option(Options, dump_prof_stats, ProfStats0),
+	getopt.lookup_bool_option(Options, dump_call_site_dynamics, DumpCSDs0),
+	getopt.lookup_bool_option(Options, dump_proc_dynamics, DumpPDs0),
+	getopt.lookup_bool_option(Options, dump_call_site_statics, DumpCSSs0),
+	getopt.lookup_bool_option(Options, dump_proc_statics, DumpPSs0),
+	% If the user doesn't way what he/she wants, they dump everything.
+	(
+		ProfStats0 = no,
+		DumpCSDs0 = no,
+		DumpPDs0 = no,
+		DumpCSSs0 = no,
+		DumpPSs0 = no
+	->
+		ProfStats = yes,
+		DumpCSDs = yes,
+		DumpPDs = yes,
+		DumpCSSs = yes,
+		DumpPSs = yes
+	;
+		ProfStats = ProfStats0,
+		DumpCSDs = DumpCSDs0,
+		DumpPDs = DumpPDs0,
+		DumpCSSs = DumpCSSs0,
+		DumpPSs = DumpPSs0
+	),
+	read_call_graph(FileName, MaybeInitialDeep, !IO),
+	(
+		MaybeInitialDeep = ok(InitialDeep),
+		dump_initial_deep(ProfStats, Restrict, DumpCSDs, DumpPDs,
+			DumpCSSs, DumpPSs, InitialDeep, !IO)
+	;
+		MaybeInitialDeep = error(Msg),
+		io.format("Cannot read %s: %s\n", [s(Msg), s(FileName)], !IO)
+	).
+
+%----------------------------------------------------------------------------%
+%
+% Option processing.
+%
+
+:- type option
+	--->	help
+	;	dump_prof_stats
+	;	dump_call_site_dynamics
+	;	dump_proc_dynamics
+	;	dump_call_site_statics
+	;	dump_proc_statics
+	;	restrict_statics.
+
+:- type option_table == (option_table(option)).
+
+:- pred short_option(char::in, option::out) is semidet.
+
+short_option('h', help).
+
+:- pred long_option(string::in, option::out) is semidet.
+
+long_option("help", help).
+long_option("prof-stats", dump_prof_stats).
+long_option("call-site-dynamics", dump_call_site_dynamics).
+long_option("csd", dump_call_site_dynamics).
+long_option("proc-dynamics", dump_proc_dynamics).
+long_option("pd", dump_proc_dynamics).
+long_option("call-site-statics", dump_call_site_statics).
+long_option("css", dump_call_site_statics).
+long_option("proc-statics", dump_proc_statics).
+long_option("ps", dump_proc_statics).
+long_option("restrict-statics", restrict_statics).
+
+:- pred defaults(option::out, option_data::out) is multi.
+
+defaults(help, bool(no)).
+defaults(dump_prof_stats, bool(no)).
+defaults(dump_call_site_dynamics, bool(no)).
+defaults(dump_proc_dynamics, bool(no)).
+defaults(dump_call_site_statics, bool(no)).
+defaults(dump_proc_statics, bool(no)).
+defaults(restrict_statics, bool(no)).
+
+%----------------------------------------------------------------------------%
+
+:- pred usage(string::in, io::di, io::uo) is det.
+
+usage(ProgName, !IO) :-
+	io.stderr_stream(StdErr, !IO),
+	io.format(StdErr, "Usage: %s [<options>] [filename]\n", [s(ProgName)],
+		!IO),
+	io.write_string(StdErr, "Options:\n", !IO),
+	io.write_string(StdErr, "\t-h, --help\n", !IO),
+	io.write_string(StdErr, "\t\tDisplay this message.\n", !IO),
+	io.write_string(StdErr, "\t--csd, --call-site-dynamics\n", !IO),
+	io.write_string(StdErr, "\t\tDump call-site dynamics.\n", !IO),
+	io.write_string(StdErr, "\t--pd, --proc-dynamics\n", !IO),
+	io.write_string(StdErr, "\t\tDump proc dynamics.\n", !IO),
+	io.write_string(StdErr, "\t--css, --call-site-statics\n", !IO),
+	io.write_string(StdErr, "\t\tDump call-site statics.\n", !IO),
+	io.write_string(StdErr, "\t--ps, --proc-statics\n", !IO),
+	io.write_string(StdErr, "\t\tDump proc statics.\n", !IO),
+	io.write_string(StdErr, "\t--restrict-statics\n", !IO),
+	io.write_string(StdErr, "\t\tOnly dump those proc and ", !IO),
+	io.write_string(StdErr, "call-site statics that are referenced ", !IO),
+	io.write_string(StdErr, "from the proc dynamics\n", !IO).
+
+%----------------------------------------------------------------------------%
+:- end_module mdprof_dump.
+%----------------------------------------------------------------------------%
Index: mdprof_test.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/mdprof_test.m,v
retrieving revision 1.6
diff -u -b -r1.6 mdprof_test.m
--- mdprof_test.m	24 Mar 2005 01:10:27 -0000	1.6
+++ mdprof_test.m	18 Apr 2005 10:09:37 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2002-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.
@@ -81,8 +83,19 @@
 main2(ProgName, Args, Options, !IO) :-
 	( Args = [FileName] ->
 		lookup_bool_option(Options, canonical_clique, Canonical),
+        lookup_bool_option(Options, verbose, Verbose),
+        lookup_accumulating_option(Options, dump, DumpStages),
 		server_name(Machine, !IO),
-		read_and_startup(Machine, [FileName], Canonical, no, Res, !IO),
+        (
+            Verbose = no,
+            MaybeOutput = no
+        ;
+            Verbose = yes,
+            io__stdout_stream(Stdout, !IO),
+            MaybeOutput = yes(Stdout)
+        ),
+        read_and_startup(Machine, [FileName], Canonical, MaybeOutput,
+            DumpStages, Res, !IO),
 		(
 			Res = ok(Deep),
 			lookup_bool_option(Options, test, Test),
@@ -90,10 +103,8 @@
 				Test = no
 			;
 				Test = yes,
-				lookup_string_option(Options, test_dir,
-					TestDir),
-				test_server(TestDir, default_preferences, Deep,
-					!IO)
+                lookup_string_option(Options, test_dir, TestDir),
+                test_server(TestDir, default_preferences, Deep, !IO)
 			)
 		;
 			Res = error(Error),
@@ -124,6 +135,7 @@
 	io__format("You should specify one of the following options:\n", []),
 	io__format("--help      Generate this help message.\n", []),
 	io__format("--version   Report the program's version number.\n", []),
+    io__format("--verbose   Generate progress messages during startup.\n", []),
 	io__format("--test      Test the deep profiler, generating all\n", []),
 	io__format("            possible web pages of the popular types.\n", []),
 	io__format("You may also specify the following options:.\n", []),
@@ -138,8 +150,7 @@
 	io::di, io::uo) is cc_multi.
 
 test_server(DirName, Pref, Deep, !IO) :-
-	string__format("test -d %s || mkdir -p %s",
-		[s(DirName), s(DirName)], Cmd),
+    string__format("test -d %s || mkdir -p %s", [s(DirName), s(DirName)], Cmd),
 	io__call_system(Cmd, _, !IO),
 	array__max(Deep ^ clique_members, NumCliques),
 	test_cliques(1, NumCliques, DirName, Pref, Deep, !IO),
@@ -209,10 +220,12 @@
 
 :- type option
 	--->	canonical_clique
+    ;       dump
 	;	flat
 	;	help
 	;	test
 	;	test_dir
+    ;       verbose
 	;	version.
 
 :- type options ---> options.
@@ -221,23 +234,29 @@
 :- pred short(char::in, option::out) is semidet.
 
 short('c',	canonical_clique).
+short('d',  dump).
+short('v',  verbose).
 short('D',	test_dir).
 short('T',	test).
 
 :- pred long(string::in, option::out) is semidet.
 
 long("canonical-clique",	canonical_clique).
+long("dump",                dump).
 long("help",			help).
 long("test",			test).
 long("test-dir",		test_dir).
+long("verbose",             verbose).
 long("version",			version).
 
 :- pred defaults(option::out, option_data::out) is multi.
 
 defaults(canonical_clique,	bool(no)).
+defaults(dump,              accumulating([])).
 defaults(help,			bool(no)).
 defaults(test,			bool(no)).
 defaults(test_dir,		string("deep_test")).
+defaults(verbose,           bool(no)).
 defaults(version,		bool(no)).
 
 %-----------------------------------------------------------------------------%
Index: measurements.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/measurements.m,v
retrieving revision 1.4
diff -u -b -r1.4 measurements.m
--- measurements.m	19 May 2004 03:59:40 -0000	1.4
+++ measurements.m	18 Apr 2005 08:18:35 -0000
@@ -52,6 +52,10 @@
 :- func compress_profile(int, int, int, int, int, int, int) = own_prof_info.
 :- func compress_profile(own_prof_info) = own_prof_info.
 
+	% decompress_profile
+:- pred decompress_profile(own_prof_info::in, int::out, int::out, int::out,
+	int::out, int::out, int::out, int::out, int::out) is det.
+
 :- func own_to_string(own_prof_info) = string.
 
 %-----------------------------------------------------------------------------%
@@ -253,6 +257,34 @@
 	).
 
 %-----------------------------------------------------------------------------%
+
+decompress_profile(Own, Calls, Exits, Fails, Redos, Excps,
+		Quanta, Allocs, Words) :-
+	(
+		Own = all(Exits, Fails, Redos, Excps, Quanta, Allocs, Words),
+		Calls = Exits + Fails + Redos
+	;
+		Own = det(Exits, Quanta, Allocs, Words),
+		Calls = Exits,
+		Fails = 0,
+		Redos = 0,
+		Excps = 0
+	;
+		Own = fast_det(Exits, Allocs, Words),
+		Calls = Exits,
+		Fails = 0,
+		Redos = 0,
+		Excps = 0,
+		Quanta = 0
+	;
+		Own = fast_nomem_semi(Exits, Fails),
+		Calls = Exits + Fails,
+		Redos = 0,
+		Excps = 0,
+		Quanta = 0,
+		Allocs = 0,
+		Words = 0
+	).
 
 own_to_string(all(Exits, Fails, Redos, Excps, Quanta, Allocs, Words)) =
 	"all(" ++
Index: profile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/profile.m,v
retrieving revision 1.6
diff -u -b -r1.6 profile.m
--- profile.m	24 Mar 2005 01:10:27 -0000	1.6
+++ profile.m	18 Apr 2005 09:34:54 -0000
@@ -348,46 +348,44 @@
 :- pred deep_lookup_css_desc(deep::in, call_site_static_ptr::in,
 	inherit_prof_info::out) is det.
 
-:- pred update_call_site_dynamics(call_site_dynamics::array_di,
-	call_site_dynamic_ptr::in, call_site_dynamic::in,
-	call_site_dynamics::array_uo) is det.
-:- pred update_call_site_statics(call_site_statics::array_di,
-	call_site_static_ptr::in, call_site_static::in,
-	call_site_statics::array_uo) is det.
-:- pred update_proc_dynamics(proc_dynamics::array_di,
-	proc_dynamic_ptr::in, proc_dynamic::in,
-	proc_dynamics::array_uo) is det.
-:- pred update_proc_statics(proc_statics::array_di,
-	proc_static_ptr::in, proc_static::in, proc_statics::array_uo) is det.
-:- pred update_proc_callers(array(list(call_site_dynamic_ptr))::array_di,
-	proc_static_ptr::in, list(call_site_dynamic_ptr)::in,
+:- pred update_call_site_dynamics(call_site_dynamic_ptr::in,
+	call_site_dynamic::in,
+	call_site_dynamics::array_di, call_site_dynamics::array_uo) is det.
+:- pred update_call_site_statics(call_site_static_ptr::in,
+	call_site_static::in,
+	call_site_statics::array_di, call_site_statics::array_uo) is det.
+:- pred update_proc_dynamics(proc_dynamic_ptr::in, proc_dynamic::in,
+	proc_dynamics::array_di, proc_dynamics::array_uo) is det.
+:- pred update_proc_statics(proc_static_ptr::in, proc_static::in,
+	proc_statics::array_di, proc_statics::array_uo) is det.
+:- pred update_proc_callers(proc_static_ptr::in,
+	list(call_site_dynamic_ptr)::in,
+	array(list(call_site_dynamic_ptr))::array_di,
 	array(list(call_site_dynamic_ptr))::array_uo) is det.
-:- pred update_call_site_static_map(call_site_static_map::array_di,
-	call_site_dynamic_ptr::in, call_site_static_ptr::in,
-	call_site_static_map::array_uo) is det.
-:- pred update_ps_own(array(own_prof_info)::array_di,
-	proc_static_ptr::in, own_prof_info::in,
-	array(own_prof_info)::array_uo) is det.
-:- pred update_ps_desc(array(inherit_prof_info)::array_di,
-	proc_static_ptr::in, inherit_prof_info::in,
-	array(inherit_prof_info)::array_uo) is det.
-:- pred update_css_own(array(own_prof_info)::array_di,
-	call_site_static_ptr::in, own_prof_info::in,
-	array(own_prof_info)::array_uo) is det.
-:- pred update_css_desc(array(inherit_prof_info)::array_di,
-	call_site_static_ptr::in, inherit_prof_info::in,
-	array(inherit_prof_info)::array_uo) is det.
-
-:- pred deep_update_csd_desc(deep::in, call_site_dynamic_ptr::in,
-	inherit_prof_info::in, deep::out) is det.
-:- pred deep_update_pd_desc(deep::in, proc_dynamic_ptr::in,
-	inherit_prof_info::in, deep::out) is det.
-:- pred deep_update_pd_own(deep::in, proc_dynamic_ptr::in,
-	own_prof_info::in, deep::out) is det.
-:- pred deep_update_pd_comp_table(deep::in, proc_dynamic_ptr::in,
-	compensation_table::in, deep::out) is det.
-:- pred deep_update_csd_comp_table(deep::in, call_site_dynamic_ptr::in,
-	compensation_table::in, deep::out) is det.
+:- pred update_call_site_static_map(call_site_dynamic_ptr::in,
+	call_site_static_ptr::in,
+	call_site_static_map::array_di, call_site_static_map::array_uo) is det.
+:- pred update_ps_own(proc_static_ptr::in, own_prof_info::in,
+	array(own_prof_info)::array_di, array(own_prof_info)::array_uo) is det.
+:- pred update_ps_desc(proc_static_ptr::in, inherit_prof_info::in,
+	array(inherit_prof_info)::array_di, array(inherit_prof_info)::array_uo)
+	is det.
+:- pred update_css_own(call_site_static_ptr::in, own_prof_info::in,
+	array(own_prof_info)::array_di, array(own_prof_info)::array_uo) is det.
+:- pred update_css_desc(call_site_static_ptr::in, inherit_prof_info::in,
+	array(inherit_prof_info)::array_di, array(inherit_prof_info)::array_uo)
+	is det.
+
+:- pred deep_update_csd_desc(call_site_dynamic_ptr::in, inherit_prof_info::in,
+	deep::in, deep::out) is det.
+:- pred deep_update_pd_desc(proc_dynamic_ptr::in, inherit_prof_info::in,
+	deep::in, deep::out) is det.
+:- pred deep_update_pd_own(proc_dynamic_ptr::in, own_prof_info::in,
+	deep::in, deep::out) is det.
+:- pred deep_update_pd_comp_table(proc_dynamic_ptr::in, compensation_table::in,
+	deep::in, deep::out) is det.
+:- pred deep_update_csd_comp_table(call_site_dynamic_ptr::in,
+	compensation_table::in, deep::in, deep::out) is det.
 
 :- pred extract_pd_sites(proc_dynamic::in, array(call_site_array_slot)::out)
 	is det.
@@ -753,70 +751,70 @@
 
 %-----------------------------------------------------------------------------%
 
-update_call_site_dynamics(CallSiteDynamics0, CSDPtr, CSD, CallSiteDynamics) :-
+update_call_site_dynamics(CSDPtr, CSD, CallSiteDynamics0, CallSiteDynamics) :-
 	CSDPtr = call_site_dynamic_ptr(CSDI),
 	array__set(CallSiteDynamics0, CSDI, CSD, CallSiteDynamics).
 
-update_call_site_statics(CallSiteStatics0, CSSPtr, CSS, CallSiteStatics) :-
+update_call_site_statics(CSSPtr, CSS, CallSiteStatics0, CallSiteStatics) :-
 	CSSPtr = call_site_static_ptr(CSSI),
 	array__set(CallSiteStatics0, CSSI, CSS, CallSiteStatics).
 
-update_proc_dynamics(ProcDynamics0, PDPtr, PD, ProcDynamics) :-
+update_proc_dynamics(PDPtr, PD, ProcDynamics0, ProcDynamics) :-
 	PDPtr = proc_dynamic_ptr(PDI),
 	array__set(ProcDynamics0, PDI, PD, ProcDynamics).
 
-update_proc_statics(ProcStatics0, PSPtr, PS, ProcStatics) :-
+update_proc_statics(PSPtr, PS, ProcStatics0, ProcStatics) :-
 	PSPtr = proc_static_ptr(PSI),
 	array__set(ProcStatics0, PSI, PS, ProcStatics).
 
-update_call_site_static_map(CallSiteStaticMap0, CSDPtr, CSSPtr,
-		CallSiteStaticMap) :-
+update_call_site_static_map(CSDPtr, CSSPtr,
+		CallSiteStaticMap0, CallSiteStaticMap) :-
 	CSDPtr = call_site_dynamic_ptr(CSDI),
 	array__set(CallSiteStaticMap0, CSDI, CSSPtr, CallSiteStaticMap).
 
-update_proc_callers(ProcCallers0, PSPtr, CSDPtrs, ProcCallers) :-
+update_proc_callers(PSPtr, CSDPtrs, ProcCallers0, ProcCallers) :-
 	PSPtr = proc_static_ptr(PSI),
 	array__set(ProcCallers0, PSI, CSDPtrs, ProcCallers).
 
-update_ps_own(PSOwns0, PSPtr, Own, PSOwns) :-
+update_ps_own(PSPtr, Own, PSOwns0, PSOwns) :-
 	PSPtr = proc_static_ptr(PSI),
 	array__set(PSOwns0, PSI, Own, PSOwns).
 
-update_ps_desc(PSDescs0, PSPtr, Desc, PSDescs) :-
+update_ps_desc(PSPtr, Desc, PSDescs0, PSDescs) :-
 	PSPtr = proc_static_ptr(PSI),
 	array__set(PSDescs0, PSI, Desc, PSDescs).
 
-update_css_own(CSSOwns0, CSSPtr, Own, CSSOwns) :-
+update_css_own(CSSPtr, Own, CSSOwns0, CSSOwns) :-
 	CSSPtr = call_site_static_ptr(CSSI),
 	array__set(CSSOwns0, CSSI, Own, CSSOwns).
 
-update_css_desc(CSSDescs0, CSSPtr, Desc, CSSDescs) :-
+update_css_desc(CSSPtr, Desc, CSSDescs0, CSSDescs) :-
 	CSSPtr = call_site_static_ptr(CSSI),
 	array__set(CSSDescs0, CSSI, Desc, CSSDescs).
 
 %-----------------------------------------------------------------------------%
 
-deep_update_csd_desc(Deep0, CSDPtr, CSDDesc, Deep) :-
+deep_update_csd_desc(CSDPtr, CSDDesc, Deep0, Deep) :-
 	CSDPtr = call_site_dynamic_ptr(CSDI),
 	array__set(u(Deep0 ^ csd_desc), CSDI, CSDDesc, CSDDescs),
 	Deep = Deep0 ^ csd_desc := CSDDescs.
 
-deep_update_pd_desc(Deep0, PDPtr, PDDesc, Deep) :-
+deep_update_pd_desc(PDPtr, PDDesc, Deep0, Deep) :-
 	PDPtr = proc_dynamic_ptr(PDI),
 	array__set(u(Deep0 ^ pd_desc), PDI, PDDesc, PDDescs),
 	Deep = Deep0 ^ pd_desc := PDDescs.
 
-deep_update_pd_own(Deep0, PDPtr, PDOwn, Deep) :-
+deep_update_pd_own(PDPtr, PDOwn, Deep0, Deep) :-
 	PDPtr = proc_dynamic_ptr(PDI),
 	array__set(u(Deep0 ^ pd_own), PDI, PDOwn, PDOwns),
 	Deep = Deep0 ^ pd_own := PDOwns.
 
-deep_update_pd_comp_table(Deep0, PDPtr, CompTable, Deep) :-
+deep_update_pd_comp_table(PDPtr, CompTable, Deep0, Deep) :-
 	PDPtr = proc_dynamic_ptr(PDI),
 	array__set(u(Deep0 ^ pd_comp_table), PDI, CompTable, PDCompTables),
 	Deep = Deep0 ^ pd_comp_table := PDCompTables.
 
-deep_update_csd_comp_table(Deep0, CSDPtr, CompTable, Deep) :-
+deep_update_csd_comp_table(CSDPtr, CompTable, Deep0, Deep) :-
 	CSDPtr = call_site_dynamic_ptr(CSDI),
 	array__set(u(Deep0 ^ csd_comp_table), CSDI, CompTable, CSDCompTables),
 	Deep = Deep0 ^ csd_comp_table := CSDCompTables.
Index: read_profile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/read_profile.m,v
retrieving revision 1.10
diff -u -b -r1.10 read_profile.m
--- read_profile.m	15 Apr 2005 06:25:13 -0000	1.10
+++ read_profile.m	18 Apr 2005 02:53:29 -0000
@@ -397,22 +397,22 @@
         PredName = "Unify"
     ; RawPredName = "__Compare__" ->
         PredName = "Compare"
-    ; RawPredName = "__Index__" ->
-        PredName = "Index"
     ; RawPredName = "__CompareRep__" ->
         PredName = "CompareRep"
+    ; RawPredName = "__Index__" ->
+        PredName = "Index"
+    ; RawPredName = "__Initialise__" ->
+        PredName = "Initialise"
     ;
         string__append("unknown special predicate name ", RawPredName, Msg),
         error(Msg)
     ),
-    Name0 = string__append_list(
-        [PredName, " for ", TypeModule, ":", TypeName,
+    Name0 = string__append_list([PredName, " for ", TypeModule, ":", TypeName,
             "/", string__int_to_string(Arity)]),
     ( Mode = 0 ->
         Name = Name0
     ;
-        Name = string__append_list([Name0, " mode ", 
-            string__int_to_string(Mode)])
+        Name = string__append_list([Name0, " mode ", int_to_string(Mode)])
     ).
 refined_proc_id_to_string(user_defined(PredOrFunc, DeclModule, _DefModule,
         ProcName, Arity, Mode)) = Name :-
Index: startup.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/startup.m,v
retrieving revision 1.8
diff -u -b -r1.8 startup.m
--- startup.m	24 Mar 2005 01:10:28 -0000	1.8
+++ startup.m	18 Apr 2005 10:10:05 -0000
@@ -1,4 +1,6 @@
 %-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et
+%-----------------------------------------------------------------------------%
 % Copyright (C) 2001-2002, 2004-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.
@@ -23,7 +25,7 @@
 :- import_module std_util.
 
 :- pred read_and_startup(string::in, list(string)::in, bool::in,
-	maybe(io__output_stream)::in, maybe_error(deep)::out,
+    maybe(io__output_stream)::in, list(string)::in, maybe_error(deep)::out,
 	io::di, io::uo) is det.
 
 %-----------------------------------------------------------------------------%
@@ -33,6 +35,7 @@
 :- import_module array_util.
 :- import_module callgraph.
 :- import_module canonical.
+:- import_module dump.
 :- import_module measurements.
 :- import_module profile.
 :- import_module read_profile.
@@ -45,11 +48,13 @@
 :- import_module set.
 :- import_module std_util.
 :- import_module string.
+:- import_module svarray.
+:- import_module svmap.
 
 % :- import_module unsafe.
 
-read_and_startup(Machine, DataFileNames, Canonical, MaybeOutputStream, Res,
-		!IO) :-
+read_and_startup(Machine, DataFileNames, Canonical, MaybeOutputStream,
+    DumpStages, Res, !IO) :-
 	(
 		DataFileNames = [],
 		% This should have been caught and reported by main.
@@ -58,15 +63,15 @@
 		DataFileNames = [DataFileName],
 		maybe_report_stats(MaybeOutputStream, !IO),
 		maybe_report_msg(MaybeOutputStream,
-			"  Reading graph data...\n", !IO),
+            "% Reading graph data...\n", !IO),
 		read_call_graph(DataFileName, Res0, !IO),
 		maybe_report_msg(MaybeOutputStream,
-			"  Done.\n", !IO),
+            "% Done.\n", !IO),
 		maybe_report_stats(MaybeOutputStream, !IO),
 		(
 			Res0 = ok(InitDeep),
-			startup(Machine, DataFileName, Canonical,
-				MaybeOutputStream, InitDeep, Deep, !IO),
+            startup(Machine, DataFileName, Canonical, MaybeOutputStream,
+                DumpStages, InitDeep, Deep, !IO),
 			Res = ok(Deep)
 		;
 			Res0 = error(Error),
@@ -79,50 +84,49 @@
 	).
 
 :- pred startup(string::in, string::in, bool::in, maybe(io__output_stream)::in,
-	initial_deep::in, deep::out, io::di, io::uo) is det.
+    list(string)::in, initial_deep::in, deep::out, io::di, io::uo) is det.
 
-startup(Machine, DataFileName, Canonical, MaybeOutputStream, InitDeep0, Deep,
-		!IO) :-
+startup(Machine, DataFileName, Canonical, MaybeOutputStream, DumpStages,
+        InitDeep0, Deep, !IO) :-
 	InitDeep0 = initial_deep(InitStats, Root,
-		CallSiteDynamics0, ProcDynamics,
-		CallSiteStatics0, ProcStatics0),
+        CallSiteDynamics0, ProcDynamics, CallSiteStatics0, ProcStatics0),
+    maybe_dump(DataFileName, DumpStages, 0,
+        dump_initial_deep(yes, no, yes, yes, yes, yes, InitDeep0), !IO),
 
 	maybe_report_msg(MaybeOutputStream,
-		"  Mapping static call sites to containing procedures...\n",
-		!IO),
+        "% Mapping static call sites to containing procedures...\n", !IO),
 	array_foldl2_from_1(record_css_containers_module_procs, ProcStatics0,
-		u(CallSiteStatics0), CallSiteStatics,
-		map__init, ModuleProcs),
+        u(CallSiteStatics0), CallSiteStatics, map__init, ModuleProcs),
 	maybe_report_msg(MaybeOutputStream,
-		"  Done.\n", !IO),
+        "% Done.\n", !IO),
 	maybe_report_stats(MaybeOutputStream, !IO),
 
 	maybe_report_msg(MaybeOutputStream,
-		"  Mapping dynamic call sites to containing procedures...\n",
-		!IO),
+        "% Mapping dynamic call sites to containing procedures...\n", !IO),
 	array_foldl2_from_1(record_csd_containers_zeroed_pss, ProcDynamics,
-		u(CallSiteDynamics0), CallSiteDynamics,
-		u(ProcStatics0), ProcStatics),
+        u(CallSiteDynamics0), CallSiteDynamics, u(ProcStatics0), ProcStatics),
 	maybe_report_msg(MaybeOutputStream,
-		"  Done.\n", !IO),
+        "% Done.\n", !IO),
 	maybe_report_stats(MaybeOutputStream, !IO),
 
 	InitDeep1 = initial_deep(InitStats, Root,
-		CallSiteDynamics, ProcDynamics,
-		CallSiteStatics, ProcStatics),
-
+        CallSiteDynamics, ProcDynamics, CallSiteStatics, ProcStatics),
+    maybe_dump(DataFileName, DumpStages, 10,
+        dump_initial_deep(yes, no, yes, yes, yes, yes, InitDeep1), !IO),
 	(
 		Canonical = no,
 		InitDeep = InitDeep1
 	;
 		Canonical = yes,
 		maybe_report_msg(MaybeOutputStream,
-			"  Canonicalizing cliques...\n", !IO),
+            "% Canonicalizing cliques...\n", !IO),
 		canonicalize_cliques(InitDeep1, InitDeep),
 		maybe_report_msg(MaybeOutputStream,
-			"  Done.\n", !IO),
+            "% Done.\n", !IO),
 		maybe_report_stats(MaybeOutputStream, !IO)
 	),
+    maybe_dump(DataFileName, DumpStages, 20,
+        dump_initial_deep(yes, no, yes, yes, yes, yes, InitDeep), !IO),
 
 	array__max(InitDeep ^ init_proc_dynamics, PDMax),
 	NPDs = PDMax + 1,
@@ -134,21 +138,21 @@
 	NCSSs = CSSMax + 1,
 
 	maybe_report_msg(MaybeOutputStream,
-		"  Finding cliques...\n", !IO),
+        "% Finding cliques...\n", !IO),
 	find_cliques(InitDeep, CliqueList),
 	maybe_report_msg(MaybeOutputStream,
-		"  Done.\n", !IO),
+        "% Done.\n", !IO),
 	maybe_report_stats(MaybeOutputStream, !IO),
 
 	maybe_report_msg(MaybeOutputStream,
-		"  Constructing clique indexes...\n", !IO),
+        "% Constructing clique indexes...\n", !IO),
 	make_clique_indexes(NPDs, CliqueList, Cliques, CliqueIndex),
 	maybe_report_msg(MaybeOutputStream,
-		"  Done.\n", !IO),
+        "% Done.\n", !IO),
 	maybe_report_stats(MaybeOutputStream, !IO),
 
 	maybe_report_msg(MaybeOutputStream,
-		"  Constructing clique parent map...\n", !IO),
+        "% Constructing clique parent map...\n", !IO),
 
 		% For each CallSiteDynamic pointer, if it points to
 		% a ProcDynamic which is in a different clique to
@@ -167,38 +171,38 @@
 		CliqueMaybeChildren0, CliqueMaybeChildren),
 
 	maybe_report_msg(MaybeOutputStream,
-		"  Done.\n", !IO),
+        "% Done.\n", !IO),
 	maybe_report_stats(MaybeOutputStream, !IO),
 
 	maybe_report_msg(MaybeOutputStream,
-		"  Finding procedure callers...\n", !IO),
+        "% Finding procedure callers...\n", !IO),
 	array__init(NPSs, [], ProcCallers0),
 	array_foldl_from_1(construct_proc_callers(InitDeep),
 		CallSiteDynamics, ProcCallers0, ProcCallers),
 	maybe_report_msg(MaybeOutputStream,
-		"  Done.\n", !IO),
+        "% Done.\n", !IO),
 	maybe_report_stats(MaybeOutputStream, !IO),
 
 	maybe_report_msg(MaybeOutputStream,
-		"  Constructing call site static map...\n", !IO),
+        "% Constructing call site static map...\n", !IO),
 	array__init(NCSDs, call_site_static_ptr(-1), CallSiteStaticMap0),
 	array_foldl_from_1(construct_call_site_caller(InitDeep),
 		ProcDynamics, CallSiteStaticMap0, CallSiteStaticMap),
 	maybe_report_msg(MaybeOutputStream,
-		"  Done.\n", !IO),
+        "% Done.\n", !IO),
 	maybe_report_stats(MaybeOutputStream, !IO),
 
 	maybe_report_msg(MaybeOutputStream,
-		"  Finding call site calls...\n", !IO),
+        "% Finding call site calls...\n", !IO),
 	array__init(NCSSs, map__init, CallSiteCalls0),
 	array_foldl_from_1(construct_call_site_calls(InitDeep),
 		ProcDynamics, CallSiteCalls0, CallSiteCalls),
 	maybe_report_msg(MaybeOutputStream,
-		"  Done.\n", !IO),
+        "% Done.\n", !IO),
 	maybe_report_stats(MaybeOutputStream, !IO),
 
 	maybe_report_msg(MaybeOutputStream,
-		"  Propagating time up call graph...\n", !IO),
+        "% Propagating time up call graph...\n", !IO),
 
 	array__init(NCSDs, zero_inherit_prof_info, CSDDesc0),
 	array__init(NPDs, zero_own_prof_info, PDOwn0),
@@ -223,16 +227,16 @@
 
 	array_foldl_from_1(propagate_to_clique, Cliques, Deep0, Deep1),
 	maybe_report_msg(MaybeOutputStream,
-		"  Done.\n", !IO),
+        "% Done.\n", !IO),
 	maybe_report_stats(MaybeOutputStream, !IO),
 
 	maybe_report_msg(MaybeOutputStream,
-		"  Summarizing information...\n", !IO),
+        "% Summarizing information...\n", !IO),
 	summarize_proc_dynamics(Deep1, Deep2),
 	summarize_call_site_dynamics(Deep2, Deep3),
 	summarize_modules(Deep3, Deep),
 	maybe_report_msg(MaybeOutputStream,
-		"  Done.\n", !IO),
+        "% Done.\n", !IO),
 	maybe_report_stats(MaybeOutputStream, !IO).
 
 :- pred count_quanta(int::in, call_site_dynamic::in, int::in, int::out) is det.
@@ -245,6 +249,28 @@
 initialize_module_data(_ModuleName, PSPtrs) =
 	module_data(zero_own_prof_info, zero_inherit_prof_info, PSPtrs).
 
+:- pred maybe_dump(string::in, list(string)::in, int::in,
+    pred(io, io)::in(pred(di, uo) is det), io::di, io::uo) is det.
+
+maybe_dump(BaseName, DumpStages, ThisStageNum, Action, !IO) :-
+    string__int_to_string(ThisStageNum, ThisStage),
+    ( list__member(ThisStage, DumpStages) ->
+        string__append_list([BaseName, ".deepdump.", ThisStage], FileName),
+        io__open_output(FileName, OpenRes, !IO),
+        (
+            OpenRes = ok(FileStream),
+            io__set_output_stream(FileStream, CurStream, !IO),
+            Action(!IO),
+            io__set_output_stream(CurStream, _, !IO)
+        ;
+            OpenRes = error(Error),
+            io.error_message(Error, Msg),
+            io.format("%s: %s\n", [s(FileName), s(Msg)], !IO)
+        )
+    ;
+        true
+    ).
+
 %-----------------------------------------------------------------------------%
 
 :- pred record_css_containers_module_procs(int::in, proc_static::in,
@@ -253,20 +279,16 @@
 	map(string, list(proc_static_ptr))::in,
 	map(string, list(proc_static_ptr))::out) is det.
 
-record_css_containers_module_procs(PSI, PS, CallSiteStatics0, CallSiteStatics,
-		ModuleProcs0, ModuleProcs) :-
+record_css_containers_module_procs(PSI, PS, !CallSiteStatics, !ModuleProcs) :-
 	CSSPtrs = PS ^ ps_sites,
 	PSPtr = proc_static_ptr(PSI),
 	array__max(CSSPtrs, MaxCS),
-	record_css_containers_2(MaxCS, PSPtr, CSSPtrs,
-		CallSiteStatics0, CallSiteStatics),
+    record_css_containers_2(MaxCS, PSPtr, CSSPtrs, !CallSiteStatics),
 	DeclModule = PS ^ ps_decl_module,
-	( map__search(ModuleProcs0, DeclModule, PSPtrs0) ->
-		map__det_update(ModuleProcs0, DeclModule, [PSPtr | PSPtrs0],
-			ModuleProcs)
+    ( map__search(!.ModuleProcs, DeclModule, PSPtrs0) ->
+        svmap__det_update(DeclModule, [PSPtr | PSPtrs0], !ModuleProcs)
 	;
-		map__det_insert(ModuleProcs0, DeclModule, [PSPtr],
-			ModuleProcs)
+        svmap__det_insert(DeclModule, [PSPtr], !ModuleProcs)
 	).
 
 :- pred record_css_containers_2(int::in, proc_static_ptr::in,
@@ -274,11 +296,10 @@
 	array(call_site_static)::array_di,
 	array(call_site_static)::array_uo) is det.
 
-record_css_containers_2(SlotNum, PSPtr, CSSPtrs,
-		CallSiteStatics0, CallSiteStatics) :-
+record_css_containers_2(SlotNum, PSPtr, CSSPtrs, !CallSiteStatics) :-
 	( SlotNum >= 0 ->
 		array__lookup(CSSPtrs, SlotNum, CSSPtr),
-		lookup_call_site_statics(CallSiteStatics0, CSSPtr, CSS0),
+        lookup_call_site_statics(!.CallSiteStatics, CSSPtr, CSS0),
 		CSS0 = call_site_static(PSPtr0, SlotNum0,
 			Kind, LineNumber, GoalPath),
 		require(unify(PSPtr0, proc_static_ptr(-1)),
@@ -287,12 +308,10 @@
 			"record_css_containers_2: real slot_num"),
 		CSS = call_site_static(PSPtr, SlotNum,
 			Kind, LineNumber, GoalPath),
-		update_call_site_statics(CallSiteStatics0, CSSPtr, CSS,
-			CallSiteStatics1),
-		record_css_containers_2(SlotNum - 1,
-			PSPtr, CSSPtrs, CallSiteStatics1, CallSiteStatics)
+        update_call_site_statics(CSSPtr, CSS, !CallSiteStatics),
+        record_css_containers_2(SlotNum - 1, PSPtr, CSSPtrs, !CallSiteStatics)
 	;
-		CallSiteStatics = CallSiteStatics0
+        true
 	).
 
 %-----------------------------------------------------------------------------%
@@ -302,22 +321,19 @@
 	array(call_site_dynamic)::array_uo,
 	array(proc_static)::array_di, array(proc_static)::array_uo) is det.
 
-record_csd_containers_zeroed_pss(PDI, PD, CallSiteDynamics0, CallSiteDynamics,
-		ProcStatics0, ProcStatics) :-
+record_csd_containers_zeroed_pss(PDI, PD, !CallSiteDynamics, !ProcStatics) :-
 	CSDArray = PD ^ pd_sites,
 	PDPtr = proc_dynamic_ptr(PDI),
 	flatten_call_sites(CSDArray, CSDPtrs, IsZeroed),
-	record_csd_containers_2(PDPtr, CSDPtrs,
-		CallSiteDynamics0, CallSiteDynamics),
+    record_csd_containers_2(PDPtr, CSDPtrs, !CallSiteDynamics),
 	(
 		IsZeroed = zeroed,
 		PSPtr = PD ^ pd_proc_static,
-		lookup_proc_statics(ProcStatics0, PSPtr, PS0),
+        lookup_proc_statics(!.ProcStatics, PSPtr, PS0),
 		PS = PS0 ^ ps_is_zeroed := zeroed,
-		update_proc_statics(ProcStatics0, PSPtr, PS, ProcStatics)
+        update_proc_statics(PSPtr, PS, !ProcStatics)
 	;
-		IsZeroed = not_zeroed,
-		ProcStatics = ProcStatics0
+        IsZeroed = not_zeroed
 	).
 
 :- pred record_csd_containers_2(proc_dynamic_ptr::in,
@@ -325,18 +341,15 @@
 	array(call_site_dynamic)::array_di,
 	array(call_site_dynamic)::array_uo) is det.
 
-record_csd_containers_2(_, [], CallSiteDynamics, CallSiteDynamics).
-record_csd_containers_2(PDPtr, [CSDPtr | CSDPtrs],
-		CallSiteDynamics0, CallSiteDynamics) :-
-	lookup_call_site_dynamics(CallSiteDynamics0, CSDPtr, CSD0),
+record_csd_containers_2(_, [], !CallSiteDynamics).
+record_csd_containers_2(PDPtr, [CSDPtr | CSDPtrs], !CallSiteDynamics) :-
+    lookup_call_site_dynamics(!.CallSiteDynamics, CSDPtr, CSD0),
 	CSD0 = call_site_dynamic(CallerPDPtr0, CalleePDPtr, Own),
 	require(unify(CallerPDPtr0, proc_dynamic_ptr(-1)),
 		"record_csd_containers_2: real proc_dynamic_ptr"),
 	CSD = call_site_dynamic(PDPtr, CalleePDPtr, Own),
-	update_call_site_dynamics(CallSiteDynamics0, CSDPtr, CSD,
-		CallSiteDynamics1),
-	record_csd_containers_2(PDPtr, CSDPtrs,
-		CallSiteDynamics1, CallSiteDynamics).
+    update_call_site_dynamics(CSDPtr, CSD, !CallSiteDynamics),
+    record_csd_containers_2(PDPtr, CSDPtrs, !CallSiteDynamics).
 
 %-----------------------------------------------------------------------------%
 
@@ -348,18 +361,15 @@
 	array(maybe(clique_ptr))::array_uo) is det.
 
 construct_clique_parents(InitDeep, CliqueIndex, PDI, CliquePtr,
-		CliqueParents0, CliqueParents,
-		CliqueMaybeChildren0, CliqueMaybeChildren) :-
+        !CliqueParents, !CliqueMaybeChildren) :-
 	( PDI > 0 ->
 		flat_call_sites(InitDeep ^ init_proc_dynamics,
 			proc_dynamic_ptr(PDI), CSDPtrs),
 		array_list_foldl2(
-			construct_clique_parents_2(InitDeep,
-				CliqueIndex, CliquePtr),
-			CSDPtrs, CliqueParents0, CliqueParents,
-			CliqueMaybeChildren0, CliqueMaybeChildren)
+            construct_clique_parents_2(InitDeep, CliqueIndex, CliquePtr),
+            CSDPtrs, !CliqueParents, !CliqueMaybeChildren)
 	;
-		error("emit nasal daemons")
+        error("construct_clique_parents: invalid pdi")
 	).
 
 :- pred construct_clique_parents_2(initial_deep::in, array(clique_ptr)::in,
@@ -372,8 +382,7 @@
 % :- pragma promise_pure(construct_clique_parents_2/8).
 
 construct_clique_parents_2(InitDeep, CliqueIndex, ParentCliquePtr, CSDPtr,
-		CliqueParents0, CliqueParents,
-		CliqueMaybeChildren0, CliqueMaybeChildren) :-
+        !CliqueParents, !CliqueMaybeChildren) :-
 	CSDPtr = call_site_dynamic_ptr(CSDI),
 	( CSDI > 0 ->
 		array__lookup(InitDeep ^ init_call_site_dynamics, CSDI, CSD),
@@ -386,22 +395,16 @@
 				% impure unsafe_perform_io(
 				% 	write_pdi_cn_csd(ChildPDI,
 				% 		ChildCliqueNum, CSDI)),
-				array__set(CliqueParents0, ChildCliqueNum,
-					CSDPtr, CliqueParents),
-				array__set(CliqueMaybeChildren0, CSDI,
-					yes(ChildCliquePtr),
-					CliqueMaybeChildren)
+                svarray__set(ChildCliqueNum, CSDPtr, !CliqueParents),
+                svarray__set(CSDI, yes(ChildCliquePtr), !CliqueMaybeChildren)
 			;
-				CliqueParents = CliqueParents0,
-				CliqueMaybeChildren = CliqueMaybeChildren0
+                true
 			)
 		;
-			CliqueParents = CliqueParents0,
-			CliqueMaybeChildren = CliqueMaybeChildren0
+            true
 		)
 	;
-		CliqueParents = CliqueParents0,
-		CliqueMaybeChildren = CliqueMaybeChildren0
+        true
 	).
 
 %-----------------------------------------------------------------------------%
@@ -411,24 +414,23 @@
 	array(list(call_site_dynamic_ptr))::array_di,
 	array(list(call_site_dynamic_ptr))::array_uo) is det.
 
-construct_proc_callers(InitDeep, CSDI, CSD, ProcCallers0, ProcCallers) :-
+construct_proc_callers(InitDeep, CSDI, CSD, !ProcCallers) :-
 	PDPtr = CSD ^ csd_callee,
 	( valid_proc_dynamic_ptr_raw(InitDeep ^ init_proc_dynamics, PDPtr) ->
 		lookup_proc_dynamics(InitDeep ^ init_proc_dynamics, PDPtr, PD),
 		PSPtr = PD ^ pd_proc_static,
-		lookup_proc_callers(ProcCallers0, PSPtr, Callers0),
+        lookup_proc_callers(!.ProcCallers, PSPtr, Callers0),
 		Callers = [call_site_dynamic_ptr(CSDI) | Callers0],
-		update_proc_callers(ProcCallers0, PSPtr, Callers, ProcCallers)
+        update_proc_callers(PSPtr, Callers, !ProcCallers)
 	;
-		ProcCallers = ProcCallers0
+        true
 	).
 
 :- pred construct_call_site_caller(initial_deep::in, int::in, proc_dynamic::in,
 	array(call_site_static_ptr)::array_di,
 	array(call_site_static_ptr)::array_uo) is det.
 
-construct_call_site_caller(InitDeep, _PDI, PD,
-		CallSiteStaticMap0, CallSiteStaticMap) :-
+construct_call_site_caller(InitDeep, _PDI, PD, !CallSiteStaticMap) :-
 	PSPtr = PD ^ pd_proc_static,
 	CSDArraySlots = PD ^ pd_sites,
 	lookup_proc_statics(InitDeep ^ init_proc_statics, PSPtr, PS),
@@ -436,7 +438,7 @@
 	array__max(CSDArraySlots, MaxCS),
 	construct_call_site_caller_2(MaxCS,
 		InitDeep ^ init_call_site_dynamics, CSSPtrs, CSDArraySlots,
-		CallSiteStaticMap0, CallSiteStaticMap).
+        !CallSiteStaticMap).
 
 :- pred construct_call_site_caller_2(int::in, call_site_dynamics::in,
 	array(call_site_static_ptr)::in,
@@ -445,26 +447,24 @@
 	array(call_site_static_ptr)::array_uo) is det.
 
 construct_call_site_caller_2(SlotNum, Deep, CSSPtrs, CSDArraySlots,
-		CallSiteStaticMap0, CallSiteStaticMap) :-
+        !CallSiteStaticMap) :-
 	( SlotNum >= 0 ->
 		array__lookup(CSDArraySlots, SlotNum, CSDArraySlot),
 		array__lookup(CSSPtrs, SlotNum, CSSPtr),
 		(
 			CSDArraySlot = normal(CSDPtr),
 			construct_call_site_caller_3(Deep, CSSPtr, -1, CSDPtr,
-				CallSiteStaticMap0, CallSiteStaticMap1)
+                !CallSiteStaticMap)
 
 		;
 			CSDArraySlot = multi(_, CSDPtrs),
-			array_foldl_from_0(
-				construct_call_site_caller_3(Deep, CSSPtr),
-				CSDPtrs,
-				CallSiteStaticMap0, CallSiteStaticMap1)
+            array_foldl_from_0(construct_call_site_caller_3(Deep, CSSPtr),
+                CSDPtrs, !CallSiteStaticMap)
 		),
 		construct_call_site_caller_2(SlotNum - 1, Deep, CSSPtrs,
-			CSDArraySlots, CallSiteStaticMap1, CallSiteStaticMap)
+            CSDArraySlots, !CallSiteStaticMap)
 	;
-		CallSiteStaticMap = CallSiteStaticMap0
+        true
 	).
 
 :- pred construct_call_site_caller_3(call_site_dynamics::in,
@@ -473,12 +473,11 @@
 	array(call_site_static_ptr)::array_uo) is det.
 
 construct_call_site_caller_3(CallSiteDynamics, CSSPtr, _Dummy, CSDPtr,
-		CallSiteStaticMap0, CallSiteStaticMap) :-
+        !CallSiteStaticMap) :-
 	( valid_call_site_dynamic_ptr_raw(CallSiteDynamics, CSDPtr) ->
-		update_call_site_static_map(CallSiteStaticMap0,
-			CSDPtr, CSSPtr, CallSiteStaticMap)
+        update_call_site_static_map(CSDPtr, CSSPtr, !CallSiteStaticMap)
 	;
-		CallSiteStaticMap = CallSiteStaticMap0
+        true
 	).
 
 %-----------------------------------------------------------------------------%
@@ -488,7 +487,7 @@
 	array(map(proc_static_ptr, list(call_site_dynamic_ptr)))::array_uo)
 	is det.
 
-construct_call_site_calls(InitDeep, _PDI, PD, CallSiteCalls0, CallSiteCalls) :-
+construct_call_site_calls(InitDeep, _PDI, PD, !CallSiteCalls) :-
 	PSPtr = PD ^ pd_proc_static,
 	CSDArraySlots = PD ^ pd_sites,
 	array__max(CSDArraySlots, MaxCS),
@@ -498,7 +497,7 @@
 	CallSiteDynamics = InitDeep ^ init_call_site_dynamics,
 	ProcDynamics = InitDeep ^ init_proc_dynamics,
 	construct_call_site_calls_2(CallSiteDynamics, ProcDynamics, MaxCS,
-		CSSPtrs, CSDArraySlots, CallSiteCalls0, CallSiteCalls).
+        CSSPtrs, CSDArraySlots, !CallSiteCalls).
 
 :- pred construct_call_site_calls_2(call_site_dynamics::in, proc_dynamics::in,
 	int::in, array(call_site_static_ptr)::in,
@@ -508,7 +507,7 @@
 	is det.
 
 construct_call_site_calls_2(CallSiteDynamics, ProcDynamics, SlotNum,
-		CSSPtrs, CSDArraySlots, CallSiteCalls0, CallSiteCalls) :-
+        CSSPtrs, CSDArraySlots, !CallSiteCalls) :-
 	( SlotNum >= 0 ->
 		array__lookup(CSDArraySlots, SlotNum, CSDArraySlot),
 		array__lookup(CSSPtrs, SlotNum, CSSPtr),
@@ -516,19 +515,18 @@
 			CSDArraySlot = normal(CSDPtr),
 			construct_call_site_calls_3(CallSiteDynamics,
 				ProcDynamics, CSSPtr, -1,
-				CSDPtr, CallSiteCalls0, CallSiteCalls1)
+                CSDPtr, !CallSiteCalls)
 		;
 			CSDArraySlot = multi(_, CSDPtrs),
 			array_foldl_from_0(
 				construct_call_site_calls_3(CallSiteDynamics,
 					ProcDynamics, CSSPtr),
-				CSDPtrs, CallSiteCalls0, CallSiteCalls1)
+                CSDPtrs, !CallSiteCalls)
 		),
 		construct_call_site_calls_2(CallSiteDynamics, ProcDynamics,
-			SlotNum - 1, CSSPtrs, CSDArraySlots,
-			CallSiteCalls1, CallSiteCalls)
+            SlotNum - 1, CSSPtrs, CSDArraySlots, !CallSiteCalls)
 	;
-		CallSiteCalls = CallSiteCalls0
+        true
 	).
 
 :- pred construct_call_site_calls_3(call_site_dynamics::in, proc_dynamics::in,
@@ -538,7 +536,7 @@
 	is det.
 
 construct_call_site_calls_3(CallSiteDynamics, ProcDynamics, CSSPtr,
-		_Dummy, CSDPtr, CallSiteCalls0, CallSiteCalls) :-
+        _Dummy, CSDPtr, !CallSiteCalls) :-
 	CSDPtr = call_site_dynamic_ptr(CSDI),
 	( CSDI > 0 ->
 		array__lookup(CallSiteDynamics, CSDI, CSD),
@@ -548,7 +546,7 @@
 		PSPtr = PD ^ pd_proc_static,
 
 		CSSPtr = call_site_static_ptr(CSSI),
-		array__lookup(CallSiteCalls0, CSSI, CallMap0),
+        array__lookup(!.CallSiteCalls, CSSI, CallMap0),
 		( map__search(CallMap0, PSPtr, CallList0) ->
 			CallList = [CSDPtr | CallList0],
 			map__det_update(CallMap0, PSPtr, CallList, CallMap)
@@ -556,9 +554,9 @@
 			CallList = [CSDPtr],
 			map__det_insert(CallMap0, PSPtr, CallList, CallMap)
 		),
-		array__set(CallSiteCalls0, CSSI, CallMap, CallSiteCalls)
+        svarray__set(CSSI, CallMap, !CallSiteCalls)
 	;
-		CallSiteCalls = CallSiteCalls0
+        true
 	).
 
 %-----------------------------------------------------------------------------%
@@ -566,14 +564,14 @@
 :- pred sum_call_sites_in_proc_dynamic(int::in, call_site_dynamic::in,
 	array(own_prof_info)::array_di, array(own_prof_info)::array_uo) is det.
 
-sum_call_sites_in_proc_dynamic(_, CSD, PDOwnArray0, PDOwnArray) :-
+sum_call_sites_in_proc_dynamic(_, CSD, !PDOwnArray) :-
 	CalleeOwn = CSD ^ csd_own_prof,
 	PDPtr = CSD ^ csd_callee,
 	PDPtr = proc_dynamic_ptr(PDI),
 	( PDI > 0 ->
-		array__lookup(PDOwnArray0, PDI, ProcOwn0),
+        array__lookup(!.PDOwnArray, PDI, ProcOwn0),
 		ProcOwn = add_own_to_own(CalleeOwn, ProcOwn0),
-		array__set(PDOwnArray0, PDI, ProcOwn, PDOwnArray)
+        svarray__set(PDI, ProcOwn, !PDOwnArray)
 	;
 		error("sum_call_sites_in_proc_dynamic: invalid pdptr")
 	).
@@ -618,8 +616,8 @@
 	lookup_ps_desc(PSDescArray0, PSPtr, PSDesc0),
 	add_own_to_own(PDOwn, PSOwn0) = PSOwn,
 	add_inherit_to_inherit(PDDesc, PSDesc0) = PSDesc,
-	update_ps_own(u(PSOwnArray0), PSPtr, PSOwn, PSOwnArray),
-	update_ps_desc(u(PSDescArray0), PSPtr, PSDesc, PSDescArray).
+    update_ps_own(PSPtr, PSOwn, u(PSOwnArray0), PSOwnArray),
+    update_ps_desc(PSPtr, PSDesc, u(PSDescArray0), PSDescArray).
 
 %-----------------------------------------------------------------------------%
 
@@ -659,8 +657,7 @@
 		lookup_csd_comp_table(CSDCompTableArray, CSDPtr, CSDCompTable),
 		lookup_call_site_statics(CallSiteStatics, CSSPtr, CSS),
 		( map__search(CSDCompTable, CSS ^ css_container, InnerTotal) ->
-			CSDDesc = subtract_inherit_from_inherit(InnerTotal,
-				CSDDesc0)
+            CSDDesc = subtract_inherit_from_inherit(InnerTotal, CSDDesc0)
 		;
 			CSDDesc = CSDDesc0
 		),
@@ -668,10 +665,8 @@
 		lookup_css_desc(CSSDescArray0, CSSPtr, CSSDesc0),
 		add_own_to_own(CSDOwn, CSSOwn0) = CSSOwn,
 		add_inherit_to_inherit(CSDDesc, CSSDesc0) = CSSDesc,
-		update_css_own(u(CSSOwnArray0), CSSPtr, CSSOwn,
-			CSSOwnArray),
-		update_css_desc(u(CSSDescArray0), CSSPtr, CSSDesc,
-			CSSDescArray)
+        update_css_own(CSSPtr, CSSOwn, u(CSSOwnArray0), CSSOwnArray),
+        update_css_desc(CSSPtr, CSSDesc, u(CSSDescArray0), CSSDescArray)
 	;
 		error("summarize_call_site_dynamic: invalid css ptr")
 	).
@@ -682,16 +677,14 @@
 
 summarize_modules(Deep0, Deep) :-
 	ModuleData0 = Deep0 ^ module_data,
-	ModuleData = map__map_values(summarize_module_costs(Deep0),
-		ModuleData0),
+    ModuleData = map__map_values(summarize_module_costs(Deep0), ModuleData0),
 	Deep = Deep0 ^ module_data := ModuleData.
 
 :- func summarize_module_costs(deep, string, module_data) = module_data.
 
 summarize_module_costs(Deep, _ModuleName, ModuleData0) = ModuleData :-
 	ModuleData0 = module_data(Own0, Desc0, PSPtrs),
-	list__foldl2(accumulate_ps_costs(Deep), PSPtrs,
-		Own0, Own, Desc0, Desc),
+    list__foldl2(accumulate_ps_costs(Deep), PSPtrs, Own0, Own, Desc0, Desc),
 	ModuleData = module_data(Own, Desc, PSPtrs).
 
 :- pred accumulate_ps_costs(deep::in, proc_static_ptr::in,
@@ -709,23 +702,20 @@
 :- pred propagate_to_clique(int::in, list(proc_dynamic_ptr)::in,
 	deep::in, deep::out) is det.
 
-propagate_to_clique(CliqueNumber, Members, Deep0, Deep) :-
-	array__lookup(Deep0 ^ clique_parents, CliqueNumber, ParentCSDPtr),
+propagate_to_clique(CliqueNumber, Members, !Deep) :-
+    array__lookup(!.Deep ^ clique_parents, CliqueNumber, ParentCSDPtr),
 	list__foldl3(propagate_to_proc_dynamic(CliqueNumber, ParentCSDPtr),
-		Members, Deep0, Deep1, map__init, SumTable,
-		map__init, OverrideMap),
-	( valid_call_site_dynamic_ptr(Deep1, ParentCSDPtr) ->
-		deep_lookup_call_site_dynamics(Deep1, ParentCSDPtr, ParentCSD),
+        Members, !Deep, map__init, SumTable, map__init, OverrideMap),
+    ( valid_call_site_dynamic_ptr(!.Deep, ParentCSDPtr) ->
+        deep_lookup_call_site_dynamics(!.Deep, ParentCSDPtr, ParentCSD),
 		ParentOwn = ParentCSD ^ csd_own_prof,
-		deep_lookup_csd_desc(Deep1, ParentCSDPtr, ParentDesc0),
-		subtract_own_from_inherit(ParentOwn, ParentDesc0) =
-			ParentDesc,
-		deep_update_csd_desc(Deep1, ParentCSDPtr, ParentDesc, Deep2),
+        deep_lookup_csd_desc(!.Deep, ParentCSDPtr, ParentDesc0),
+        subtract_own_from_inherit(ParentOwn, ParentDesc0) = ParentDesc,
+        deep_update_csd_desc(ParentCSDPtr, ParentDesc, !Deep),
 		CSDCompTable = apply_override(OverrideMap, SumTable),
-		deep_update_csd_comp_table(Deep2, ParentCSDPtr, CSDCompTable,
-			Deep)
+        deep_update_csd_comp_table(ParentCSDPtr, CSDCompTable, !Deep)
 	;
-		Deep = Deep1
+        true
 	).
 
 :- pred propagate_to_proc_dynamic(int::in, call_site_dynamic_ptr::in,
@@ -733,60 +723,57 @@
 	compensation_table::in, compensation_table::out,
 	compensation_table::in, compensation_table::out) is det.
 
-propagate_to_proc_dynamic(CliqueNumber, ParentCSDPtr, PDPtr, Deep0, Deep,
-		SumTable0, SumTable, OverrideTable0, OverrideTable) :-
-	flat_call_sites(Deep0 ^ proc_dynamics, PDPtr, CSDPtrs),
+propagate_to_proc_dynamic(CliqueNumber, ParentCSDPtr, PDPtr, !Deep,
+        !SumTable, !OverrideTable) :-
+    flat_call_sites(!.Deep ^ proc_dynamics, PDPtr, CSDPtrs),
 	list__foldl2(propagate_to_call_site(CliqueNumber, PDPtr),
-		CSDPtrs, Deep0, Deep1, map__init, PDCompTable),
-	deep_update_pd_comp_table(Deep1, PDPtr, PDCompTable, Deep2),
+        CSDPtrs, !Deep, map__init, PDCompTable),
+    deep_update_pd_comp_table(PDPtr, PDCompTable, !Deep),
 
-	deep_lookup_pd_desc(Deep2, PDPtr, ProcDesc),
-	deep_lookup_pd_own(Deep2, PDPtr, ProcOwn),
+    deep_lookup_pd_desc(!.Deep, PDPtr, ProcDesc),
+    deep_lookup_pd_own(!.Deep, PDPtr, ProcOwn),
 	ProcTotal = add_own_to_inherit(ProcOwn, ProcDesc),
 
-	SumTable = add_comp_tables(SumTable0, PDCompTable),
-	deep_lookup_proc_dynamics(Deep2, PDPtr, PD),
+    !:SumTable = add_comp_tables(!.SumTable, PDCompTable),
+    deep_lookup_proc_dynamics(!.Deep, PDPtr, PD),
 	PSPtr = PD ^ pd_proc_static,
-	deep_lookup_proc_statics(Deep2, PSPtr, PS),
+    deep_lookup_proc_statics(!.Deep, PSPtr, PS),
 	( PS ^ ps_is_zeroed = zeroed ->
-		OverrideTable = add_to_override(OverrideTable0, PSPtr,
-			ProcTotal)
+        !:OverrideTable = add_to_override(!.OverrideTable, PSPtr, ProcTotal)
 	;
-		OverrideTable = OverrideTable0
+        true
 	),
 
-	( valid_call_site_dynamic_ptr(Deep1, ParentCSDPtr) ->
-		deep_lookup_csd_desc(Deep2, ParentCSDPtr, ParentDesc0),
+    ( valid_call_site_dynamic_ptr(!.Deep, ParentCSDPtr) ->
+        deep_lookup_csd_desc(!.Deep, ParentCSDPtr, ParentDesc0),
 		ParentDesc = add_inherit_to_inherit(ParentDesc0, ProcTotal),
-		deep_update_csd_desc(Deep2, ParentCSDPtr, ParentDesc, Deep)
+        deep_update_csd_desc(ParentCSDPtr, ParentDesc, !Deep)
 	;
-		Deep = Deep2
+        true
 	).
 
 :- pred propagate_to_call_site(int::in, proc_dynamic_ptr::in,
 	call_site_dynamic_ptr::in, deep::in, deep::out,
 	compensation_table::in, compensation_table::out) is det.
 
-propagate_to_call_site(CliqueNumber, PDPtr, CSDPtr, Deep0, Deep,
-		PDCompTable0, PDCompTable) :-
-	deep_lookup_call_site_dynamics(Deep0, CSDPtr, CSD),
+propagate_to_call_site(CliqueNumber, PDPtr, CSDPtr, !Deep, !PDCompTable) :-
+    deep_lookup_call_site_dynamics(!.Deep, CSDPtr, CSD),
 	CalleeOwn = CSD ^ csd_own_prof,
 	CalleePDPtr = CSD ^ csd_callee,
-	deep_lookup_clique_index(Deep0, CalleePDPtr, ChildCliquePtr),
+    deep_lookup_clique_index(!.Deep, CalleePDPtr, ChildCliquePtr),
 	ChildCliquePtr = clique_ptr(ChildCliqueNumber),
 	( ChildCliqueNumber \= CliqueNumber ->
-		deep_lookup_pd_desc(Deep0, PDPtr, ProcDesc0),
-		deep_lookup_csd_desc(Deep0, CSDPtr, CalleeDesc),
+        deep_lookup_pd_desc(!.Deep, PDPtr, ProcDesc0),
+        deep_lookup_csd_desc(!.Deep, CSDPtr, CalleeDesc),
 		CalleeTotal = add_own_to_inherit(CalleeOwn, CalleeDesc),
 		ProcDesc = add_inherit_to_inherit(ProcDesc0, CalleeTotal),
-		deep_update_pd_desc(Deep0, PDPtr, ProcDesc, Deep),
-		deep_lookup_csd_comp_table(Deep, CSDPtr, CSDCompTable),
-		PDCompTable = add_comp_tables(PDCompTable0, CSDCompTable)
+        deep_update_pd_desc(PDPtr, ProcDesc, !Deep),
+        deep_lookup_csd_comp_table(!.Deep, CSDPtr, CSDCompTable),
+        !:PDCompTable = add_comp_tables(!.PDCompTable, CSDCompTable)
 	;
 		% We don't propagate profiling measurements
 		% along intra-clique calls.
-		Deep = Deep0,
-		PDCompTable = PDCompTable0
+        true
 	).
 
 %-----------------------------------------------------------------------------%
@@ -794,27 +781,25 @@
 :- func add_comp_tables(compensation_table, compensation_table)
 	= compensation_table.
 
-add_comp_tables(CompTable1, CompTable2) = CompTable :-
-	( map__is_empty(CompTable1) ->
-		CompTable = CompTable2
-	; map__is_empty(CompTable2) ->
-		CompTable = CompTable1
+add_comp_tables(CompTableA, CompTableB) = CompTable :-
+    ( map__is_empty(CompTableA) ->
+        CompTable = CompTableB
+    ; map__is_empty(CompTableB) ->
+        CompTable = CompTableA
 	;
-		CompTable = map__union(add_inherit_to_inherit,
-			CompTable1, CompTable2)
+        CompTable = map__union(add_inherit_to_inherit, CompTableA, CompTableB)
 	).
 
 :- func apply_override(compensation_table, compensation_table)
 	= compensation_table.
 
-apply_override(CompTable1, CompTable2) = CompTable :-
-	( map__is_empty(CompTable1) ->
-		CompTable = CompTable2
-	; map__is_empty(CompTable2) ->
-		CompTable = CompTable1
+apply_override(CompTableA, CompTableB) = CompTable :-
+    ( map__is_empty(CompTableA) ->
+        CompTable = CompTableB
+    ; map__is_empty(CompTableB) ->
+        CompTable = CompTableA
 	;
-		CompTable = map__union(select_override_comp,
-			CompTable1, CompTable2)
+        CompTable = map__union(select_override_comp, CompTableA, CompTableB)
 	).
 
 :- func select_override_comp(inherit_prof_info, inherit_prof_info)
@@ -907,78 +892,3 @@
 maybe_report_msg(no, _, !IO).
 
 %-----------------------------------------------------------------------------%
-
-% Predicates for use in debugging.
-
-% :- pred print_pdis(initial_deep::in, list(int)::in,
-% 	io::di, io::uo) is det.
-% 
-% print_pdis(InitDeep, PDIs, !IO) :-
-% 	io__nl(!IO),
-% 	io__write_list(PDIs, "", print_pdi_nl(InitDeep), !IO).
-% 
-% :- pred print_pdi_nl(initial_deep::in, int::in, io::di, io::uo)
-% 	is det.
-% 
-% print_pdi_nl(InitDeep, PDI, !IO) :-
-% 	print_pdi(InitDeep, PDI, !IO),
-% 	io__nl(!IO).
-% 
-% :- pred print_pdi(initial_deep::in, int::in, io::di, io::uo)
-% 	is det.
-% 
-% print_pdi(InitDeep, PDI, !IO) :-
-% 	PDIsTmp = InitDeep ^ init_proc_dynamics,
-% 	lookup_proc_dynamics(PDIsTmp, proc_dynamic_ptr(PDI), PD),
-% 	io__format("pd %d: ", [i(PDI)], !IO),
-% 	io__write(PD, !IO),
-% 	io__nl(!IO),
-% 	proc_static_ptr(PSI) = PD ^ pd_proc_static,
-% 	PSIsTmp = InitDeep ^ init_proc_statics,
-% 	lookup_proc_statics(PSIsTmp, proc_static_ptr(PSI), PS),
-% 	io__format("ps %d: ", [i(PSI)], !IO),
-% 	io__write(PS, !IO),
-% 	io__nl(!IO).
-% 
-% :- pred print_csdis(initial_deep::in, list(int)::in,
-% 	io::di, io::uo) is det.
-% 
-% print_csdis(InitDeep, CSDIs, !IO) :-
-% 	io__nl(!IO),
-% 	io__write_list(CSDIs, "", print_csdi_nl(InitDeep), !IO).
-% 
-% :- pred print_csdi_nl(initial_deep::in, int::in, io::di, io::uo)
-% 	is det.
-% 
-% print_csdi_nl(InitDeep, CSDI, !IO) :-
-% 	print_csdi(InitDeep, CSDI, !IO),
-% 	io__nl(!IO).
-% 
-% :- pred print_csdi(initial_deep::in, int::in, io::di, io::uo)
-% 	is det.
-% 
-% print_csdi(InitDeep, CSDI, !IO) :-
-% 	CSDIsTmp = InitDeep ^ init_call_site_dynamics,
-% 	lookup_call_site_dynamics(CSDIsTmp, call_site_dynamic_ptr(CSDI), CSD),
-% 	io__format("csd %d: ", [i(CSDI)], !IO),
-% 	io__write(CSD, !IO),
-% 	io__nl(!IO),
-% 	io__write_string("caller pd:\n", !IO),
-% 	proc_dynamic_ptr(CallerPDI) = CSD ^ csd_caller,
-% 	print_pdi(InitDeep, CallerPDI, !IO),
-% 	io__write_string("callee pd:\n", !IO),
-% 	proc_dynamic_ptr(CalleePDI) = CSD ^ csd_callee,
-% 	print_pdi(InitDeep, CalleePDI, !IO).
-% 
-% :- pred write_pdi_cn_csd(int::in, int::in, int::in,
-% 	io::di, io::uo) is det.
-% 
-% write_pdi_cn_csd(PDI, CN, CSDI, !IO) :-
-% 	io__write_string("pdi ", !IO),
-% 	io__write_int(PDI, !IO),
-% 	io__write_string(", cn ", !IO),
-% 	io__write_int(CN, !IO),
-% 	io__write_string(", csdi ", !IO),
-% 	io__write_int(CSDI, !IO),
-% 	io__nl(!IO),
-% 	io__flush_output(!IO).
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