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

fix an interaction between the new pinned_object_block policy and

globalisation.
parent faf62056
......@@ -217,7 +217,20 @@ globalise_large (StgPtr p)
ACQUIRE_SPIN_LOCK(&gen->sync);
// remove from large_object list
// the object we need to globalise might be in the
// pinned_object_block, which is still being allocated into. In
// that case, we just mark the pinned_object_block with the global
// generation, and allocatePinned() will attach the block to the
// correct gen->large_objects list when it is full.
if (bd == gct->cap->pinned_object_block) {
new_gen = &all_generations[global_gen_ix];
initBdescr(bd, new_gen, new_gen->to);
RELEASE_SPIN_LOCK(&gen->sync);
return;
}
// remove from large_object list
if (bd->u.back) {
bd->u.back->link = bd->link;
} else { // first object in the list
......
......@@ -778,16 +778,20 @@ allocatePinned (Capability *cap, lnat n)
// the next GC the BF_EVACUATED flag will be cleared, and the
// block will be promoted as usual (if anything in it is
// live).
ACQUIRE_SM_LOCK;
gen = cap->r.rG0; // use our local G0
if (bd != NULL) {
gen = bd->gen;
// attach it to the correct generation - the block might
// have been globalised by now (see globalise_large()).
if (gen->no != 0) { ACQUIRE_SPIN_LOCK(&gen->sync); }
dbl_link_onto(bd, &gen->large_objects);
gen->n_large_blocks++;
g0->n_new_large_words += bd->free - bd->start;
gen->n_new_large_words += bd->free - bd->start;
if (gen->no != 0) { RELEASE_SPIN_LOCK(&gen->sync); }
}
ACQUIRE_SM_LOCK;
cap->pinned_object_block = bd = allocBlock();
RELEASE_SM_LOCK;
initBdescr(bd, gen, gen);
initBdescr(bd, cap->r.rG0, cap->r.rG0); // use our local G0
bd->flags = BF_PINNED | BF_LARGE | BF_EVACUATED;
bd->free = bd->start;
}
......
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