diff --git a/doc/user_guide.texi b/doc/user_guide.texi index 8bda892cf..86b949dc0 100644 --- a/doc/user_guide.texi +++ b/doc/user_guide.texi @@ -10774,6 +10774,8 @@ Note that the address of the stack base should be word aligned as some garbage collectors rely upon this. (This is why the type of the dummy variable in the above example is @code{void *}.) +If the value of @var{stackbottom} is @code{NULL} then the collector will attempt +to determine the address of the base of the stack itself. Note that modifying the argument vector, @var{argv}, after the Mercury runtime has been initialised will result in undefined behaviour since the runtime maintains a reference into @var{argv}. diff --git a/util/mkinit.c b/util/mkinit.c index d071cbfdd..5a46199fe 100644 --- a/util/mkinit.c +++ b/util/mkinit.c @@ -2,7 +2,7 @@ ** vim:sw=4 ts=4 expandtab */ /* -** Copyright (C) 1995-2008, 2010-2011 The University of Melbourne. +** Copyright (C) 1995-2008, 2010-2012 The University of Melbourne. ** This file may only be copied under the terms of the GNU General ** Public License - see the file COPYING in the Mercury distribution. */ @@ -380,11 +380,16 @@ static const char mercury_funcs1[] = " ** GC knows where it starts. This is necessary for AIX 4.1\n" " ** on RS/6000, and for gnu-win32 on Windows 95 or NT.\n" " ** It may also be helpful on other systems.\n" + " ** For the Boehm GC, if the stackbottom argument is NULL then\n" + " ** do not explicitly register the bottom of the stack, but\n" + " ** let the collector determine an appropriate value itself.\n" " */\n" " #if defined(MR_HGC)\n" " MR_hgc_set_stack_bot(stackbottom);\n" " #elif defined(MR_BOEHM_GC)\n" - " GC_stackbottom = stackbottom;\n" + " if (stackbottom != NULL) {\n" + " GC_stackbottom = stackbottom;\n" + " }\n" " #endif\n" "#endif\n" "\n"