-
Notifications
You must be signed in to change notification settings - Fork 2.6k
[WIP] Uses memcpy in CustomAttributeParser to avoid SIGBUS in ARM #6403
Conversation
@jkotas Could you let me know if there is any document related with LIMITED_METHOD_CONTRACT and WRAPPER_NO_CONTRACT? I encountered some GC failuire after applying this PR:
If there is any document, it would be very helpful. @leemgs Please take a look. Is there any chance that your recent PR(s) to enable O3 in ARM/Linux resolves this issue? CC @lemmaa |
signed __int16 GetI2() | ||
{ | ||
LIMITED_METHOD_CONTRACT; | ||
signed __int16 tmp = GET_UNALIGNED_VAL16(m_pbCur); |
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.
GET_UNALIGNED_VALXXX
is meant to be used for reads of unaligned values. If it does not work on Linux ARM, the fix should be make in GET_UNALIGNED_VALXXX
, not by removing calls to it.
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.
Thanks for your comment. I'll revise this PR per comment.
The code at line 35 and 42 (which directly access each byte) may cause this issue, but it seems that GET_UNALIGNED_VAL8 is missing currently. Is it intended?
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.
Accessing byte cannot be ever unaligned.
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.
If GetU1
is called twice, m_pbCur
will have an unaligned address, and thus I though that directly reading that region cause unaligned access. Please let me know if there is something that I misunderstood.
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.
Unaligned access means that it accesses address that is not aligned to the size of the data you are accessing. That's why byte access cannot ever be unaligned, as @jkotas has said.
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.
The contracts are documented in https://github.com/dotnet/coreclr/blob/master/Documentation/coding-guidelines/clr-code-guide.md, but I think that the failures you are seeing are not related to contracts. |
@parjong , Yes. Please refer to the report that I shared to fix unit-test failures of CoreCLR previously.
|
I'll close this PR as PR #6379 resolves #6378, too. |
This commit attempts to replace explicit assignment in CustomAttributeParser with memcpy to avoid SIGBUS during loading xunit testcases (discussed in #6378)
This PR is under testing. Please do NOT merge this.