+static bdescr *
+allocNursery (step *stp, bdescr *tail, nat blocks)
+{
+ bdescr *bd;
+ nat i;
+
+ // Allocate a nursery: we allocate fresh blocks one at a time and
+ // cons them on to the front of the list, not forgetting to update
+ // the back pointer on the tail of the list to point to the new block.
+ for (i=0; i < blocks; i++) {
+ // @LDV profiling
+ /*
+ processNursery() in LdvProfile.c assumes that every block group in
+ the nursery contains only a single block. So, if a block group is
+ given multiple blocks, change processNursery() accordingly.
+ */
+ bd = allocBlock();
+ bd->link = tail;
+ // double-link the nursery: we might need to insert blocks
+ if (tail != NULL) {
+ tail->u.back = bd;
+ }
+ bd->step = stp;
+ bd->gen_no = 0;
+ bd->flags = 0;
+ bd->free = bd->start;
+ tail = bd;
+ }
+ tail->u.back = NULL;
+ return tail;
+}
+
+static void
+assignNurseriesToCapabilities (void)
+{