Skip to content

Fix KeyPath failure on s390x #25467

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

Merged
merged 1 commit into from
Jul 1, 2019

Conversation

levivic
Copy link
Contributor

@levivic levivic commented Jun 14, 2019

This is to change the tuple metadata to use a 32-bit offset to address the failure seen in KeyPath test on big-endian platform (s390x). Details of the issue and discussion can be found at https://forums.swift.org/t/keypath-issue-with-s390x/24473

@levivic levivic force-pushed the s390x-keypath-tuple-fix branch 2 times, most recently from fadcbbe to a814994 Compare June 20, 2019 14:40
@levivic
Copy link
Contributor Author

levivic commented Jun 20, 2019

Hi, @jckarter, as we discussed in https://forums.swift.org/t/keypath-issue-with-s390x/24473, can you please review this PR? I have also got another related PR #25329 outstanding. Any feedback on that one will be appreciated as well.

@@ -1495,7 +1495,7 @@ struct TargetTupleTypeMetadata : public TargetMetadata<Runtime> {
ConstTargetMetadataPointer<Runtime, swift::TargetMetadata> Type;

/// The offset of the tuple element within the tuple.
StoredSize Offset;
uint32_t Offset;
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good! For ABI compatibility on Apple platforms, we'd want to conditionalize this, because existing binaries will try to load the full 64 bits, and we want to keep those zeroed:

#if __APPLE__
  StoredSize Offset;
#else
  uint32_t Offset;
#endif

I think the IRGen side is fine, though, because in practice nobody is going to have a 4GB tuple (they'll run into other practical limits first), and new binaries doing a 32-bit little-endian load of the 64-bit field should be safe, and would open the door to us possibly being able to drop this compatibility hack in time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jckarter Change made. Thanks.

@jckarter
Copy link
Contributor

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - a8149941f4fba5012c143e7dda07313b9ce9b3d5

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - a8149941f4fba5012c143e7dda07313b9ce9b3d5

@mundaym
Copy link
Contributor

mundaym commented Jun 28, 2019

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - c151d8bc320fc6a2c022d25285462ed3000d6b8b

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - c151d8bc320fc6a2c022d25285462ed3000d6b8b

@jckarter
Copy link
Contributor

Looks like a test needs to be updated:

/Users/buildnode/jenkins/workspace/swift-PR-osx/branch-master/swift/test/IRGen/generic_tuples.swift:12:11: error: CHECK: expected string not found in input
08:03:46 // CHECK: %swift.tuple_element_type = type { [[TYPE]]*, i64 }
08:03:46           ^
08:03:46 <stdin>:19:1: note: scanning from here
08:03:46 %swift.tuple_element_type = type { %swift.type*, i32 }
08:03:46 ^
08:03:46 <stdin>:19:1: note: with variable "TYPE" equal to "%swift.type"
08:03:46 %swift.tuple_element_type = type { %swift.type*, i32 }
08:03:46 ^

@levivic levivic force-pushed the s390x-keypath-tuple-fix branch from c151d8b to e08359c Compare June 28, 2019 19:02
@levivic
Copy link
Contributor Author

levivic commented Jun 28, 2019

@jckarter , yes, i have just updated the test.

@jckarter
Copy link
Contributor

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - c151d8bc320fc6a2c022d25285462ed3000d6b8b

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - c151d8bc320fc6a2c022d25285462ed3000d6b8b

@mundaym mundaym merged commit a8ea69e into swiftlang:master Jul 1, 2019
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