-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Support Linux on z as a Swift platform #2541
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
This change needs to go through the Swift evolution process. We can unblock the port by adding it as |
@@ -81,6 +81,12 @@ public struct _stdlib_fd_set { | |||
} | |||
} | |||
|
|||
#if arch(arm) || arch(i386) | |||
public typealias _stdlib_fd_set = __stdlib_fd_set<UInt32> | |||
#else |
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.
Please list 64-bit platforms explicitly. This ensures that this code breaks when we have a new port, and it is added to the appropriate list.
CC @rjmccall @slavapestov for IRGen and runtime changes. The library parts and test changes LGTM. |
@bryanpkc This is fantastic! I'm just curious -- what are the failing tests? |
Let's run CI to verify that there are no regressions on existing platforms. @swift-ci Please test |
@bryanpkc Looks like there are test failures on OS X, please take a look. |
@gribozavr Thanks for your review. I have made changes according to your suggestions and fixed the test failure on OS X. |
@swift-ci Please test |
@bryanpkc OS X failed again. |
@gribozavr thank you for the extensive review, I really appreciate it. @bryanpkc please do submit a proposal for adding the endian #if check. I expect it to be mostly a bike shedding exercise, but it is an important one to do and get past. |
@gribozavr I think I have fixed the OS X test case for real this time (sorry I cannot run that test myself). I have also simplified the StringUTF8 fix as you suggested. It also helps us pass a few more test cases. @lattner, @rintaro: Thanks for the link to the draft proposal. It seems that the bitwidth() part of the proposal is more complicated and warrants more discussion, but I can submit the endian() part of it, if @sadun doesn't mind. |
@@ -48,8 +48,10 @@ extension _StringCore { | |||
src: UnsafeMutablePointer(startASCII + i), | |||
size: numericCast(utf16Count)) | |||
|
|||
return (i + utf16Count, result) | |||
// Convert the _UTF8Chunk into host endianness. | |||
return (i + utf16Count, _UTF8Chunk(littleEndian: result)) |
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.
I think, we have another endianness problem in _StringCore._nthContiguous(_:)
.
Sorry, I cannot test myself.
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.
@rintaro You are right about _nthContiguous()
being little-endian only but that is only part of a larger problem. There does not seem to be any support for UTF-16BE in Swift, and supporting it may require considerable changes to the _StringCore code. I am pretty sure that conversion from UTF-8 to UTF-16 is currently broken in this port, but we hope to tackle that in a future pull request (soonish).
@swift-ci Please test OS X platform |
1 similar comment
@swift-ci Please test OS X platform |
@swift-ci Please test |
The CI failed for unrelated reasons. Ping @rjmccall @slavapestov for IRGen and runtime changes. |
…is used to ensure correct operations of C++ code in the runtime. This patch also includes some (incomplete) changes to enum handling to make enums work in most common cases.
…hunk is in host endianness, for correct operations on both little- and big-endian systems.
…and must be loaded with a 16-bit load instruction for correctness on big-endian systems.
…ks correctly for 64-bit big-endian systems.
I have rebased the commits on to the tip of master, and added a couple more fixes for test failures. |
@slavapestov has reviewed the changes. |
@swift-ci Please test and merge |
@gribozavr Thanks for testing. The TestNSJSONSerialization failure does not seem related to my commits. |
Yes, it isn't. |
Thanks for merging. |
Resolve conflicts with the `main` branch
What's in this pull request?
This pull request adds support for Linux on IBM z Systems to Swift. It depends on pull requests in the other repos:
apple/swift-clang#13
apple/swift-llvm#8
apple/swift-lldb#27
The first commit in this pull request adds a new platform condition check named
endian()
, for which there are two possible values (little
andbig
), to allow conditional compilation of endianness-specific Swift code. The second commit constitutes the bulk of infrastructure changes, including new test cases, to add support for the new target. The remaining commits deal with endianness issues in various parts of the compiler and Swift runtime. In particular, handling of enums is not yet completely fixed for big-endian systems, and we are researching a full solution (to be contributed in a future pull request). Nevertheless, the port gives us a usable compiler and REPL. Validation test results show a 0.2% failure rate:No regression is observed on x86_64.
Before merging this pull request to apple/swift repository:
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
Validation Testing
Note: Only members of the Apple organization can trigger swift-ci.