Skip to content

Commit

Permalink
fix an interaction between the new pinned_object_block policy and
Browse files Browse the repository at this point in the history
globalisation.
  • Loading branch information
simonmar committed Jun 6, 2011
1 parent faf6205 commit ab5aad5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
15 changes: 14 additions & 1 deletion rts/sm/Globalise.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions rts/sm/Storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit ab5aad5

Please sign in to comment.