-
Notifications
You must be signed in to change notification settings - Fork 5.1k
[mono][gc] Fix gc descriptor computation for InlineArray structs #116879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the GC descriptor computation for InlineArray structs in Mono by correcting the offset calculation logic.
- Introduces a new variable (field_size) to capture the size of an element for InlineArray types.
- Updates the iteration loop to increment the offset using field_size instead of the previously used field_offset.
Comments suppressed due to low confidence (1)
src/mono/mono/metadata/object.c:980
- If the struct is not an InlineArray, field_size remains 0 causing no offset update. Consider adding an else clause to set field_size to field_offset for non-InlineArray cases, ensuring correct offset computation.
field_instance_offset += field_size;
Tagging subscribers to this area: @BrzVlad |
/backport to release/9.0-staging |
Started backporting to release/9.0-staging: https://github.com/dotnet/runtime/actions/runs/15832129926 |
@BrzVlad backporting to "release/9.0-staging" failed, the patch most likely resulted in conflicts: $ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: [mono][gc] Fix gc descriptor computation for InlineArray structs
Using index info to reconstruct a base tree...
M src/mono/mono/metadata/object.c
Falling back to patching base and 3-way merge...
Auto-merging src/mono/mono/metadata/object.c
CONFLICT (content): Merge conflict in src/mono/mono/metadata/object.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 [mono][gc] Fix gc descriptor computation for InlineArray structs
Error: The process '/usr/bin/git' failed with exit code 128 Please backport manually! |
compute_class_bitmap
iterates over all ref field slots in the current class so we can produce a GC descriptor.field_iter
represents how many times the type in question is repeated in the current struct. Instead of bumping the current offset by the size of the repeated field, for each iteration, we were addingfield_offset
which is wrong.Fixes Humanizr/Humanizer#1572