Commit Graph

1239 Commits

Author SHA1 Message Date
Ben Cohen
ad50a39b12 [stdlib] Add withContiguous{Mutable}StorageIfAvailable (#21092)
* Add MutableCollection.withContiguousMutableStorageIfAvailable

* Add withContiguousMutableStorageIfAvailable impls

* Add tests on concrete types

* Add Sequence.withContiguousStorageIfAvailable

* Implement withContiguousStorageIfAvailable in concrete types
2018-12-07 10:01:18 -08:00
Maxim Moiseev
ebf90f78be Make an StdlibUnitTest error message a bit more useful 2018-12-06 14:11:57 -08:00
Xiaodi Wu
9fe28c6e55 [gardening] Fix header comments [NFC] 2018-12-02 15:38:41 -05:00
Saleem Abdulrasool
98d71ff38f SwiftPrivateThreadExtras: clean up using WinSDK SDK overlay
Use the constants rather than hardcoding values.
2018-12-01 11:04:13 -08:00
Saleem Abdulrasool
cc49e686cd Merge pull request #20908 from compnerd/thread-corrections
SwiftPrivateThreadExtras: fix windows build
2018-11-30 10:38:09 -08:00
Karoy Lorentey
1ef6cf4813 Merge pull request #20866 from lorentey/deprecate-hashValue-1
[test] Modernize hashing throughout the test suite
2018-11-30 14:21:04 +00:00
Saleem Abdulrasool
c32daed203 SwiftPrivateThreadExtras: fix windows build
Missed casts and a let vs var issue.  This was missed in the last bundle
of patches.
2018-11-29 22:19:00 -08:00
Saleem Abdulrasool
94173e9cdb SwiftPrivateThreadExtras: correct dependency for Windows
We need the MSVCRT module, add a dependency.
2018-11-29 19:26:59 -08:00
Karoy Lorentey
8e77a2655a [test] StdlibUnittest: Add missing hash(into:) implementations 2018-11-29 15:55:17 +00:00
Saleem Abdulrasool
0aec8376da SwiftPrivateThreadExtras: enable on all platforms
This has been generalized enough to permit building on Windows with
Windows threading primitives.
2018-11-26 13:10:00 -08:00
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
e1d7ee79e4 stdlib: implement ThreadBarriers in terms of Windows threading 2018-11-26 13:10:00 -08:00
Saleem Abdulrasool
5e943981c7 stdlib: rename some variables in _stdlib_barrier 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
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
Mike Ash
9266cb7229 Merge branch 'master' into remove-swiftprivate-swiftdarwin-dependency 2018-11-06 19:45:26 -05:00
Max Moiseev
ddcd8d324a Merge pull request #20243 from arguiot/patch-1
Updated SwiftPrivate.swift using String Interpolation
2018-11-06 14:49:15 -08:00
Mike Ash
45693049bf [Stdlib] Remove SwiftPrivate's dependency on Darwin.
Revert #20194, which seems to be more trouble than it's worth. Instead, move the functions that SwiftPrivate needs back into LibcShims.h/cpp as SPI.

rdar://problem/45817565
2018-11-06 17:41:56 -05:00
Maxim Moiseev
ca51626fd3 [stdlib] Move _stdlib_AtomicInt and friends out of the stdlib 2018-11-06 09:53:58 -08:00
Xiaodi Wu
049b89ce4d Update stdlib/private/SwiftPrivate/SwiftPrivate.swift
Co-Authored-By: arguiot <arguiot@gmail.com>
2018-11-05 07:19:20 +08:00
Xiaodi Wu
977a9558ce Update stdlib/private/SwiftPrivate/SwiftPrivate.swift
Co-Authored-By: arguiot <arguiot@gmail.com>
2018-11-05 07:19:12 +08:00
Xiaodi Wu
577e5534fd Update stdlib/private/SwiftPrivate/SwiftPrivate.swift
Co-Authored-By: arguiot <arguiot@gmail.com>
2018-11-05 07:19:06 +08:00
Xiaodi Wu
f76be9b08f Update stdlib/private/SwiftPrivate/SwiftPrivate.swift
Co-Authored-By: arguiot <arguiot@gmail.com>
2018-11-05 07:18:59 +08:00
Xiaodi Wu
dc9d2b5da9 Update stdlib/private/SwiftPrivate/SwiftPrivate.swift
Co-Authored-By: arguiot <arguiot@gmail.com>
2018-11-05 07:18:51 +08:00
Xiaodi Wu
3228c800a6 Update stdlib/private/SwiftPrivate/SwiftPrivate.swift
Co-Authored-By: arguiot <arguiot@gmail.com>
2018-11-05 07:18:46 +08:00
Xiaodi Wu
aede4b07ab Update stdlib/private/SwiftPrivate/SwiftPrivate.swift
Co-Authored-By: arguiot <arguiot@gmail.com>
2018-11-05 07:18:42 +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
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
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
Arthur Guiot
117d7baab8 Fixed indentation to 2 spaces in SwiftPrivate.swift 2018-11-03 11:27:20 +08:00
Arthur Guiot
e6fea9e6ed Fixed header in SwiftPrivate.swift 2018-11-02 23:46:19 +08:00
Arthur Guiot
b957a3b9d4 Fixed git error... 2018-11-02 23:44:34 +08:00
Arthur Guiot
08f5db8de5 Updated SwiftPrivate.swift using String Interpolation
I updated /stdlib/private/SwiftPrivate/SwiftPrivate.swift using String Interpolations, so the code is more readable and more "Swifty"
2018-11-02 23:32:28 +08:00
Mike Ash
77d8f79b0a Merge pull request #20194 from mikeash/add-swiftprivate-darwin-dependency
[Stdlib] Add Darwin/Glibc as a dependency for SwiftPrivate.
2018-11-01 13:39:07 -07:00
Ben Cohen
dbc2e21522 Remove customization points from Sequence and Collection (#19995) 2018-10-31 18:58:00 -07:00
Mike Ash
0ce854abf9 [Stdlib] Add Darwin/Glibc as a dependency for SwiftPrivate.
The changes in https://github.com/apple/swift/pull/19614 require Darwin/Glibc to build first. This usually happened anyway (and thus the problem wasn't noticed for a while) but sometimes SwiftPrivate would win the race and the build would fail.

rdar://problem/45624328
2018-10-31 16:46:28 -04:00
Michael Gottesman
3f17bb6ddf Carefully split the build's invocation of add_swift_library into host/target variants.
The key thing here is that all of the underlying code is exactly the same. I
purposely did not debride anything. This is to ensure that I am not touching too
much and increasing the probability of weird errors from occurring. Thus the
exact same code should be executed... just the routing changed.
2018-10-27 12:58:51 -07:00
Andrew Trick
e560125d20 Create RuntimeUnittest library for C++ runtime unit tests from lit.
Create a new RuntimeUnittest library alongside the other stdlib unit
tests so we can write C++ runtime unit tests callable from lit.

Move runtime exclusivity tests into the stdlib unittest library and
create lit tests so we can verify that the runtime crashes with an
error message.
2018-10-13 10:06:35 -07:00
Mike Ash
5f17b450c3 [Stdlib] Make all the functions in LibcShims.h either INTERNAL or inline. Move LibcShimsInline.h to LibcOverlayShims.h for more consistent naming. Fix up several tests that needed the mock Darwin overlay built. Fix one SourceKit test that no longer produces is_system: 1 on an import Darwin line. 2018-10-03 09:55:34 -04:00
Mike Ash
ec25f928ff [Stdlib] Move _swift_stdlib_read/write/close into LibcShimsInline.h. 2018-10-03 09:55:34 -04:00
Mike Ash
e18e03171f [Stdlib] Change SWIFT_RUNTIME_STDLIB_INTERNAL to not export the symbol.
The functions in LibcShims are used externally, some directly and some through @inlineable functions. These are changed to SWIFT_RUNTIME_STDLIB_SPI to better match their actual usage. Their names are also changed to add "_swift" to the front to match our naming conventions.

Three functions from SwiftObject.mm are changed to SPI and get a _swift prefix.

A few other support functions are also changed to SPI. They already had a prefix and look like they were meant to be SPI anyway. It was just hard to notice any mixup when they were #defined to the same thing.

rdar://problem/35863717
2018-10-03 09:55:33 -04:00
Karoy Lorentey
6cef0beff9 Merge pull request #19495 from lorentey/simplify-rawHashValue
[stdlib] Finalize one-shot hashing interface
2018-09-24 21:44:36 +01:00
Karoy Lorentey
b2ef455b3a [test] Update tests for _rawHashValue(seed:) changes 2018-09-24 13:31:19 +01:00
Mike Ash
49c3547449 Merge remote-tracking branch 'origin/master' into rename-conflicting-classes-and-methods 2018-09-21 15:52:38 -04:00