unsigned int n_old_blocks; // number of blocks in from-space
bdescr * todos; // blocks waiting to be scavenged
+ bdescr * todos_last;
unsigned int n_todos; // count of above
bdescr * scavenged_large_objects; // live large objs after GC (d-link)
// we don't have any to-be-scavenged blocks yet
stp->todos = NULL;
+ stp->todos_last = NULL;
stp->n_todos = 0;
// initialise the large object queues.
ACQUIRE_SPIN_LOCK(&stp->sync_todo);
if (stp->todos) {
bd = stp->todos;
+ if (stp->todos == stp->todos_last) {
+ stp->todos_last = NULL;
+ }
stp->todos = bd->link;
stp->n_todos--;
bd->link = NULL;
{
ASSERT(bd->link == NULL);
ACQUIRE_SPIN_LOCK(&stp->sync_todo);
- bd->link = stp->todos;
- stp->todos = bd;
+ if (stp->todos_last == NULL) {
+ stp->todos_last = bd;
+ stp->todos = bd;
+ } else {
+ stp->todos_last->link = bd;
+ stp->todos_last = bd;
+ }
stp->n_todos++;
trace(TRACE_gc, "step %d, n_todos: %d", stp->abs_no, stp->n_todos);
RELEASE_SPIN_LOCK(&stp->sync_todo);