[m-rev.] for review: minor extension to stand-alone interfaces
Julien Fischer
juliensf at csse.unimelb.edu.au
Wed Jan 4 01:53:28 AEDT 2012
Branches: main
Make it possible to initialise the Mercury runtime using an external interface
without providing the address of the base of the stack.
This should work on most systems and can be useful when the top-level of a
program is not written in C or C++.
(In principle, this probably always worked, so the main change here is to
document it.)
util/mkinit.c:
If mercury_init's stackbottom argument is NULL then don't
set GC_stackbottom.
doc/user_guide.texi:
Extend the description of the mercury_init function in the
stand-alone interfaces section to include the above.
Julien.
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.645
diff -u -r1.645 user_guide.texi
--- doc/user_guide.texi 2 Jan 2012 15:40:55 -0000 1.645
+++ doc/user_guide.texi 3 Jan 2012 14:31:34 -0000
@@ -10774,6 +10774,8 @@
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}.
Index: util/mkinit.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/util/mkinit.c,v
retrieving revision 1.128
diff -u -r1.128 mkinit.c
--- util/mkinit.c 17 Dec 2011 04:11:04 -0000 1.128
+++ util/mkinit.c 3 Jan 2012 14:19:36 -0000
@@ -380,11 +380,16 @@
" ** 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"
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list