-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Store pinned static fields in the Pinned Object Heap. #89895
Conversation
Now that we don't pin `FixedAddressValueType` fields, this mechanism is unused.
We remove the check that blocked it, enable a test and update a design document.
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov Issue DetailsThis PR allocates fields marked with Because we don't use a pinned handle to pin the fields anymore, the object is not permanently held in memory, which enables unloadability for assemblies with pinned static fields. All we have to do is remove the check that blocked these assemblies, and unmark the relevant unit test as incompatible with unloadability. I also removed a now-unused tracking mechanism for thread-static pinned fields. Fixes #66043
|
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.
LGTM, thank you!
@teo-tsirpanis you'll also need to remove the library negative test for the FixedAddressValueType attribute and unloadability - it is causing the CI failures. |
Worth noting is that this will unload the assembly when the user uses |
86c75a7
to
ba19e2c
Compare
ba19e2c
to
921f45f
Compare
@teo-tsirpanis, could you please rebase the PR and then we could run the CI again to get it merged? Thanks |
@mangod9 done. CI is green. |
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.
Thank you!
This PR allocates fields marked with
[FixedAddressValueType]
to the Pinned Object Heap. We introduce a new overload ofAllocateObject
that accepts aGC_ALLOC_FLAGS
, and when allocating the static fields we passGC_ALLOC_PINNED_OBJECT_HEAP
if the field has that attribute.Because we don't use a pinned handle to pin the fields anymore, the object is not permanently held in memory, which enables unloadability for assemblies with pinned static fields. All we have to do is remove the check that blocked these assemblies, and unmark the relevant unit test as incompatible with unloadability. I also removed a now-unused tracking mechanism for thread-static pinned fields.
Fixes #66043