[m-rev.] diff: fix bug 126

Peter Wang novalazy at gmail.com
Mon Jan 25 17:08:25 AEDT 2010


Branches: main

Fix bug #126.  The runtime could not be built in a stack segments grade when
mprotect() is unavailable.

runtime/mercury_stacks.c:
        Don't refer to the `MR_zone_redzone' field directly as it may not be
        defined.  Use the `MR_zone_end' macro instead.

diff --git a/runtime/mercury_stacks.c b/runtime/mercury_stacks.c
index 897feb6..5180c5e 100644
--- a/runtime/mercury_stacks.c
+++ b/runtime/mercury_stacks.c
@@ -316,6 +316,7 @@ MR_rewind_nondetstack_segments(MR_Word *maxfr)
 {
     MR_MemoryZone   *reusable_zone;
     MR_MemoryZone   *zone;
+    MR_Word         *limit;
     MR_MemoryZones  *list;
 
     reusable_zone = NULL;
@@ -324,11 +325,10 @@ MR_rewind_nondetstack_segments(MR_Word *maxfr)
         zone = MR_CONTEXT(MR_ctxt_nondetstack_zone);
         /*
         ** XXX why is maxfr sometimes slightly past MR_zone_extend_threshold?
-        ** That's why we test against MR_zone_redzone.
+        ** That's why we test against MR_zone_end instead.
         */
-        if (maxfr >= zone->MR_zone_min &&
-            maxfr < (MR_Word *) zone->MR_zone_redzone)
-        {
+        limit = (MR_Word *) zone->MR_zone_end;
+        if (maxfr >= zone->MR_zone_min && maxfr < limit) {
             break;
         }
 

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