[m-rev.] for review: allow bootstrap in profdeep grades

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed Aug 7 12:21:35 AEST 2002


For anyone to review.

Since this change should have no effect on code compiled without deep profiling
or debugging, I intend to commit it in a day or two if noone reviews in before
then.

Zoltan.

Make the compiler bootstrap again in deep profiling grades, even with sanity
checks enabled. A few test cases still fail, and actually writing out profiling
data still trips a sanity check.

library/exception.m:
runtime/mercury_exception_catch_body.h:
	Fix a bug: builtin_catch was not calling prepare_for_ho_call before
	making a higher order call. This let the call port code in the called
	predicate access memory through an uninitialized pointer.

library/private_builtin.m:
	Fix the initialization code used in deep profiling grades, which
	previously were misrepresenting internal labels as entry labels.

compiler/options.m:
	Turn off the special handling of tail recursion by the deep profiling
	transformation, since at the moment it doesn't work.

compiler/layout_out.m:
	When outputing each call_site_static structure, include a comment
	giving its offset in the array containing it. This makes it easier
	to find the index you want in a large array of call_site_static
	structures.

runtime/mercury_debug.[ch]:
	Add an extra argument to MR_print_deep_prof_vars, to identify where it
	is called from. This makes it easier to understand debugging output.

runtime/mercury_deep_call_port_body.h:
library/profiling_builtin.m:
trace/mercury_trace_internal.m:
	Add the new argument to calls to MR_print_deep_prof_vars.

	Make calls to MR_print_deep_prof_vars conditional on a runtime test,
	to prevent huge amounts of unwanted output.

cvs diff: Diffing .
cvs diff: Diffing bench
cvs diff: Diffing bench/progs
cvs diff: Diffing bench/progs/compress
cvs diff: Diffing bench/progs/icfp2000
cvs diff: Diffing bench/progs/icfp2001
cvs diff: Diffing bench/progs/nuc
cvs diff: Diffing bench/progs/ray
cvs diff: Diffing bench/progs/tree234
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/layout_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/layout_out.m,v
retrieving revision 1.13
diff -u -b -r1.13 layout_out.m
--- compiler/layout_out.m	2002/08/06 00:30:46	1.13
+++ compiler/layout_out.m	2002/08/06 09:40:15
@@ -1181,16 +1181,18 @@
 	io__write_string("\n"),
 	output_layout_name_storage_type_name(LayoutName, yes),
 	io__write_string(" = {\n"),
-	list__foldl(output_call_site_static, CallSites),
+	list__foldl2(output_call_site_static, CallSites, 0, _),
 	io__write_string("};\n"),
 	{ decl_set_insert(DeclSet0, data_addr(layout_addr(LayoutName)),
 		DeclSet) }.
 
-:- pred output_call_site_static(call_site_static_data::in,
+:- pred output_call_site_static(call_site_static_data::in, int::in, int::out,
 	io__state::di, io__state::uo) is det.
 
-output_call_site_static(CallSiteStatic) -->
-	io__write_string("\t{ "),
+output_call_site_static(CallSiteStatic, Index, Index + 1) -->
+	io__write_string("\t{ /* "),
+	io__write_int(Index),
+	io__write_string(" */ "),
 	(
 		{ CallSiteStatic = normal_call(Callee, TypeSubst,
 			FileName, LineNumber, GoalPath) },
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.378
diff -u -b -r1.378 options.m
--- compiler/options.m	2002/07/29 07:50:58	1.378
+++ compiler/options.m	2002/08/05 03:00:55
@@ -754,7 +754,7 @@
 				-	bool(yes),
 	use_lots_of_ho_specialization
 				-	bool(no),
-	deep_profile_tail_recursion	-	bool(yes),
+	deep_profile_tail_recursion	-	bool(no),
 		% (c) Miscellaneous optional features
 	gc			-	string("conservative"),
 	parallel		-	bool(no),
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing java
cvs diff: Diffing java/library
cvs diff: Diffing java/runtime
cvs diff: Diffing library
Index: library/exception.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/exception.m,v
retrieving revision 1.68
diff -u -b -r1.68 exception.m
--- library/exception.m	2002/08/02 06:28:51	1.68
+++ library/exception.m	2002/08/05 01:59:19
@@ -1419,6 +1419,15 @@
 MR_declare_label(mercury__exception__builtin_catch_3_5_i7);
 #endif
 
+#ifdef	MR_DEEP_PROFILING
+MR_declare_label(mercury__exception__builtin_catch_3_0_i8);
+MR_declare_label(mercury__exception__builtin_catch_3_1_i8);
+MR_declare_label(mercury__exception__builtin_catch_3_2_i8);
+MR_declare_label(mercury__exception__builtin_catch_3_3_i8);
+MR_declare_label(mercury__exception__builtin_catch_3_4_i8);
+MR_declare_label(mercury__exception__builtin_catch_3_5_i8);
+#endif
+
 MR_declare_label(mercury__exception__builtin_throw_1_0_i1);
 
 /*
@@ -1493,6 +1502,15 @@
 MR_MAKE_INTERNAL_LAYOUT(mercury__exception__builtin_catch_3_5, 7);
 #endif
 
+#ifdef	MR_DEEP_PROFILING
+MR_MAKE_INTERNAL_LAYOUT(mercury__exception__builtin_catch_3_0, 8);
+MR_MAKE_INTERNAL_LAYOUT(mercury__exception__builtin_catch_3_1, 8);
+MR_MAKE_INTERNAL_LAYOUT(mercury__exception__builtin_catch_3_2, 8);
+MR_MAKE_INTERNAL_LAYOUT(mercury__exception__builtin_catch_3_3, 8);
+MR_MAKE_INTERNAL_LAYOUT(mercury__exception__builtin_catch_3_4, 8);
+MR_MAKE_INTERNAL_LAYOUT(mercury__exception__builtin_catch_3_5, 8);
+#endif
+
 MR_MAKE_PROC_LAYOUT(mercury__exception__builtin_throw_1_0,
         MR_DETISM_DET, 1, MR_LONG_LVAL_STACKVAR(1),
         MR_PREDICATE, ""exception"", ""builtin_throw"", 1, 0);
@@ -1568,6 +1586,15 @@
 #ifdef	MR_DEEP_PROFILING
 	MR_init_label_sl(mercury__exception__builtin_catch_3_4_i7);
 	MR_init_label_sl(mercury__exception__builtin_catch_3_5_i7);
+#endif
+
+#ifdef	MR_DEEP_PROFILING
+	MR_init_label(mercury__exception__builtin_catch_3_0_i8);
+	MR_init_label(mercury__exception__builtin_catch_3_1_i8);
+	MR_init_label(mercury__exception__builtin_catch_3_2_i8);
+	MR_init_label(mercury__exception__builtin_catch_3_3_i8);
+	MR_init_label(mercury__exception__builtin_catch_3_4_i8);
+	MR_init_label(mercury__exception__builtin_catch_3_5_i8);
 #endif
 
 	MR_init_entry_sl(mercury__exception__builtin_throw_1_0);
Index: library/private_builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/private_builtin.m,v
retrieving revision 1.106
diff -u -b -r1.106 private_builtin.m
--- library/private_builtin.m	2002/08/01 11:52:23	1.106
+++ library/private_builtin.m	2002/08/05 04:34:17
@@ -408,18 +408,18 @@
 	MR_init_entry(mercury____Unify___private_builtin__typeclass_info_1_0);
 	MR_init_entry(mercury____Compare___private_builtin__typeclass_info_1_0);
 #ifdef	MR_DEEP_PROFILING
-	MR_init_entry(mercury____Unify___private_builtin__type_info_1_0_i1);
-	MR_init_entry(mercury____Unify___private_builtin__type_info_1_0_i2);
-	MR_init_entry(mercury____Unify___private_builtin__type_info_1_0_i3);
-	MR_init_entry(mercury____Unify___private_builtin__type_info_1_0_i4);
-	MR_init_entry(mercury____Compare___private_builtin__type_info_1_0_i1);
-	MR_init_entry(mercury____Compare___private_builtin__type_info_1_0_i2);
-	MR_init_entry(mercury____Unify___private_builtin__typeclass_info_1_0_i1);
-	MR_init_entry(mercury____Unify___private_builtin__typeclass_info_1_0_i2);
-	MR_init_entry(mercury____Unify___private_builtin__typeclass_info_1_0_i3);
-	MR_init_entry(mercury____Unify___private_builtin__typeclass_info_1_0_i4);
-	MR_init_entry(mercury____Compare___private_builtin__typeclass_info_1_0_i1);
-	MR_init_entry(mercury____Compare___private_builtin__typeclass_info_1_0_i2);
+	MR_init_label(mercury____Unify___private_builtin__type_info_1_0_i1);
+	MR_init_label(mercury____Unify___private_builtin__type_info_1_0_i2);
+	MR_init_label(mercury____Unify___private_builtin__type_info_1_0_i3);
+	MR_init_label(mercury____Unify___private_builtin__type_info_1_0_i4);
+	MR_init_label(mercury____Compare___private_builtin__type_info_1_0_i1);
+	MR_init_label(mercury____Compare___private_builtin__type_info_1_0_i2);
+	MR_init_label(mercury____Unify___private_builtin__typeclass_info_1_0_i1);
+	MR_init_label(mercury____Unify___private_builtin__typeclass_info_1_0_i2);
+	MR_init_label(mercury____Unify___private_builtin__typeclass_info_1_0_i3);
+	MR_init_label(mercury____Unify___private_builtin__typeclass_info_1_0_i4);
+	MR_init_label(mercury____Compare___private_builtin__typeclass_info_1_0_i1);
+	MR_init_label(mercury____Compare___private_builtin__typeclass_info_1_0_i2);
 #endif
 MR_BEGIN_CODE
 
Index: library/profiling_builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/profiling_builtin.m,v
retrieving revision 1.8
diff -u -b -r1.8 profiling_builtin.m
--- library/profiling_builtin.m	2002/06/14 10:18:51	1.8
+++ library/profiling_builtin.m	2002/08/05 07:48:57
@@ -729,7 +729,9 @@
 	MR_enter_instrumentation();
 
   #ifdef MR_DEEP_PROFILING_LOWLEVEL_DEBUG
-	MR_print_deep_prof_vars(stdout);
+	if (MR_calldebug) {
+		MR_print_deep_prof_vars(stdout, ""prepare_for_tail_call"");
+	}
   #endif
 
 	csd = MR_current_call_site_dynamic;
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_debug.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_debug.c,v
retrieving revision 1.10
diff -u -b -r1.10 mercury_debug.c
--- runtime/mercury_debug.c	2002/02/18 07:01:14	1.10
+++ runtime/mercury_debug.c	2002/08/05 02:57:50
@@ -111,7 +111,7 @@
 	}
 
 #ifdef	MR_DEEP_PROFILING
-	MR_print_deep_prof_vars(stdout);
+	MR_print_deep_prof_vars(stdout, "MR_call_msg");
 #endif
 }
 
@@ -127,7 +127,7 @@
 	}
 
 #ifdef	MR_DEEP_PROFILING
-	MR_print_deep_prof_vars(stdout);
+	MR_print_deep_prof_vars(stdout, "MR_tailcall_msg");
 #endif
 }
 
@@ -140,7 +140,7 @@
 	}
 
 #ifdef	MR_DEEP_PROFILING
-	MR_print_deep_prof_vars(stdout);
+	MR_print_deep_prof_vars(stdout, "MR_proceed_msg");
 #endif
 }
 
@@ -236,7 +236,7 @@
 	if (MR_print_raw_addrs) {
 		printf("string %p %s\n", (const void *) s, s);
 	} else {
-		printf("string %s\n", s, s);
+		printf("string %s\n", s);
 	}
 }
 
Index: runtime/mercury_debug.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_debug.h,v
retrieving revision 1.12
diff -u -b -r1.12 mercury_debug.h
--- runtime/mercury_debug.h	2001/05/31 06:00:11	1.12
+++ runtime/mercury_debug.h	2002/08/05 02:58:06
@@ -135,11 +135,12 @@
 
 #endif /* MR_LOWLEVEL_DEBUG */
 
-#define	MR_print_deep_prof_vars(fp)					     \
+#define	MR_print_deep_prof_vars(fp, msg)				\
 	do {								     \
-		MR_print_deep_prof_var(stdout, "current_call_site_dynamic",  \
+		fprintf(fp, "%s\n", msg);				\
+		MR_print_deep_prof_var(fp, "current_call_site_dynamic", \
 			MR_current_call_site_dynamic);			     \
-		MR_print_deep_prof_var(stdout, "next_call_site_dynamic",     \
+		MR_print_deep_prof_var(fp, "next_call_site_dynamic",	\
 			MR_next_call_site_dynamic);			     \
 	} while (0)
 
Index: runtime/mercury_deep_call_port_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deep_call_port_body.h,v
retrieving revision 1.2
diff -u -b -r1.2 mercury_deep_call_port_body.h
--- runtime/mercury_deep_call_port_body.h	2001/05/31 06:00:11	1.2
+++ runtime/mercury_deep_call_port_body.h	2002/08/05 07:46:50
@@ -40,7 +40,9 @@
 	MR_enter_instrumentation();
 
   #ifdef MR_DEEP_PROFILING_LOWLEVEL_DEBUG
-	MR_print_deep_prof_vars(stdout);
+	if (MR_calldebug) {
+		MR_print_deep_prof_vars(stdout, MR_PROCNAME);
+	}
   #endif
 
 	TopCSD = (MR_Word) MR_current_call_site_dynamic;
Index: runtime/mercury_deep_profiling.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deep_profiling.h,v
retrieving revision 1.6
diff -u -b -r1.6 mercury_deep_profiling.h
Index: runtime/mercury_exception_catch_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_exception_catch_body.h,v
retrieving revision 1.2
diff -u -b -r1.2 mercury_exception_catch_body.h
--- runtime/mercury_exception_catch_body.h	2001/05/31 06:00:13	1.2
+++ runtime/mercury_exception_catch_body.h	2002/08/05 01:50:16
@@ -42,6 +42,7 @@
 #define	REDO_PORT_RETURN_LABEL(pl)	MR_PASTE3(pl, _i, 5)
 #define	FAIL_REDOIP_LABEL(pl)		MR_PASTE3(pl, _i, 6)
 #define	FAIL_PORT_RETURN_LABEL(pl)	MR_PASTE3(pl, _i, 7)
+#define	PREPARE_RETURN_LABEL(pl)	MR_PASTE3(pl, _i, 8)
 
 #if	defined(version_model_non) && \
 		(defined(MR_USE_TRAIL) || defined(MR_DEEP_PROFILING))
@@ -73,6 +74,8 @@
 	MR_framevar(1) = MR_r2;
 	MR_deep_non_call(proc_label, proc_static, FIRST_DEEP_SLOT,
 		CALL_PORT_RETURN_LABEL(proc_label));
+	MR_deep_prepare_ho_call(proc_label, FIRST_DEEP_SLOT,
+		PREPARE_RETURN_LABEL(proc_label), 0, MR_framevar(1));
 	MR_r1 = MR_framevar(1);	/* The Goal to call */
 #else
 	MR_r1 = MR_r2;		/* The Goal to call */
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
Index: trace/mercury_trace_internal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.132
diff -u -b -r1.132 mercury_trace_internal.c
--- trace/mercury_trace_internal.c	2002/08/05 21:46:19	1.132
+++ trace/mercury_trace_internal.c	2002/08/06 00:56:19
@@ -3130,7 +3130,7 @@
 		MR_print_succip_reg(MR_mdb_out, saved_regs);
 		MR_print_r_regs(MR_mdb_out, saved_regs);
 #ifdef	MR_DEEP_PROFILING
-		MR_print_deep_prof_vars(MR_mdb_out);
+		MR_print_deep_prof_vars(MR_mdb_out, "mdb all_regs");
 #endif
 	} else {
 		MR_trace_usage("developer", "all_regs");
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
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