Commit Graph

12 Commits

Author SHA1 Message Date
Michael Ilseman
4ab45dfe20 [String] Drop in initial UTF-8 String prototype
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.
2018-11-04 10:42:40 -08:00
Jordan Rose
9f7d6cea68 [stdlib] Mark two types @usableFromInline; they satisfy requirements (#18862)
Otherwise, the textual interface won't see them, and any inlinable
code that wants to make use of the protocol might get confused.
We should have a check for this in the compiler itself, but for now
I'm just providing this change to get unblocked.
2018-08-21 09:40:56 -07:00
Slava Pestov
5d1f48e3ae stdlib: Update for stricter enforcement of @usableFromInline 2018-06-25 16:26:56 -07:00
Karoy Lorentey
23c630ac92 [stdlib] Add @usableFromInline to internal typealiases that need it
This fixes 3659 warnings in the standard library.
2018-06-18 16:34:19 +01:00
Slava Pestov
2e5aef9c8d stdlib: Remove redundant @usableFromInline attributes 2018-04-06 00:02:30 -07:00
Slava Pestov
e1f50b2d36 SE-0193: Rename @_inlineable to @inlinable, @_versioned to @usableFromInline 2018-03-30 21:55:30 -07:00
Lance Parker
cbf157f924 [stdlib]Unify String hashing implementation (#14921)
* Add partial range subscripts to _UnmanagedOpaqueString

* Use SipHash13+_NormalizedCodeUnitIterator for String hashes on all platforms

* Remove unecessary collation algorithm shims

* Pass the buffer to the SipHasher for ASCII

* Hash the ascii parts of UTF16 strings the same way we hash pure ascii strings

* De-dupe some code that can be shared between _UnmanagedOpaqueString and _UnmanagedString<UInt16>

* ASCII strings now hash consistently for in hashASCII() and hashUTF16()

* Fix zalgo comparison regression

* Use hasher

* Fix crash when appending to an empty _FixedArray

* Compact ASCII characters into a single UInt64 for hashing

* String: Switch to _hash(into:)-based hashing

This should speed up String hashing quite a bit, as doing it through hashValue involves two rounds of SipHash nested in each other.

* Remove obsolete workaround for ARC traffic

* Ditch _FixedArray<UInt8> in favor of _UIntBuffer<UInt64, UInt8>

* Bad rebase remnants

* Fix failing benchmarks

* michael's feedback

* clarify the comment about nul-terminated string hashes
2018-03-17 22:13:37 -07:00
Slava Pestov
aa4ca22b1b stdlib: Add FIXME(resilience) to @_fixed_layout declarations not added by stdlib team 2018-03-13 13:23:14 -07:00
Slava Pestov
9aae3b7b1c stdlib: Declare _UnmanagedOpaqueString.UnicodeScalarIterator fixed layout 2018-03-13 13:22:28 -07:00
Ben Cohen
9ee856f386 [stdlib][WIP] Eliminate (Closed)CountableRange using conditional conformance (#13342)
* Make Range conditionally a Collection

* Convert ClosedRange to conditionally a collection

* De-gyb Range/ClosedRange, refactoring some methods.

* Remove use of Countable{Closed}Range from stdlib

* Remove Countable use from Foundation

* Fix test errors and warnings resulting from Range/CountableRange collapse

* fix prespecialize test for new mangling

* Update CoreAudio use of CountableRange

* Update SwiftSyntax use of CountableRange

* Restore ClosedRange.Index: Hashable conformance

* Move fixed typechecker slowness test for array-of-ranges from slow to fast, yay

* Apply Doug's patch to loosen test to just check for error
2018-02-01 20:59:28 -08:00
Karoy Lorentey
90e894729a [StringGuts] Linux support
Add support for compiling StringGuts without the Objective-C runtime.
2018-01-21 12:37:36 -08:00
Michael Ilseman
3be2faf5d3 [String] Initial implementation of 64-bit StringGuts.
Include the initial implementation of _StringGuts, a 2-word
replacement for _LegacyStringCore. 64-bit Darwin supported, 32-bit and
Linux support in subsequent commits.
2018-01-21 12:32:26 -08:00