[m-dev.] For review: Add arguments in collect

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Nov 4 10:56:58 AEDT 1999


On 03-Nov-1999, Erwan Jahier <Erwan.Jahier at irisa.fr> wrote:
> 
> This change implements the possibility to use procedure arguments within 
> collect:filter/4.
...
> Index: trace/mercury_trace_external.c
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_external.c,v
> retrieving revision 1.29
> diff -u -r1.29 mercury_trace_external.c
> --- mercury_trace_external.c	1999/11/03 14:41:40	1.29
> +++ mercury_trace_external.c	1999/11/03 18:04:27
> @@ -1438,13 +1462,28 @@
>  */
>  static void
>  MR_COLLECT_filter(void (*filter_ptr)(Integer, Integer, Integer, Word, Word, 
> -	String, String, String, Integer, Integer, Integer, String, Word, Word *,
> -        Char *), Unsigned seqno, Unsigned depth, MR_Trace_Port port, 
> +	String, String, String, Integer, Integer, Word, Integer, String, Word, 
> +	Word *, Char *), Unsigned seqno, Unsigned depth, MR_Trace_Port port, 
>  	const MR_Stack_Layout_Label *layout, const char *path, 
>  	bool *stop_collecting)
>  {
>  	Char	result;		
> +	Word	arguments;
>  
> +	/* 
> +	** Only pass the arguments list down filter
> +	** if required, i.e. if MR_collect_arguments
> +	** is set to TRUE. We need to do that in 
> +	** order to not penalize the performance 
> +	** of collect in the cases where the argument
> +	** list (which might be very big) is not used.
> +	** 
> +	*/
> +	if (MR_collect_arguments) {
> +		arguments = MR_trace_make_var_list();
> +	} else {
> +		arguments = MR_list_empty();
> +	}

The call to MR_list_empty() needs to be inside MR_TRACE_USE_HP().

> +%------------------------------------------------------------------------------%
> +
> +opium_parameter(
> +	name		: collect_arg,
> +	arg_list	: [YesOrNo],
> +	arg_type_list	: [member([yes, no])],
> +	parameter_type	: single,
> +	default		: [no],
> +	commands	: [collect],
> +	message		: 
> +"Parameter which tells whether it is possible to use arguments/1 within \
> +collect:filter/4. If you do not use arguments, it is better to set this \
> +parameter to `no' since when arguments are very big, it migth slow down \
> +the execution of collect a lot."
> +	).

s/migth/might/

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list