Skip to content

[Swift 3.0] Fix s390x Enum load/storeMultiPayloadValue #4463

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

Conversation

vivkong
Copy link
Contributor

@vivkong vivkong commented Aug 23, 2016

What's in this pull request?

This is the same fix as #4461 for the swift-3.0-branch.

Resolved bug number: (SR-)


Before merging this pull request to apple/swift repository:

  • Test pull request on Swift continuous integration.

Triggering Swift CI

The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:

Smoke Testing

Platform Comment
All supported platforms @swift-ci Please smoke test
All supported platforms @swift-ci Please smoke test and merge
OS X platform @swift-ci Please smoke test OS X platform
Linux platform @swift-ci Please smoke test Linux platform

A smoke test on macOS does the following:

  1. Builds the compiler incrementally.
  2. Builds the standard library only for macOS. Simulator standard libraries and
    device standard libraries are not built.
  3. lldb is not built.
  4. The test and validation-test targets are run only for macOS. The optimized
    version of these tests are not run.

A smoke test on Linux does the following:

  1. Builds the compiler incrementally.
  2. Builds the standard library incrementally.
  3. lldb is built incrementally.
  4. The swift test and validation-test targets are run. The optimized version of these
    tests are not run.
  5. lldb is tested.

Validation Testing

Platform Comment
All supported platforms @swift-ci Please test
All supported platforms @swift-ci Please test and merge
OS X platform @swift-ci Please test OS X platform
OS X platform @swift-ci Please benchmark
Linux platform @swift-ci Please test Linux platform

Lint Testing

Language Comment
Python @swift-ci Please Python lint

Note: Only members of the Apple organization can trigger swift-ci.

@slavapestov
Copy link
Contributor

@swift-ci Please test macOS

@slavapestov
Copy link
Contributor

Looks good, I'm assuming the tests pass on your platform :)

@slavapestov slavapestov self-assigned this Aug 24, 2016
@slavapestov
Copy link
Contributor

Actually, I don't think we can take this for the 3.0 branch.

@slavapestov
Copy link
Contributor

Is it OK if we just check in the fix to master and leave 3.0 branch as-is to lower risk? @tkremenek

// If the payload is larger than the value, zero out the rest.
if (layout.payloadSize > sizeof(payloadValue))
memset(bytes + sizeof(payloadValue), 0,
layout.payloadSize - sizeof(payloadValue));
#endif
Copy link
Member

Choose a reason for hiding this comment

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

The #endif is now after the code that would previously had been available when __BIG_ENDIAN__ is not defined. Is this change intended?

Copy link
Member

Choose a reason for hiding this comment

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

There is also clearly a behavioral change here, but no test case reflecting that. I don't accepting this change would be acceptable for the swift-3.0-branch in the current state without a test case. It's also not clear to me if the change is correct, per my comment about the preprocessor guard.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review.

The code from lines 365-368 are still available when __BIG_ENDIAN__ is not defined (as they are between #else and #endif). Nothing has changed for little endian platforms.

The Interpreter/enum.swift test was failing on s390x and is now passing with this change. We didn't observe any regression in other tests with this change.

@garyliu1, FYI

Choose a reason for hiding this comment

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

Further explaining the move of the #endif...

The new code between line 354-360 is the corresponding memset work required for big endian platforms. Therefore, the original memset code (which was common before) would need to be made specific for little endian platforms or else the big endian platform would perform another memset and corrupt the existing data.

Copy link
Member

Choose a reason for hiding this comment

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

You both are absolutely right. Sorry for misreading the code. This looks perfectly safe to take.

@tkremenek tkremenek merged commit d5d9d82 into swiftlang:swift-3.0-branch Aug 24, 2016
@vivkong vivkong deleted the swift-3.0-branch-s390x-enum branch July 11, 2017 19:06
kateinoigakukun added a commit that referenced this pull request Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants