[m-dev.] diff: minimal model tabling, part 1

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Apr 20 20:53:40 AEST 1999


On 20-Apr-1999, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> 
> --- ./compiler/options.m	Tue Apr 20 15:58:48 1999
> +++ /mnt/munkora/home/staff/zs/mer/ws4/compiler/options.m	Sat Apr 17 20:55:33 1999
> @@ -1785,6 +1785,8 @@
>  		"\tEnable the use of minimal model tabling.",
>  		"\tYou must compile the entire program with this option",
>  		"\tif any part of the program uses `:- pragma minimal_model'.",
> +		"\tAll the C code also needs to be compiled with the flag",
> +		"\t`-DMR_USE_MINIMAL_MODEL'.",

Since your change adds support for `--use-minimal-model' to mgnuc,
they should use that, rather than using `-D' options directly.
So you don't need the above comment about compiling with
`-DMR_USE_MINIMAL_MODEL'.  They just need to compile with
`mgnuc --use-minimal-model'.  The need to pass grade options
to mgnuc is currently not documented in the help message (though
it is documented in the user's guide), but it applies to all grade options.
So I suggest you delete those two lines that you added there,
and the two lines above them, and perhaps add something to
the start of the compilation model options help about
needing to pass all grade options to mgnuc as well as to ml.

mercury_tabling.c:
> -	saved_state->gen_sp = MR_gen_sp;
> +	saved_state->gen_next = MR_gen_next;
>  	saved_state->generator_stack_block = table_allocate_bytes(
> -			MR_gen_sp * sizeof(MR_GeneratorStackFrame));
> +			MR_gen_next * sizeof(MR_GeneratorStackFrame));
>  	table_copy_bytes(saved_state->generator_stack_block,
>  		(char *) MR_gen_stack,
> -		MR_gen_sp * sizeof(MR_GeneratorStackFrame));
> +		MR_gen_next * sizeof(MR_GeneratorStackFrame));
>  
> -	saved_state->cut_sp = MR_cut_sp;
> +	saved_state->cut_next = MR_cut_next;
>  	saved_state->cut_stack_block = table_allocate_bytes(
> -			(MR_cut_sp + 1) * sizeof(MR_CutStackFrame));
> +			MR_cut_next * sizeof(MR_CutStackFrame));
>  	table_copy_bytes(saved_state->cut_stack_block,
>  		(char *) MR_cut_stack,
> -		(MR_cut_sp + 1) * sizeof(MR_CutStackFrame));
> +		MR_cut_next * sizeof(MR_CutStackFrame));

That casts to `(char *)' here should be unnecessary now, I think.

> --- ./runtime/mercury_tabling.h	Tue Apr 20 15:59:21 1999
> +++ /mnt/munkora/home/staff/zs/mer/ws4/runtime/mercury_tabling.h	Sun Mar 21 20:44:30 1999
> @@ -410,7 +410,7 @@
>  		printf("pointing to: %p\n",				\
>  			*((MR_AnswerBlock) ABlock)))			\
>  	:								\
> -		0 /* do nothing */					\
> +		(void ) 0 /* do nothing */				\

s/void /void/

> +++ /mnt/munkora/home/staff/zs/mer/ws4/scripts/final_grade_options.sh-subr	Wed Apr 14 09:43:09 1999
> -case $stack_trace,$require_tracing in
> +case $use_trail,$use_minimal_model in
>  	true,true)
> +		echo "trailing and minimal model tabling are not compatible"
> +		exit 1 ;;

The error message should go to stderr:

	echo ... 1>&2

This relative diff didn't include any changes to the `tests',
but in my original review I made several suggestions about
your changes to the tests directory.

Apart from that, it looks fine now.  So if you're happy with
it, and you're keen to commit it soon, then I suggest you go ahead
and commit it without waiting for further review.  But please post
another relative diff of your final changes.

Cheers,
	Fergus.

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