[mono][sgen] Fix card scanning in LOS non-array objects#125116
Open
BrzVlad wants to merge 1 commit intodotnet:mainfrom
Open
[mono][sgen] Fix card scanning in LOS non-array objects#125116BrzVlad wants to merge 1 commit intodotnet:mainfrom
BrzVlad wants to merge 1 commit intodotnet:mainfrom
Conversation
`sgen_card_table_region_begin_scanning` needs to determine whether any cards are marked in the object starting at `start` address. The current card size in 512 bytes. Consider an object with start 500 and size 20, so this object lives within 2 cards. We will check the card associated with the address 500. Once this iteration is done, we will check whether `start + card_size < end` => `500 + 512 < 520`. This is false, so we will no longer scan the second card. The algorithm was expecting the start address to be aligned to the card start, which is what the fix does. This bug is severe, but, in practice, this code path is not as frequent. This bug would only affect objects greater than 8k, that are not arrays.
Contributor
|
Tagging subscribers to this area: @BrzVlad |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes SGen card-table scanning for large (LOS) non-array objects when the object start address is not aligned to a card boundary, ensuring all cards that overlap the object are checked for marks before deciding whether to scan the object.
Changes:
- Align the
startaddress down to the containing card boundary insgen_card_table_region_begin_scanning(overlapping-cards configuration). - Ensures multi-card objects that begin mid-card do not skip subsequent cards during the per-card iteration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
sgen_card_table_region_begin_scanningneeds to determine whether any cards are marked in the object starting atstartaddress. The current card size in 512 bytes. Consider an object with start 500 and size 20, so this object lives within 2 cards. We will check the card associated with the address 500. Once this iteration is done, we will check whetherstart + card_size < end=>500 + 512 < 520. This is false, so we will no longer scan the second card. The algorithm was expecting the start address to be aligned to the card start, which is what the fix does.This bug is severe, but, in practice, this code path is not as frequent. This bug would only affect objects greater than 8k, that are not arrays.
Fixes #124941