Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

ARM64: Fix AllocFast large object size check #8292

Merged
merged 2 commits into from
Sep 1, 2020

Conversation

RalfKornmannEnvision
Copy link
Contributor

After allocation objects in the large object heap needs to be published for some cleanups related to the background gc. The constant value for this limit (RH_LARGE_OBJECT_SIZE) was not loaded correctly in the register. This caused that the upper 32 bits of the register were in an undefined state. Therefore the check for large objects did practically always fail and the objects were never published. Therefore the cleanup never happened and the background GC did fail.

After allocation objects in the large object heap needs to be published for some cleanups related to the background gc. The constant value for this limit (RH_LARGE_OBJECT_SIZE) was not loaded correctly in the register. This caused that the upper 32 bits of the register were in an undefined state. Therefore the check for large objects did practically always fail and the objects were never published. Therefore the cleanup never happened and the background GC did fail.
ARM64: Fix AllocFast large object size check
Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Thanks!

@jkotas jkotas merged commit d335c54 into dotnet:master Sep 1, 2020
@@ -81,7 +81,7 @@ RhpNewFast_RarePath

;; If the object is bigger than RH_LARGE_OBJECT_SIZE, we must publish it to the BGC
ldr w1, [x19, #OFFSETOF__EEType__m_uBaseSize]
movk x2, #(RH_LARGE_OBJECT_SIZE & 0xFFFF)
movz x2, #(RH_LARGE_OBJECT_SIZE & 0xFFFF)
Copy link
Member

Choose a reason for hiding this comment

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

Cc @AntonLapounov who tends to troubleshoot weird ARM bugs on .NET Native - we have this bug in ProjectNRel.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just a information for someone else. Nothing to do for me?

Copy link
Member

Choose a reason for hiding this comment

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

Yep - this code originates from .NET Native but there's no backflow of fixes from this repo to .NET Native so if we want to fix anything there, it needs to be done separately. It's good to be at least aware that an issue exists.

Copy link
Member

Choose a reason for hiding this comment

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

Nice catch. I guess in .NET Native RhpGcAlloc does not modify x2, which is why we have never hit this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants