[m-rev.] for review: deep profiling fixes, determinism algorithm change

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Aug 14 15:47:03 AEST 2002


On 14-Aug-2002, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> On 14-Aug-2002, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> > I will post a relative diff later today.
> 
> Here it is.
> 
> Diffing .
> Diffing bench
> Diffing bench/progs
> Diffing bench/progs/compress
> Diffing bench/progs/icfp2000
> Diffing bench/progs/icfp2001
> Diffing bench/progs/nuc
> Diffing bench/progs/ray
> Diffing bench/progs/tree234
> Diffing bindist
> Diffing boehm_gc
> Diffing boehm_gc/Mac_files
> Diffing boehm_gc/cord
> Diffing boehm_gc/cord/private
> Diffing boehm_gc/doc
> Diffing boehm_gc/include
> Diffing boehm_gc/include/private
> Diffing boehm_gc/tests
> Diffing browser
> Diffing bytecode
> Diffing compiler
> --- ws86.basis//compiler/det_analysis.m	Sun Aug 11 11:53:33 2002
> +++ ws86/compiler/det_analysis.m	Wed Aug 14 13:24:19 2002
> @@ -843,6 +843,17 @@
>  		Msgs1),
>  	determinism_components(Detism1, CanFail1, MaxSolns1),
>  	Goal = _ - GoalInfo,
> +	% If a disjunct cannot succeed but is marked with the
> +	% preserve_backtrack_into feature, treat it as being able to succeed
> +	% when computing the max number of solutions of the disjunction as a
> +	% whole, *provided* that some earlier disjuct could succeed. The idea
> +	% is that ( marked failure ; det ) should be treated as det, since all
> +	% backtracking is local within it, while disjunctions of the form
> +	% ( det ; marked failure ) should be treated as multi, since we want
> +	% to be able to backtrack to the second disjunct from *outside*
> +	% the disjunction. This is useful for program transformation that want
> +	% to get control on exits to and redos into model_non procedures.
> +	% Deep profiling is one such transformation.
>  	(
>  		MaxSolns0 \= at_most_zero,
>  		MaxSolns1 = at_most_zero,
> --- ws86.basis//compiler/hlds_goal.m	Mon Aug 12 21:49:32 2002
> +++ ws86/compiler/hlds_goal.m	Wed Aug 14 13:21:08 2002
> @@ -725,7 +725,11 @@
>  				% nondeterminism inside the some() should be
>  				% exposed to the environment outside.
>  	;	preserve_backtrack_into
> -				% This
> +				% Determinism analysis should preserve
> +				% backtracking into goals marked with this
> +				% feature, even if their determinism puts an
> +				% at_most_zero upper bound on the number of
> +				% solutions they have.
>  	;	tailcall.	% This goal represents a tail call. This marker
>  				% is used by deep profiling.
>  
> Diffing compiler/notes
> Diffing debian
> Diffing deep_profiler
> Diffing deep_profiler/notes
> Diffing doc
> Diffing extras
> Diffing extras/aditi
> Diffing extras/cgi
> Diffing extras/complex_numbers
> Diffing extras/complex_numbers/samples
> Diffing extras/complex_numbers/tests
> Diffing extras/concurrency
> Diffing extras/curs
> Diffing extras/curs/samples
> Diffing extras/curses
> Diffing extras/curses/sample
> Diffing extras/dynamic_linking
> Diffing extras/graphics
> Diffing extras/graphics/mercury_opengl
> Diffing extras/graphics/mercury_tcltk
> Diffing extras/graphics/samples
> Diffing extras/graphics/samples/calc
> Diffing extras/graphics/samples/maze
> Diffing extras/graphics/samples/pent
> Diffing extras/lazy_evaluation
> Diffing extras/lex
> Diffing extras/lex/samples
> Diffing extras/logged_output
> Diffing extras/moose
> Diffing extras/moose/samples
> Diffing extras/morphine
> Diffing extras/morphine/non-regression-tests
> Diffing extras/morphine/scripts
> Diffing extras/morphine/source
> Diffing extras/odbc
> Diffing extras/posix
> Diffing extras/quickcheck
> Diffing extras/quickcheck/tutes
> Diffing extras/references
> Diffing extras/references/samples
> Diffing extras/references/tests
> Diffing extras/stream
> Diffing extras/trailed_update
> Diffing extras/trailed_update/samples
> Diffing extras/trailed_update/tests
> Diffing extras/xml
> Diffing extras/xml/samples
> Diffing java
> Diffing java/library
> Diffing java/runtime
> Diffing library
> Diffing profiler
> Diffing robdd
> Diffing runtime
> --- ws86.basis//runtime/mercury_engine.h	Mon Aug 12 01:15:42 2002
> +++ ws86/runtime/mercury_engine.h	Wed Aug 14 14:18:52 2002
> @@ -36,6 +36,11 @@
>  
>  extern	MR_bool	MR_debugflag[];
>  
> +/*
> +** These #defines, except MR_MAXFLAG, should not be used anywhere
> +** except in the immediately following block of #defines.
> +*/
> +
>  #define	MR_PROGFLAG		0
>  #define	MR_GOTOFLAG		1
>  #define	MR_CALLFLAG		2
> @@ -51,12 +56,62 @@
>  #define	MR_TABLESTACKFLAG	12
>  #define	MR_UNBUFFLAG		13
>  #define	MR_AGC_FLAG 		14
> -#define	MR_ORDINARYREGFLAG	15
> -#define	MR_ANYREGFLAG 		16
> +#define	MR_ORDINARY_REG_FLAG	15
> +#define	MR_ANY_REG_FLAG 	16
>  #define	MR_DETAILFLAG		17
>  #define	MR_MAXFLAG		18
>  /* MR_DETAILFLAG should be the last real flag */
>  
> +/*
> +** The macros control different kinds of low level debugging messages.
> +** Usually, their values are all false.
> +**
> +** MR_progdebug controls whether we want to get several mostly explicitly
> +** programmed diagnostics.
> +**
> +** MR_sregdebug controls whether we want to print the values of the special
> +** registers (e.g. those that point to the stack) at some diagnostic points.
> +**
> +** MR_ordregdebug controls whether we want to print the values of the ordinary
> +** registers (e.g. r1, r2 etc) at some diagnostic points.
> +**
> +** MR_anyregdebug controls whether we want to print the values of the any
> +** registers, either special or ordinary, at some diagnostic points.
> +**
> +** MR_gotodebug controls whether we should generate diagnostics at gotos.
> +**
> +** MR_calldebug controls whether we should generate diagnostics when control
> +** crosses procedure boundaries, i.e. calls, exits, redos and fails.
> +**
> +** MR_detstackdebug and MR_nondstackdebug control whether we should generate
> +** diagnostics when incrementing and decrementing the pointers to the
> +** respective stacks.
> +**
> +** MR_heapdebug controls whether we should generate diagnostics when we
> +** allocate memory on the heap.
> +**
> +** MR_tabledebug controls whether we should generate diagnostics for tabling
> +** operations. MR_tablestackdebug control whether these should include the
> +** contents of stack segments manipulated by minimal model tabling.
> +** MR_hashdebug controls whether these should include details of hash table
> +** accesses.
> +**
> +** MR_agcdebug controls whether we should generate diagnostics for accurate
> +** gc operations.
> +**
> +** MR_detaildebug controls whether we want more or less detail in some
> +** diagnostics.
> +**
> +** MR_unbufdebug controls whether the runtime will make stdout and stderr
> +** unbuffered.
> +**
> +** MR_memdebug controls whether we want to get diagnostics on the setup of
> +** memory zones.
> +**
> +** MR_finaldebug controls whether we want to get diagnostics showing how
> +** execution reaches the end of the program.
> +*/
> +
>  #define	MR_progdebug		MR_debugflag[MR_PROGFLAG]
>  #define	MR_gotodebug		MR_debugflag[MR_GOTOFLAG]
>  #define	MR_calldebug		MR_debugflag[MR_CALLFLAG]
> @@ -72,8 +127,8 @@
>  #define	MR_tablestackdebug	MR_debugflag[MR_TABLESTACKFLAG]
>  #define	MR_unbufdebug		MR_debugflag[MR_UNBUFFLAG]
>  #define	MR_agc_debug		MR_debugflag[MR_AGC_FLAG]
> -#define	MR_ordregdebug		MR_debugflag[MR_ORDINARYREGFLAG]
> -#define	MR_anyregdebug		MR_debugflag[MR_ANYREGFLAG]
> +#define	MR_ordregdebug		MR_debugflag[MR_ORDINARY_REG_FLAG]
> +#define	MR_anyregdebug		MR_debugflag[MR_ANY_REG_FLAG]
>  #define	MR_detaildebug		MR_debugflag[MR_DETAILFLAG]
>  
>  	/* 
> --- ws86.basis//runtime/mercury_wrapper.c	Mon Aug 12 18:12:12 2002
> +++ ws86/runtime/mercury_wrapper.c	Wed Aug 14 14:03:54 2002
> @@ -106,9 +106,48 @@
>  /* use readline() in the debugger even if the input stream is not a tty */
>  MR_bool		MR_force_readline = MR_FALSE;
>  
> -/* other options */
> +/*
> +** Low level debugging options.
> +**
> +** If MR_watch_addr is not NULL, then the some of the low level debugging
> +** messages will print the value it points to.
> +**
> +** If MR_watch_csd_addr is not NULL, then the some of the low level debugging
> +** messages will print the MR_CallSiteDynamic structure it points to. Since
> +** this structure is typically in memory that not part of the address space of
> +** the program at started, this printing will be inhibited until

s/started/start-up/ ?

> +** space. Therefore we inhibit these messages unless any one three conditions
> +** apply.

s/one three/one of three/ ?

> +** We implement this by making MR_lld_print_enabled, which controls
> +** the printing of these messages, the sum of MR_lld_print_name_enabled,
> +** MR_lld_print_csd_enabled and MR_lld_print_region_enabled, which are flags
> +** implementing the three conditions. (While these four flags could be
> +** booleans, that would make the cost of recomputing MR_lld_print_enabled
> +** substantially higher than out current method of simply adding the integer
> +** values of the three component flags.)

Hmm.  Why is "or" more expensive than integer addition?
Note that using | rather than || would be fine, e.g.

	MR_bool x, y, z;
	...
	z = x | y;

> +++ ws86/tools/lmc	Wed Aug 14 14:22:05 2002
> @@ -22,6 +22,15 @@
...
> +# You can ask for additional C flags to compile with by setting the environment
> +# variable MMC_ADDED_CFLAGS to those flags. Setting up this environment
> +# variable one can be more convenient than repeatedbly supplying
> +"--cflag <flag>" arguments on the command line.

s/repeatedbly/repeatedly/

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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