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

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Aug 1 19:42:36 AEST 2002


On 01-Aug-2002, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> > +++ 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'?

I wanted to avoid bootstrapping difficulties for people
still using old versions of the `mgnuc' script that only
define MR_CONSERVATIVE_GC.

Actually on second thoughs I think there shouldn't be any such problems,
since the code in runtime/mercury_conf_param.h should set MR_BOEHM_GC
in that case.  Provided runtime/mercury_conf_param.h is included here,
that is, but I'm pretty sure it should be.  So I guess I was being overly
paranoid about that.  Maybe I wrote this code before I decided to put the
code in runtime/mercury_conf_param.h to set MR_BOEHM_GC.

I'll change it.

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

OK.

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

OK.

> What is the FIXME for?

It had a purpose, once.  But now it's just there to remind me to change
the comment on that line to be the same as the one two lines below ;-)

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