[mono][gc] Fix gc descriptor computation for InlineArray structs#116879
Merged
BrzVlad merged 1 commit intodotnet:mainfrom Jun 23, 2025
Merged
[mono][gc] Fix gc descriptor computation for InlineArray structs#116879BrzVlad merged 1 commit intodotnet:mainfrom
BrzVlad merged 1 commit intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
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;
Contributor
|
Tagging subscribers to this area: @BrzVlad |
This was referenced Jun 20, 2025
kotlarmilos
approved these changes
Jun 23, 2025
Member
Author
|
/backport to release/9.0-staging |
Contributor
|
Started backporting to release/9.0-staging: https://github.com/dotnet/runtime/actions/runs/15832129926 |
Contributor
|
@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 128Please backport manually! |
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.
compute_class_bitmapiterates over all ref field slots in the current class so we can produce a GC descriptor.field_iterrepresents 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_offsetwhich is wrong.Fixes Humanizr/Humanizer#1572