Skip to content

Commit

Permalink
Remove redundant if statement in try_move
Browse files Browse the repository at this point in the history
The if statement is redundant since if `index == 0` then
`BITS_BITLENGTH * index == 0`.
  • Loading branch information
peterzhu2118 committed Jan 25, 2022
1 parent e3b5cc8 commit b07879e
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4959,12 +4959,7 @@ try_move(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_page,
bits >>= NUM_IN_PAGE(p) % BITS_BITLENGTH;
if (try_move_plane(objspace, heap, sweep_page, (uintptr_t)p, bits, dest)) return 1;

if (index == 0) {
p = cursor->start + (BITS_BITLENGTH - NUM_IN_PAGE(cursor->start));
}
else {
p = cursor->start + (BITS_BITLENGTH - NUM_IN_PAGE(cursor->start)) + (BITS_BITLENGTH * index);
}
p = cursor->start + (BITS_BITLENGTH - NUM_IN_PAGE(cursor->start)) + (BITS_BITLENGTH * index);

/* Find an object to move and move it. Movable objects must be
* marked, so we iterate using the marking bitmap */
Expand Down

0 comments on commit b07879e

Please sign in to comment.