[m-rev.] for review: add support for MPS GC

Simon Taylor stayl at cs.mu.OZ.AU
Thu Aug 1 16:47:28 AEST 2002


On 31-Jul-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 31-Jul-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > Add support for interfacing Mercury with the MPS garbage collector.

> This is part 3 of 3.

> Index: compiler/mercury_compile.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
> retrieving revision 1.262
> diff -u -d -r1.262 mercury_compile.m
> --- compiler/mercury_compile.m	24 Jul 2002 16:05:08 -0000	1.262
> +++ compiler/mercury_compile.m	30 Jul 2002 12:14:05 -0000
> @@ -171,6 +171,7 @@
>  	[will_not_call_mercury, promise_pure, tabled_for_io],
>  "
>  #ifdef MR_CONSERVATIVE_GC
> +  #ifndef MR_MPS_GC /* i.e. MR_BOEHM_GC */
>  	/*
>  	** Explicitly force the initial heap size to be at least 4 Mb.
>  	**
> @@ -183,6 +184,7 @@
>  	** frequent garbage collection during start-up.
>  	*/
>  	GC_expand_hp(4 * 1024 * 1024);
> +  #endif
>  #endif

Why not just `#ifdef MR_BOEHM_GC'?

> Index: library/benchmarking.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/library/benchmarking.m,v
> retrieving revision 1.50
> diff -u -d -r1.50 benchmarking.m
> --- library/benchmarking.m	14 Jun 2002 10:18:45 -0000	1.50
> +++ library/benchmarking.m	30 Jul 2002 23:56:34 -0000
> @@ -220,6 +220,20 @@
>  	*/
>  
>  #ifdef MR_CONSERVATIVE_GC
> +  #ifdef MR_MPS_GC
> +  	{
> +		size_t committed, spare;
> +
> +		committed = mps_arena_committed(mercury_mps_arena);
> +		spare = mps_arena_spare_committed(mercury_mps_arena);
> +
> +		fprintf(stderr, 
> +			""\\nHeap in use: %.3fk, spare: %.3fk, total: %.3fk"",
> +			(committed - spare) / 1024.0,
> +			spare / 1024.0,
> +			committed / 1024.0);
> +	}
> +  #else /* MR_BOEHM_GC */
>  	fprintf(stderr, 
>  		""\\n#GCs: %lu, ""
>  		""Heap used since last GC: %.3fk, Total used: %.3fk"",
> @@ -227,7 +241,8 @@
>  		GC_get_bytes_since_gc() / 1024.0,
>  		GC_get_heap_size() / 1024.0
>  	);
> -#else
> +  #endif
> +#else /* !MR_CONSERVATIVE_GC */

This would be better written as

   #ifdef MR_MPS_GC
   ...
   #endif
   #ifdef MR_BOEHM_GC
   ...
   #endif

> Index: runtime/mercury_init.h
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/runtime/mercury_init.h,v
> retrieving revision 1.38
> diff -u -d -r1.38 mercury_init.h
> --- runtime/mercury_init.h	24 Jul 2002 16:05:13 -0000	1.38
> +++ runtime/mercury_init.h	30 Jul 2002 05:22:01 -0000
> @@ -88,7 +88,11 @@
>  #include "mercury_type_info.h"	/* for MR_TypeCtorInfo_Struct */
>  
>  #ifdef MR_CONSERVATIVE_GC
> -  #include "gc.h"
> +  #ifdef MR_MPS_GC
> +    #include "mercury_mps.h"	/* XXX FIXME */
> +  #else /* MR_BOEHM_GC */
> +    #include "gc.h"		/* for GC_INIT(), GC_stack_bottom */
> +  #endif
>  #endif

Same again here.

What is the FIXME for?

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