Commit f25dc05e authored by Simon Marlow's avatar Simon Marlow
Browse files

Fix for a bug in setNumCapabilities

parent 011d6f96
...@@ -190,7 +190,7 @@ initStorage( void ) ...@@ -190,7 +190,7 @@ initStorage( void )
void storageAddCapabilities (nat from, nat to) void storageAddCapabilities (nat from, nat to)
{ {
nat n, g; nat n, g, i;
if (from > 0) { if (from > 0) {
nurseries = stgReallocBytes(nurseries, to * sizeof(struct nursery_), nurseries = stgReallocBytes(nurseries, to * sizeof(struct nursery_),
...@@ -200,6 +200,12 @@ void storageAddCapabilities (nat from, nat to) ...@@ -200,6 +200,12 @@ void storageAddCapabilities (nat from, nat to)
"storageAddCapabilities"); "storageAddCapabilities");
} }
// we've moved the nurseries, so we have to update the rNursery
// pointers from the Capabilities.
for (i = 0; i < to; i++) {
capabilities[i].r.rNursery = &nurseries[i];
}
/* The allocation area. Policy: keep the allocation area /* The allocation area. Policy: keep the allocation area
* small to begin with, even if we have a large suggested heap * small to begin with, even if we have a large suggested heap
* size. Reason: we're going to do a major collection first, and we * size. Reason: we're going to do a major collection first, and we
...@@ -463,8 +469,7 @@ assignNurseriesToCapabilities (nat from, nat to) ...@@ -463,8 +469,7 @@ assignNurseriesToCapabilities (nat from, nat to)
nat i; nat i;
for (i = from; i < to; i++) { for (i = from; i < to; i++) {
capabilities[i].r.rNursery = &nurseries[i]; capabilities[i].r.rCurrentNursery = nurseries[i].blocks;
capabilities[i].r.rCurrentNursery = nurseries[i].blocks;
capabilities[i].r.rCurrentAlloc = NULL; capabilities[i].r.rCurrentAlloc = NULL;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment