[m-rev.] for review: add --force-disable-trace compiler option

Ian MacLarty maclarty at cs.mu.OZ.AU
Wed Jun 15 16:34:33 AEST 2005


Estimated hours taken: 1
Branches: main

Add a new compiler option --force-disable-tracing which forces tracing to be
turned off even if compiling in a .debug or .decldebug grade.
This is necessary so that the declarative debugger can be compiled with no
tracing even in .debug or .decldebug grades.
This allows the declarative debugger to use tail recursion, improves its
performance and reduces the size of the installed browser library for
.debug and .decldebug grades.

This diff does not use the --force-disable-tracing option.  It is only added to
the compiler.  A subsequenct diff will use the option to turn off tracing by
default in the browser directory.

The declarative debugger will still call traced code in the library,
however, so this is not a general fix.
A more general solution would be to link in a non-traced version of the
library when compiling the declarative debugger, but that can be done later.

compiler/handle_options.m:
compiler/options.m:
	Add and handle the new option.  It overrides all other tracing
	options.

Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.230
diff -u -r1.230 handle_options.m
--- compiler/handle_options.m	18 May 2005 05:44:57 -0000	1.230
+++ compiler/handle_options.m	15 Jun 2005 05:46:09 -0000
@@ -254,29 +254,36 @@
 			"`--termination2-norm'\n\t(must be" ++
 			"`simple', `total' or `num-data-elems').", !Errors)
 	),
-	map__lookup(OptionTable0, trace, Trace),
-	map__lookup(OptionTable0, exec_trace, ExecTraceOpt),
-	map__lookup(OptionTable0, decl_debug, DeclDebugOpt),
+	map__lookup(OptionTable0, force_disable_tracing, ForceDisableTracing),
 	(
-		Trace = string(TraceStr),
-		ExecTraceOpt = bool(ExecTrace),
-		DeclDebugOpt = bool(DeclDebug),
-		convert_trace_level(TraceStr, ExecTrace, DeclDebug,
-			MaybeTraceLevel)
+		ForceDisableTracing = bool(yes)
 	->
+		TraceLevel = trace_level_none
+	;
+		map__lookup(OptionTable0, trace, Trace),
+		map__lookup(OptionTable0, exec_trace, ExecTraceOpt),
+		map__lookup(OptionTable0, decl_debug, DeclDebugOpt),
 		(
-			MaybeTraceLevel = yes(TraceLevel)
+			Trace = string(TraceStr),
+			ExecTraceOpt = bool(ExecTrace),
+			DeclDebugOpt = bool(DeclDebug),
+			convert_trace_level(TraceStr, ExecTrace, DeclDebug,
+				MaybeTraceLevel)
+		->
+			(
+				MaybeTraceLevel = yes(TraceLevel)
+			;
+				MaybeTraceLevel = no,
+				TraceLevel = trace_level_none,	% dummy
+				add_error("Specified trace level is not " ++
+					"compatible with grade", !Errors)
+			)
 		;
-			MaybeTraceLevel = no,
 			TraceLevel = trace_level_none,	% dummy
-			add_error("Specified trace level is not " ++
-				"compatible with grade", !Errors)
+			add_error("Invalid argument to option `--trace'\n\t" ++
+				"(must be `minimum', `shallow', `deep', " ++
+				"`decl', `rep' or `default').", !Errors)
 		)
-	;
-		TraceLevel = trace_level_none,	% dummy
-		add_error("Invalid argument to option `--trace'\n\t" ++
-			"(must be `minimum', `shallow', `deep', `decl', " ++
-			"`rep' or `default').", !Errors)
 	),
 	map__lookup(OptionTable0, suppress_trace, Suppress),
 	(
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.459
diff -u -r1.459 options.m
--- compiler/options.m	17 May 2005 04:37:57 -0000	1.459
+++ compiler/options.m	15 Jun 2005 05:46:09 -0000
@@ -165,6 +165,13 @@
 		;	trace_table_io_all
 		;	delay_death
 		;	suppress_trace
+
+				% Force no tracing, even in .debug grades.
+				% This is used to turn off tracing in the
+				% browser directory while still allowing
+				% the browser library to be linked in with an
+				% executable compiled in a .debug grade.
+		;	force_disable_tracing
 		;	stack_trace_higher_order
 		;	tabling_via_extra_args
 		;	allow_table_reset
@@ -892,6 +899,7 @@
 	trace_table_io_require	-	bool(no),
 	trace_table_io_all	-	bool(no),
 	suppress_trace		-	string(""),
+	force_disable_tracing	-	bool(no),
 	delay_death		-	bool(yes),
 	stack_trace_higher_order -	bool(no),
 	tabling_via_extra_args	-	bool(yes),
@@ -1579,6 +1587,7 @@
 long_option("trace-table-io-require",	trace_table_io_require).
 long_option("trace-table-io-all",	trace_table_io_all).
 long_option("suppress-trace",		suppress_trace).
+long_option("force-disable-tracing",	force_disable_tracing).
 long_option("delay-death",		delay_death).
 long_option("stack-trace-higher-order",	stack_trace_higher_order).
 long_option("tabling-via-extra-args",	tabling_via_extra_args).

--------------------------------------------------------------------------
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