Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix issue where we didn't clear cards at the ends of regions.
The problem is that when we reach the end of a region during card marking, we clear the cards between card and card_of (end). If card_of (end) is equal to card, we end up clearing nothing at all.
A similar problem occurs when cards happen to be set between end and the end of the reserved memory of the region - these cards would never be cleared.
Both issues don't affect correctness, but they do affect performance for regions with very few cross generation pointers.
The fix is very simple - end_card already contains the first clear card after the current run of cards, so [card, end_card[ is exactly the correct range to pass to clear_cards.