Skip to content
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

[mono][interp] Add missing GC wbarriers for static field stores with hotreload enabled #100775

Merged
merged 2 commits into from
May 11, 2024

Conversation

BrzVlad
Copy link
Member

@BrzVlad BrzVlad commented Apr 8, 2024

By default, static fields are stored in malloced memory that is registered and always scanned as roots. With hotreload, new static data is allocated inside newly created objects, so storing into it will require write barriers. In order to avoid slowing the normal execution, for fields from metadata updates, we will store into them via ldflda + stobj instead.

Fixes #100065

@BrzVlad
Copy link
Member Author

BrzVlad commented Apr 10, 2024

@srxqds If you could double check that this also fixed the issue, it would be great.

@srxqds
Copy link
Contributor

srxqds commented Apr 10, 2024

@srxqds If you could double check that this also fixed the issue, it would be great.

yeah, thank, lgtm

@srxqds
Copy link
Contributor

srxqds commented Apr 10, 2024

but hope you can fix MINT_STSFLD_O and MINT_STSFLD_VT opcode, when alc enable collctiable. Although it is not turned on now, it is still a precautionary measure.

@BrzVlad
Copy link
Member Author

BrzVlad commented Apr 10, 2024

@lambdageek How would this check look in order to handle also static data from collectible assemblies ?

@srxqds
Copy link
Contributor

srxqds commented Apr 10, 2024

when enable collectiable alc, the static variable will be reference in LoaderAlloc, the ref link will be : ALC -> LoaderAlloc -> Object[] -> static variable.

BrzVlad added 2 commits May 9, 2024 12:49
…treload

By default, static fields are stored in malloced memory that is registered and always scanned as roots. With hotreload, new static data is allocated inside newly created objects, so storing into it will require write barriers. In order to avoid slowing the normal execution, for fields from metadata updates, we will store into them via ldflda + stobj instead.
@BrzVlad BrzVlad force-pushed the fix-interp-hotreload-gc branch from af0d6eb to 9f16297 Compare May 9, 2024 09:50
@BrzVlad BrzVlad merged commit b997776 into dotnet:main May 11, 2024
79 checks passed
Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this pull request May 30, 2024
…hotreload enabled (dotnet#100775)

* [mono][interp] Add missing GC wbarriers for static field stores in hotreload

By default, static fields are stored in malloced memory that is registered and always scanned as roots. With hotreload, new static data is allocated inside newly created objects, so storing into it will require write barriers. In order to avoid slowing the normal execution, for fields from metadata updates, we will store into them via ldflda + stobj instead.

* [mono][interp] Add missing GC wbarriers for static field stores in collectible assemblies
@github-actions github-actions bot locked and limited conversation to collaborators Jun 11, 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.

mono gc not set static field back after object moved when enable interp mode
3 participants