- /* allocate all the steps into an array. It is important that we do
- it this way, because we need the invariant that two step pointers
- can be directly compared to see which is the oldest.
- Remember that the last generation has only one step. */
- total_steps = 1 + (RtsFlags.GcFlags.generations - 1) * RtsFlags.GcFlags.steps;
- all_steps = stgMallocBytes(total_steps * sizeof(struct step_),
- "initStorage: steps");
-
- /* Allocate step structures in each generation */
- if (RtsFlags.GcFlags.generations > 1) {
- /* Only for multiple-generations */
-
- /* Oldest generation: one step */
- oldest_gen->n_steps = 1;
- oldest_gen->steps = all_steps + (RtsFlags.GcFlags.generations - 1)
- * RtsFlags.GcFlags.steps;
-
- /* set up all except the oldest generation with 2 steps */
- for(g = 0; g < RtsFlags.GcFlags.generations-1; g++) {
- generations[g].n_steps = RtsFlags.GcFlags.steps;
- generations[g].steps = all_steps + g * RtsFlags.GcFlags.steps;
- }
-
- } else {
- /* single generation, i.e. a two-space collector */
- g0->n_steps = 1;
- g0->steps = all_steps;
- }
-
- nurseries = stgMallocBytes (n_capabilities * sizeof(struct step_),
- "initStorage: nurseries");
-
- /* Initialise all steps */
- for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
- for (s = 0; s < generations[g].n_steps; s++) {
- initStep(&generations[g].steps[s], g, s);
- }
- }
-
- for (s = 0; s < n_capabilities; s++) {
- initStep(&nurseries[s], 0, s);
- }