Commit Graph

2015 Commits

Author SHA1 Message Date
Saleem Abdulrasool
ce40d72641 stdlib: implement _stdlib_pthread_join in terms of Windows threading
Implement `_stdlib_pthread_join` in terms of windows threading.
Additionally, rename it to `_stdlib_thread_join`.
2018-11-26 13:10:00 -08:00
Saleem Abdulrasool
6bf7b9e711 stdlib: implement _stdlib_create_pthread_block in terms of Windows threaing
Port the block based thread constructor to Windows threading model, and
rename it to `_stdlib_create_thread_block`.
2018-11-26 13:10:00 -08:00
Saleem Abdulrasool
65bdce00b6 stdlib: rename _stdlib_PTHREAD_BARRIER_SERIAL_THREAD -> _stdlib_THREAD_BARRIER_SERIAL_THREAD 2018-11-26 13:10:00 -08:00
Saleem Abdulrasool
7b06586fe1 stdlib: rename _stdlib_pthread_barrier_t to _stdlib_thread_barrier_t 2018-11-26 13:09:49 -08:00
Saleem Abdulrasool
940db1b0cf stdlib: remove pthread_attr_t from _stdlib_pthread_create_block
The attributes were not being used currently.  Since this is a private
interface, remove the parameter as it makes it easier to port to
Windows.
2018-11-26 13:09:31 -08:00
Saleem Abdulrasool
82360c6b27 stdlib: remove pthread_barrier attributes
These were not in use, and removing this from the signature makes it
possible to re-use the exact signature on Windows more easily.
2018-11-26 13:09:31 -08:00
Saleem Abdulrasool
0693bec1f1 sdlib: rename SwiftPrivatePthreadExtras to SwiftPrivateThreadExtras
This is in preparation to make the code here more target agnostic for
porting to the Windows threading primitives.  This is used pretty
extensively in the tests, so disabling tests would lose a chunk of
coverage.
2018-11-26 13:09:31 -08:00
Doug Gregor
d5f6d7f2cb Merge pull request #20491 from DougGregor/runtime-conformance-descriptor-cache
[Runtime] Cache protocol conformance descriptors, not witness tables.
2018-11-26 12:56:23 -08:00
Michael Ilseman
4111b21cb0 [String] Bug fix for empty-range getCharacters 2018-11-26 12:13:23 -08:00
Karoy Lorentey
5e53e5b144 [test] Set: Add some tests for new index validation features in 5.0 2018-11-23 16:48:32 +00:00
Karoy Lorentey
92d355a4be [test] Dictionary: Add some tests for new index validation features in 5.0 2018-11-23 16:48:23 +00:00
Karoy Lorentey
5d3768d7ff [test] Add more tests for Set.update(with:)
rdar://problem/26013581
2018-11-23 12:50:06 +00:00
Karoy Lorentey
cc3b270691 [test] Set/Dictionary: Restore bucket-level tests for collision handling 2018-11-23 12:49:35 +00:00
Doug Gregor
d00a7b75c0 Revert "Update Set<AnyHashable> test case that no longer crashes"
This reverts commit 6abc8489ce.
2018-11-21 07:03:19 -08:00
Graydon Hoare
364be39f2a <rdar://46174386> Restrict CharacterPropertiesLong test to optimized_stdlib configs. 2018-11-19 16:05:20 -08:00
Lance Parker
17187344df Make the NormalizationCheck test compare code units 2018-11-16 14:43:04 -08:00
Lance Parker
12bf2978e3 Michael's feedback 2018-11-16 10:20:46 -08:00
Lance Parker
0009b21533 properly promote stack buffer to heap buffer when necessary 2018-11-16 10:19:48 -08:00
Ben Cohen
1673c12d78 [stdlib] Replace "sanityCheck" with "internalInvariant" (#20616)
* Replace "sanityCheck" with "internalInvariant"
2018-11-15 20:50:22 -08:00
Michael Ilseman
f9e6df312a Implement SE-0221: Character Properties (#20520)
Provide convenience properties on Character.
2018-11-15 14:03:49 -08:00
Ben Cohen
df2307e035 [stdlib][DNM] Collapse sequence and collection wrappers (#20221)
* Concretize dropFirst/Last/sufix/prefix from Sequence

Remove split customization point

Eliminate SubSequence from Sequence protocol

Collapse LazyCollection

Collapse LazyMapCollection

Eliminate _SequenceWrapper

Collapse LazyFilterCollection

Collapse LazyDrop/PrefixWhileCollection

Fix tests, ABI stability update

Collapse FlattenSequence

* Add entries to source/ABI compatible expected results.

* Update tests to avoid pre-10.14 objc runtime bug

* Expunge _preprocessingPass
2018-11-14 10:05:58 -08:00
Maxim Moiseev
74c2da4c4b [xctest] Check for an error message prefix only
Checking the whole message is fragile and might break should the
formatting change ever so slightly.

Fixes: <rdar://problem/46030955>
2018-11-13 14:34:15 -08:00
Erik Eckstein
0b5de45b3f disable the XCTest test to unblock CI
rdar://problem/46030955
2018-11-13 13:56:06 -08:00
Max Moiseev
484ff75747 Merge pull request #13698 from apple/revert-12883-disable_modelio_test_ios
Revert "Disable ModelIO test on ios"
2018-11-13 10:57:05 -08:00
Michael Ilseman
24a95992f9 Merge branch 'master' into uniterator 2018-11-09 15:08:25 -08:00
Karoy Lorentey
51be8c7650 [stdib] Remove RandomNumberGenerator._fill(bytes:)
This hidden customization point isn’t used in the stdlib anymore.
2018-11-09 17:37:25 +00:00
Michael Ilseman
75943350d2 [String] Give String a custom iterator
Gives us modest wins on complex grapheme strings, but up to 40% on
heavy-ASCII strings.
2018-11-08 18:25:01 -08:00
Slava Pestov
94b1a28011 Fix remaining tests that pass -swift-version 3
Fixes <rdar://problem/45749460>.
2018-11-08 15:48:26 -05:00
Nate Cook
e5c1567957 [stdlib] Switch to a stable sort algorithm (#19717)
This switches the standard library's sort algorithm from an in-place
introsort to use a modified timsort, a stable, adaptive sort that
merges runs using a temporary buffer. This implementation performs
straight merges instead of adopting timsort's galloping strategy.

In addition to maintaining the relative order of equal/non-comparable
elements, this algorithm outperforms the introsort on data with any
intrinsic structure, such as runs of ascending or descending elements
or a significant number of equality collisions.
2018-11-07 00:05:04 -06:00
Maxim Moiseev
ca51626fd3 [stdlib] Move _stdlib_AtomicInt and friends out of the stdlib 2018-11-06 09:53:58 -08:00
Maxim Moiseev
90106444d3 [stdlib] Remove a bunch of unused functions from Runtime.swift.gyb
<rdar://problem/45746339>
2018-11-05 15:03:19 -08:00
Michael Ilseman
fee2787eb6 [String] Invalidate breadcrumbs on mutation. 2018-11-05 06:48:56 -08:00
Michael Ilseman
ec6729a3a3 [String] Assertion logic and isASCII bug fix.
Fix bugs in assertion logic and properly update the isASCII bit on
RRC. RRC tests added.
2018-11-04 10:42:44 -08:00
Michael Ilseman
c04dcf3b38 [String] More efficient breadcrumb-scanning code.
Rather than rely on the UTF16View, scan between breadcrumbs by hand
for a decent 20% speedup. This code will also make it more obvious how
to slot in a vectorized solution later.
2018-11-04 10:42:44 -08:00
Michael Ilseman
948655e850 [String] Cleanups, comments, documentation
After rebasing on master and incorporating more 32-bit support,
perform a bunch of cleanup, documentation updates, comments, move code
back to String declaration, etc.
2018-11-04 10:42:42 -08:00
Karoy Lorentey
40aae6b235 [String] 32-bit platform support
Add support for 32-bit platforms for UTF-8 backed String.
2018-11-04 10:42:41 -08:00
Michael Ilseman
e6582c37ee [test] Adjust String tests for UTF-8 representation.
Adjust tests for the UTF-8 representation, in preparation for 32-bit
support. Includes UTF-8 literal update.
2018-11-04 10:42:41 -08:00
Michael Ilseman
cb0fbc6fc7 [String] 5X Faster getCharacters implementation
Rather than bounce through the UTF-16 view, implement custom
transcoding for getCharacters. This speeds it up by around 5X. Adds
tests.
2018-11-04 10:42:41 -08:00
Michael Ilseman
e2c2e479bb [test] Test the breadcrumbing String<->Cocoa interface 2018-11-04 10:42:41 -08:00
Michael Ilseman
b87bff4fac [test] Test the unique-native String RRC optimization path 2018-11-04 10:42:41 -08:00
Michael Ilseman
9b5eb23de3 [test] Fix test: add in explicit mkdir 2018-11-04 10:42:41 -08:00
Lance Parker
bacc7eecd5 fix the normalization unit tests 2018-11-04 10:42:41 -08:00
Lance Parker
7376009ccc Add benchmarks and tests for the normalized iterator (#32)
Add benchmarks and tests for the normalized iterator
2018-11-04 10:42:41 -08:00
Lance Parker
f1a35bd1c9 String comparison iterator for UTF8 strings 2018-11-04 10:42:41 -08:00
Brent Royal-Gordon
9bd1a26089 Implementation for SE-0228: Fix ExpressibleByStringInterpolation (#20214)
* [CodeCompletion] Restrict ancestor search to brace

This change allows ExprParentFinder to restrict certain searches for parents to just AST nodes within the nearest surrounding BraceStmt. In the string interpolation rework, BraceStmts can appear in new places in the AST; this keeps code completion from looking at irrelevant context.

NFC in this commit, but keeps code completion from crashing once TapExpr is introduced.

* Remove test relying on ExpressibleByStringInterpolation being deprecated

Since soon enough, it won’t be anymore.

* [AST] Introduce TapExpr

TapExpr allows a block of code to to be inserted between two expressions, accessing and potentially mutating the result of its subexpression before giving it to its parent expression. It’s roughly equivalent to this function:

  func _tap<T>(_ value: T, do body: (inout T) throws -> Void) rethrows -> T {
    var copy = value
    try body(&copy)
    return copy
  }

Except that it doesn’t use a closure, so no variables are captured and no call frame is (even notionally) added.

This commit does not include tests because nothing in it actually uses TapExpr yet. It will be used by string interpolation.

* SE-0228: Fix ExpressibleByStringInterpolation

This is the bulk of the implementation of the string interpolation rework. It includes a redesigned AST node, new parsing logic, new constraints and post-typechecking code generation, and new standard library types and members.

* [Sema] Rip out typeCheckExpressionShallow()

With new string interpolation in place, it is no longer used by anything in the compiler.

* [Sema] Diagnose invalid StringInterpolationProtocols

StringInterpolationProtocol informally requires conforming types to provide at least one method with the base name “appendInterpolation” with no (or a discardable) return value and visibility at least as broad as the conforming type’s. This change diagnoses an error when a conforming type does not have a method that meets those criteria.

* [Stdlib] Fix map(String.init) source break

Some users, including some in the source compatibility suite, accidentally used init(stringInterpolationSegment:) by writing code like `map(String.init)`. Now that these intializers have been removed, the remaining initializers often end up tying during overload resolution. This change adds several overloads of `String.init(describing:)` which will break these ties in cases where the compiler previously selected `String.init(stringInterpolationSegment:)`.

* [Sema] Make callWitness() take non-mutable arrays

It doesn’t actually need to mutate them.

* [Stdlib] Improve floating-point interpolation performance

This change avoids constructing a String when interpolating a Float, Double, or Float80. Instead, we write the characters to a fixed-size buffer and then append them directly to the string’s storage.

This seems to improve performance for all three types, but especially for Double and Float80, which cannot always fit into a small string when stringified.

* [NameLookup] Improve MemberLookupTable invalidation

In rare cases usually involving generated code, an overload added by an extension in the middle of a file would not be visible below it if the type had lazy members and the same base name had already been referenced above the extension. This change essentially dirties a type’s member lookup table whenever an extension is added to it, ensuring the entries in it will be updated.

This change also includes some debugging improvements for NameLookup.

* [SILOptimizer] XFAIL dead object removal failure

The DeadObjectRemoval pass in SILOptimizer does not currently remove reworked string interpolations as well as the old design because their effects cannot be described by @_effects(readonly). That causes a test failure on Linux. This change temporarily silences that test. The SILOptimizer issue has been filed as SR-9008.

* Confess string interpolation’s source stability sins

* [Parser] Parse empty interpolations

Previously, the parser had an odd asymmetry which caused the same function to accept foo(), but reject “\()”. This change fixes the issue.

Already tested by test/Parse/try.swift, which uses this construct in one of its throwing interpolation tests.

* [Sema] Fix batch-mode-only lazy var bug

The temporary variable used by string interpolation needs to be recontextualized when it’s inserted into a synthesized getter. Fixes a compilation failure in Alamofire.

I’ll probably follow up on this bug a bit more after merging.
2018-11-02 19:16:03 -07:00
Max Moiseev
433444f02a Merge pull request #20137 from moiseev/scene-kit-mode
[overlay] Build SceneKit in Swift 4 mode
2018-11-02 09:48:28 -07:00
John McCall
abdba1d3f4 Change the integer-literal type from Int2048 to IntLiteral.
Part of SR-290.
2018-10-31 23:14:58 -04:00
Ben Cohen
dbc2e21522 Remove customization points from Sequence and Collection (#19995) 2018-10-31 18:58:00 -07:00
Karoy Lorentey
3ae170c1c1 [stdlib] Remove SipHash from ABI-visible names
Also, eliminate the (unused) SipHash24 implementation and nest most of Hasher’s internals under Hasher itself.
2018-11-01 00:45:40 +00:00
Maxim Moiseev
27a3ebf591 [overlay] Build SceneKit in Swift 4 mode
Addresses: <rdar://problem/43534146>
2018-10-29 15:48:34 -07:00