Commit 069d309e authored by Kevin Modzelewski's avatar Kevin Modzelewski

Can optimize the initial branch away since we know we'll always execute the loop at least once

parent 2558ff26
......@@ -200,20 +200,19 @@ Heap::ThreadBlockCache::~ThreadBlockCache() {
static GCAllocation* allocFromBlock(Block* b) {
uint64_t mask = 0;
int elts_scanned = 0;
for (; b->next_to_check < BITFIELD_ELTS; b->next_to_check++) {
elts_scanned++;
while (true) {
mask = b->isfree[b->next_to_check];
if (mask != 0L) {
break;
}
}
int i = b->next_to_check;
if (i == BITFIELD_ELTS) {
b->next_to_check = 0;
return NULL;
b->next_to_check++;
if (b->next_to_check == BITFIELD_ELTS) {
b->next_to_check = 0;
return NULL;
}
}
int i = b->next_to_check;
int first = __builtin_ctzll(mask);
assert(first < 64);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment