Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

[WIP] Uses memcpy in CustomAttributeParser to avoid SIGBUS in ARM #6403

Closed
wants to merge 1 commit into from

Conversation

parjong
Copy link

@parjong parjong commented Jul 22, 2016

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.

@parjong
Copy link
Author

parjong commented Jul 22, 2016

@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:

FAILED   - [ 2935 :   84 sec ] GC/Features/HeapExpansion/bestfit-finalize/bestfit-finalize.sh
FAILED   - [ 2985 :    5 sec ] GC/Regressions/v2.0-beta2/460373/460373/460373.sh
FAILED   - [ 2988 :  227 sec ] GC/Regressions/v2.0-rtm/494226/494226/494226.sh

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);
Copy link
Member

@jkotas jkotas Jul 22, 2016

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.

Copy link
Author

@parjong parjong Jul 22, 2016

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?

Copy link
Member

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.

Copy link
Author

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.

Copy link
Member

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.

Copy link
Author

Choose a reason for hiding this comment

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

@jkotas @janvorli Thanks for comments. I finally figured out what I misunderstood. I though that ARM requires 4-byte alignment even for byte access, but it isn't. As reported in #6378, this issue seems to be closely related with @leemgs issue.

@jkotas
Copy link
Member

jkotas commented Jul 22, 2016

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.

@leemgs
Copy link

leemgs commented Jul 22, 2016

@leemgs Please take a look. Is there any chance that your recent PR(s) to enable O3 in ARM/Linux resolves this issue?

@parjong , Yes. Please refer to the report that I shared to fix unit-test failures of CoreCLR previously.

@parjong
Copy link
Author

parjong commented Jul 26, 2016

I'll close this PR as PR #6379 resolves #6378, too.

@parjong parjong closed this Jul 26, 2016
@parjong parjong deleted the wip/corefx_debugging branch July 26, 2016 06:07
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.

5 participants