[release/6.0][mono][jit] Don't memset memory in increments lower than word size#74351
Merged
carlossanlop merged 1 commit intodotnet:release/6.0from Sep 7, 2022
Merged
Conversation
…otnet#73480) If we memset a vt containing references, then, in order for preemptive GC and concurrent GC to work, writing to reference slots must happen atomically, otherwise GC might encounter a garbage ref. Also speeds up memset by about 15% for smaller valuetypes hitting this path on 64bit. More for extra large valuetypes.
lambdageek
approved these changes
Aug 23, 2022
Member
|
Approved via email. Marking as servicing approved |
Contributor
|
The single CI failure was infra related (and the leg got stuck too): Approved and signed off. Can merge now. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
If we memset a vt containing references, then, in order for preemptive GC and concurrent GC to work, writing to reference slots must happen atomically, otherwise GC might encounter a garbage ref.
This was uncovered by crashes in CI in the System.Text.Json.Tests running on Mono(#58828)
Customer Impact
Infrequent crashes in the GC are possible on 64 bit targets where we use preemptive suspend or concurrent GC. (Desktop and mobile targets) without the fix.
Also speeds up memset by about 15% for smaller valuetypes hitting this path on 64bit. More for extra large valuetypes.
Testing
This was tested as part of our CI test suites on main for last 2 weeks without any detected failures. The changed code is hit very frequently, as part of clearing of medium sized / large valuetypes (initobj opcode).
Manual validation done prior to submission to main.
Risk
Low Risk. The change itself is very basic and it got tested over the last few weeks as part of our test suites.
Backport of #73480