Commit Graph

12522 Commits

Author SHA1 Message Date
Slava Pestov
76dce7c5e0 Runtime: The class metadata relocation function can be null
IRGen always just emits a simple implementation that immediately
calls swift_relocateClassMetadata(); so allow the function to be
null in this case to save on code size.
2018-11-26 21:22:48 -05:00
Slava Pestov
12de97c73f Runtime: Some const correctness 2018-11-26 21:22:48 -05:00
Maxim Moiseev
90e9647a04 [overlay] Expose NWConnection.maximumDatagramSize
<rdar://problem/45521356>
2018-11-26 16:26:13 -08:00
swift-ci
68884b286c Merge pull request #20768 from milseman/empty_range 2018-11-26 14:59:06 -08:00
swift-ci
8ce2a36e6b Merge pull request #20653 from milseman/fastwidth 2018-11-26 14:34:54 -08: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
8b8198aaae stdlib: add modulemap for WinSDK
This is needed to build the threading extras.
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
Karoy Lorentey
c1a7b71f46 Merge pull request #20762 from apple/sr-9348
[stdlib] _HashTable.copyContents: Fix out of bounds access
2018-11-26 21:04:17 +00: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
Jordan Rose
6afe77ae98 [CMake] Clean up (somewhat) the generated Xcode project (#20586)
Still to do: have command-only targets that present sources, for things
like copy_shim_headers.
2018-11-26 11:31:41 -08:00
Arnold Schwaighofer
baae7ee10b Fix spelling of inlinable 2018-11-26 11:27:58 -08:00
Arnold Schwaighofer
e582a45a48 stdlib: Make ArrayBufferProtocol.init inlinable to facilitate specialization
SR-9284
2018-11-26 11:10:21 -08:00
Doug Gregor
39481149a3 [Runtime] Compute generic metadata cache info once per type.
Rather than scanning through the generic parameters and generic requirements
each time we form a key for the generic metadata cache, compute these
values once, when the cache itself is first initialized.
2018-11-26 10:46:42 -08:00
Michael Ilseman
8b9cc18003 Merge pull request #20621 from milseman/unsafe_unchecked_buffer_pointer
[stdlib] Unchecked subscript on UnsafeBufferPointer
2018-11-26 10:31:04 -08:00
Karoy Lorentey
66db9b40b8 [stdlib] _HashTable.copyContents: Fix buffer overrun 2018-11-26 18:24:23 +00:00
Doug Gregor
06807c2ea6 [Runtime] Only scan the type descriptor once for metadata cache entries.
Rather than scanning the type descriptor each time we perform a comparison
or hash of a metadata cache entry, do so only once to establish the number
of key parameters and the number of witness tables. Use those values to
more efficiently compare keys.
2018-11-25 22:10:04 -08:00
Saleem Abdulrasool
29dc89bd9b stdlib: broaden ucrt module
Add `process` to the ucrt module as this is used in the Foundation port
for Windows.
2018-11-24 20:57:46 -08:00
Arjun Nayini
a15ecd0039 PR Feedback 2018-11-24 13:51:48 -08:00
Arjun Nayini
300124460f [SR-7076] Make ContiguousArray Codable
Implements Encodable and Decodable for ContiguousArray.
2018-11-24 09:09:55 -08:00
Karoy Lorentey
545fa5e640 [stdlib] Re-add previously synthesized hashing definitions 2018-11-22 17:15:36 +00:00
Karoy Lorentey
8bd56509b2 [stdlib] Add hashing methods to RawRepresentable to match == 2018-11-22 17:14:56 +00:00
Saleem Abdulrasool
ab37099967 Merge pull request #20686 from compnerd/alignment
stdlib: pass along alignment for dealloc
2018-11-21 09:34:14 -08:00
Doug Gregor
32f577abf2 [Runtime] Perform “deep” comparisons of witness tables when uniquing metadata.
Metadata uniquing might encounter witness tables that were distinctly
generated but come from identical descriptors. Handle this case in metadata
uniquing be looking into the protocol conformance descriptors themselves.
2018-11-20 22:07:55 -08:00
Saleem Abdulrasool
381cae6df0 stdlib: pass along alignment for dealloc
Ensure that UnsafeMutablePointer.deallocate has the alignment that was
used when invoking UnsafeMutablePointer.allocate.  This is required to
ensure that the appropriate `free` function is invoked.  We would
previously fail on Windows as the allocation would use `malloc` and due
to the value being `-1`, use `_aligned_free` instead when deallocating.
2018-11-20 14:05:13 -08:00
Karoy Lorentey
694b153992 Merge pull request #20643 from lorentey/string-32-simple
[stdlib] _StringObject: Use a full 8-bit discriminator on 32-bit platforms
2018-11-20 17:50:53 +00:00
Karoy Lorentey
ef76bcf7cf [stdlib] Don’t change the 64-bit ABI 2018-11-20 12:11:34 +00:00
Mark Lacey
9e7d7d0b8e Merge pull request #20659 from rudkx/add-designated-types-for-logical-and-ranges
Update Policy.swift with designated types for logical and range operators.
2018-11-17 22:59:54 -08:00
Mark Lacey
b7626d7ccf [stdlib] Update Policy.swift with designated types for logical and range operators. 2018-11-17 20:18:28 -08:00
Doug Gregor
d9bb81bc20 [Runtime] Cache protocol conformance descriptors, not witness tables.
The conformance cache was caching the witness table for a conformance
`T: P`, where `T` is a concrete type and `P` is a protocol. However, it
essentially picked one of potentially many witness tables for that
conformance, because retroactive conformances might produce different results
from different modules.

Make the conformance cache what is says it is: a cache of the conformance
descriptor for a given `T: P`, potentially filtered by a module (when
requested). Clients of the conformance cache can choose how to interpret
the protocol conformance descriptor, e.g., by instantiating a witness table.

We can bring back a specific conformance cache for swift_conformsToProtocol()
if it is profitable.

(cherry picked from commit 0af2af00a739a4d912d2a9c3b196449e4164484f)
2018-11-16 22:26:40 -08:00
swift-ci
89950feea9 Merge pull request #20651 from milseman/spurious_inlinable 2018-11-16 19:16:20 -08:00
Lance Parker
8306ef322a Merge pull request #20585 from lancep/spotFixForStringCompCrash
[stdlib] properly promote stack buffer to heap buffer when necessary
2018-11-16 19:05:35 -08:00
Michael Ilseman
18e415b4c0 [String] CJK Grapheme breaking fast-paths for fullwidth
Add in grapheme breaking fast-paths for fullwidth forms and
punctuation. Extend non-combining kana fast-paths to include vowel
extender.
2018-11-16 16:27:20 -08:00
Mark Lacey
2c15dc2d1c Merge pull request #20625 from rudkx/designated-types-array
[ConstraintSystem] Add Array as a designated type for `+` and `+=`.
2018-11-16 15:28:34 -08:00
Michael Ilseman
8b1464a984 [String] Drop spurious @inlinable 2018-11-16 15:08:20 -08:00
Saleem Abdulrasool
a79c14164b Merge pull request #20633 from compnerd/weak-win
runtime: adjust LLVMSupport for Windows
2018-11-16 13:31:48 -08:00
Michael Ilseman
3a0ac0270d [stdlib] Unchecked subscript on UnsafeBufferPointer
Add a use an unchecked subscript on UnsafeBufferPointer, which skips
debugPrecondition checks (in case we're not inlined) as well as a
force-unwrap check.
2018-11-16 11:12:29 -08:00
Lance Parker
fc3341eddc fixup rebase 2018-11-16 11:07:30 -08:00
Mark Lacey
d3b660d907 [stdlib] Remove FIXMEs from Array extension. 2018-11-16 11:03:55 -08:00
Doug Gregor
d4fe6e9ff7 [Runtime] Fix a bug in handling multi-level generic environment substitutions. 2018-11-16 10:39:19 -08:00
Karoy Lorentey
3b748933f1 [stdlib] _StringObject: Use a full 8-bit discriminator on 32-bit platforms
We now have plenty of extra inhabitants in the variant enum, so we can get rid of the 7-bit hack.

It’d also be possible now to increase small string capacity to a spacious 11 bytes; however this needs a full overhaul of the 32-bit representation, so it needs a little bit more time in the oven.
2018-11-16 18:36:03 +00:00