Skip to content

[mono][interp] Fix resizing of ref slots bitset #100907

Merged
BrzVlad merged 2 commits intodotnet:mainfrom
BrzVlad:fix-interp-ref-slots-ovf
Apr 11, 2024
Merged

[mono][interp] Fix resizing of ref slots bitset #100907
BrzVlad merged 2 commits intodotnet:mainfrom
BrzVlad:fix-interp-ref-slots-ovf

Conversation

@BrzVlad
Copy link
Member

@BrzVlad BrzVlad commented Apr 11, 2024

In rare cases it can happen that doubling the capacity won't fit all ref slots for the var, in case it is a large VT.

Should fix #100757

BrzVlad added 2 commits April 11, 2024 13:25
In rare cases it can happen that doubling the capacity won't fit all ref slots for the var, in case it is a large VT.
Since it is not a hot path anyway.
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @BrzVlad, @kotlarmilos
See info in area-owners.md if you want to be subscribed.

guint32 old_size = td->ref_slots ? (guint32)td->ref_slots->size : 0;
guint32 new_size = old_size ? old_size * 2 : 32;
while (new_size <= max_index)
new_size *= 2;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it matter if it allocates new_size > max_index? Should it go up to max_index instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might produce further reallocation, but it is also valid. I don't think it matters much

@BrzVlad BrzVlad merged commit 93010da into dotnet:main Apr 11, 2024
@maraf
Copy link
Member

maraf commented Apr 12, 2024

matouskozak pushed a commit to matouskozak/runtime that referenced this pull request Apr 30, 2024
* [mono][interp] Fix resizing of ref slots bitset

In rare cases it can happen that doubling the capacity won't fit all ref slots for the var, in case it is a large VT.

* [mono][interp] Use asserting version of bitset set

Since it is not a hot path anyway.
@github-actions github-actions bot locked and limited conversation to collaborators May 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[wasm] Methodical_d2 test failure

3 participants

Comments