[m-dev.] diff: work-around for Alpha hlc.gc GC bug

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Nov 19 01:26:52 AEDT 2000


Estimated hours taken: 1

compiler/mercury_compile.m:
	Add a work-around for a bug in the Boehm collector that cause
	it to abort with "unexpected mark stack overflow" when
	bootstrapping in grade hlc.gc.  The work-around is to
	explicitly expand the heap at program start-up.  This is
	probably good for performance anyway.

Workspace: /home/mercury0/fjh/mercury
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.181
diff -u -d -r1.181 mercury_compile.m
--- compiler/mercury_compile.m	2000/10/14 04:00:12	1.181
+++ compiler/mercury_compile.m	2000/11/18 11:46:40
@@ -78,11 +78,33 @@
 %-----------------------------------------------------------------------------%
 
 main -->
+	gc_init,
 	handle_options(MaybeError, Args, Link),
 	main_2(MaybeError, Args, Link).
 
 %-----------------------------------------------------------------------------%
 
+:- pred gc_init(io__state::di, io__state::uo) is det.
+
+:- pragma c_code(gc_init(_IO0::di, _IO::uo), [will_not_call_mercury], "
+#ifdef CONSERVATIVE_GC
+	/*
+	** Explicitly force the initial heap size to be at least 2 Mb.
+	**
+	** This works around a bug in the Boehm collector (for versions up
+	** to at least 6.2) where the collector would sometimes abort with
+	** the message `unexpected mark stack overflow' (e.g. in grade hlc.gc
+	** on dec-alpha-osf3.2).
+	**
+	** Doing this should also improve performance slightly by avoiding
+	** frequent garbage collection during start-up.
+	*/
+	GC_expand_hp(2 * 1024 * 1024);
+#endif
+").
+
+%-----------------------------------------------------------------------------%
+
 :- pred main_2(maybe(string), list(string), bool, io__state, io__state).
 :- mode main_2(in, in, in, di, uo) is det.
 

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