More clarity on CurrentAlloc docs.
authorEdward Z. Yang <ezyang@mit.edu>
Mon, 7 Oct 2013 04:31:52 +0000 (21:31 -0700)
committerEdward Z. Yang <ezyang@mit.edu>
Mon, 7 Oct 2013 04:31:52 +0000 (21:31 -0700)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
rts/sm/Storage.c

index db834e6..d419714 100644 (file)
@@ -706,6 +706,28 @@ allocate (Capability *cap, W_ n)
             // we have a block in the nursery: take it and put
             // it at the *front* of the nursery list, and use it
             // to allocate() from.
+            //
+            // Previously the nursery looked like this:
+            //
+            //           CurrentNursery
+            //                  /
+            //                +-+    +-+
+            // nursery -> ... |A| -> |B| -> ...
+            //                +-+    +-+
+            //
+            // After doing this, it looks like this:
+            //
+            //                      CurrentNursery
+            //                            /
+            //            +-+           +-+
+            // nursery -> |B| -> ... -> |A| -> ...
+            //            +-+           +-+
+            //             \
+            //              CurrentAlloc
+            //
+            // The point is to get the block out of the way of the
+            // advancing CurrentNursery pointer, while keeping it
+            // on the nursery list so we don't lose track of it.
             cap->r.rCurrentNursery->link = bd->link;
             if (bd->link != NULL) {
                 bd->link->u.back = cap->r.rCurrentNursery;