-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[String] Use a UTF-8 representation for native strings #20315
Conversation
This is a giant squashing of a lot of individual changes prototyping a switch of String in Swift 5 to be natively encoded as UTF-8. It includes what's necessary for a functional prototype, dropping some history, but still leaves plenty of history available for future commits. My apologies to anyone trying to do code archeology between this commit and the one prior. This was the lesser of evils.
Clean up some of the index assumptions, stick index-aware methods on _StringGuts, and otherwise migrate code over to UnicodeHelpers.swift.
* Refactor out RRC implementation into dedicated file. * Change our `_invariantCheck` pattern to generate efficient code in asserts builds and make the optimizer job's easier. * Drop a few Bidi shims we no longer need. * Restore View decls to String, workaround no longer needed * Cleaner unicode helper facilities
Breadcrumbs provide us amortized O(1) access to the UTF-16 view, which is vital for efficient Cocoa interoperability.
Add in our scalar-based fast-paths for UTF-8 and foreign strings, and update the grapheme cache.
Clean up some of the code surrounding the normalized code unit iterator.
swiftlang#19360) * Add consuming/owned annotations to Collection implementations * Update SILOptimizer tests * Fix access_marker_verify test * XFAIL reconstruct_type_from_mangled_name
Add inlinability annotations to restore performance parity with 4.2 String. Take advantage of known NFC as a fast-path for comparison, and overhaul comparison dispatch. RRC improvements and optmizations.
this is just to be compatible with the current transcoders and can be undone when the transcoders (based on ForwardParser/ReverseParser) are improved too.
Add benchmarks and tests for the normalized iterator
Refactor and rename _StringGutsSlice, apply NFC-aware fast paths to a new buffered iterator. Also, fix bug in _typeName which used to assume ASCIIness and better SIL optimizations on StringObject.
Replaces tests for constant-folding string concatenation with Swift-based ones, which are easier to maintain going forwards.
Also, disable normalization benchmarks and other changes until we merge, so we can compare with master 1-to-1.
Tweak and adjust code so that the SIL optimizer can constant-fold small strings from literals. Also some cleanup.
Looks like it started after: Git (clang) [CodeGen] Move |
@shahmishal I think I found the problem. Trying a revert here: apple/swift-clang#230. |
Please test with following PR: @swift-ci please test os x platform |
Please test with following PR: @swift-ci please test |
Build failed |
Please test with following PR: @swift-ci please test |
Build failed |
Please test with following PR: @swift-ci please test linux platform |
@swift-ci please test |
Please test with following PR: @swift-ci please test |
Build failed |
This passed with full testing with https://ci.swift.org/job/swift-PR-osx/8588/ and https://ci.swift.org/view/Pull%20Request/job/swift-PR-Linux/8623/, only change was a conflict in how we XFAILed an unrelated test. I'll keep trying to get that green checkmark in the mean time. |
Please test with following PR: @swift-ci please test linux platform |
Build failed |
Please test with following PR: @swift-ci please test linux platform |
@@ -217,4 +214,4 @@ extension NSRange : Codable { | |||
try container.encode(self.location) | |||
try container.encode(self.length) | |||
} | |||
} | |||
} |
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.
Tiny nitpick: restore newline
Build failed |
TestSwiftFoundation issue is unrelated:
|
As mentioned, this passed full Linux prior to an irrelevant change: https://ci.swift.org/view/Pull%20Request/job/swift-PR-Linux/8623/ |
Please test with following PR: @swift-ci please smoke test linux platform |
1 similar comment
Please test with following PR: @swift-ci please smoke test linux platform |
Original PR
Switch the native encoding of String to be UTF-8 and finalize String's ABI for Swift 5.0.
Resolves SR-7602.
rdar://problem/42339222