Commit Graph

7767 Commits

Author SHA1 Message Date
Dmitri Gribenko
30856bf094 stdlib: add complexity docs to Set.removeFirst() 2016-09-15 22:04:46 -07:00
Greg Parker
cd9a8afd5d Revert "SR-0140: Bridge Optionals to nonnull ObjC objects by bridging their payload, or using a sentinel." (#4820) 2016-09-15 18:18:07 -07:00
Dmitri Gribenko
9507bf19b5 Merge pull request #4810 from apple/stdlib-custom-AnyHashable-for-NSSet
Foundation: add a custom AnyHashable representation for NSSet
2016-09-15 16:16:28 -07:00
Dmitri Gribenko
2de0350057 stdlib: remove preconditions that are always true 2016-09-15 13:32:34 -07:00
Dmitri Gribenko
30c1695aeb Foundation: add a custom AnyHashable representation for NSSet 2016-09-15 13:27:36 -07:00
Joe Groff
3441fe8ca4 Merge pull request #4782 from jckarter/bridging-enhancements
SR-0140: Bridge Optionals to nonnull ObjC objects by bridging their payload, or using a sentinel.
2016-09-15 13:06:01 -07:00
Dmitri Gribenko
2a21011d31 Merge pull request #4802 from apple/stdlib-test-fixes
stdlib: test fixes
2016-09-15 12:40:12 -07:00
swift-ci
40483d470a Merge pull request #4767 from practicalswift/inconsistent-headers 2016-09-15 12:14:44 -07:00
Dmitri Gribenko
30509f1b64 StdlibUnittest: add an argument label to checkHashable
I think it improves readability of the callsite.
2016-09-15 10:20:09 -07:00
K Staring
4936a39a87 Merge branch 'master' of https://github.com/apple/swift 2016-09-15 19:06:19 +02:00
Doug Gregor
605218d2c2 Merge pull request #4793 from DougGregor/custom-anyhashable-nsmeasurement
[Foundation overlay] Enable custom AnyHashable representation for NSMeasurement
2016-09-15 09:33:17 -07:00
Grzegorz Miłoś
74ff4dad81 Merge remote-tracking branch 'upstream/master' into SR-755-linux-fatal-stacktrace-symbolication 2016-09-15 14:17:15 +01:00
K Staring
29d5de1fa5 Merge branch 'master' of https://github.com/apple/swift 2016-09-15 10:00:21 +02:00
Dmitri Gribenko
fbb3cf35a5 Revert "New SIL instructions to support tail-allocated arrays in SIL." 2016-09-15 00:25:25 -07:00
Dmitri Gribenko
cd07c2c125 Merge pull request #4795 from sigito/sr_2624
[SR-2624] Refine index out of bounds error messages for ArraySlice and SliceBuffer.
2016-09-15 00:24:40 -07:00
Yurii Samsoniuk
f3e3e2eb3f Update message. 2016-09-15 08:53:59 +02:00
Doug Gregor
fa4331b729 [Foundation overlay] Enable custom AnyHashable representation for NSMeasurement
Enables the overlay behavior blocked by rdar://problem/27539951.
2016-09-14 22:22:36 -07:00
Amr Aboelela
dbca4f031a Added module ifaddrs 2016-09-14 17:47:11 -07:00
Joe Groff
cfa9cd9a08 SR-0140: Bridge Optionals to nonnull ObjC objects by bridging their payload, or using a sentinel.
id-as-Any lets you pass Optional to an ObjC API that takes `nonnull id`, and also lets you bridge containers of `Optional` to `NSArray` etc. When this occurs, we can unwrap the value and bridge it so that inhabited optionals still pass into ObjC in the expected way, but we need something to represent `none` other than the `nil` pointer. Cocoa provides `NSNull` as the canonical "null for containers" object, which is the least bad of many possible answers. If we happen to have the rare nested optional `T??`, there is no precedented analog for these in Cocoa, so just generate a unique sentinel object to preserve the `nil`-ness depth so we at least don't lose information round-tripping across the ObjC-Swift bridge.

Making Optional conform to _ObjectiveCBridgeable is more or less enough to make this all work, though there are a few additional edge case things that need to be fixed up. We don't want to accept `AnyObject??` as an @objc-compatible type, so special-case Optional in `getForeignRepresentable`.

Implements SR-0140 (rdar://problem/27905315).
2016-09-14 15:50:13 -07:00
Yurii Samsoniuk
53be51fb67 Refine index out of bounds error messages for Arrays and SliceBuffer. 2016-09-15 00:04:44 +02:00
Erik Eckstein
6ae818c9d1 Remove the LLVM stack promotion pass and related SIL optimization logic.
It's not needed anymore because array buffers are now allocated with alloc_ref instead of a swift_bufferAllocate runtime call.
2016-09-14 14:54:18 -07:00
Erik Eckstein
15cca80404 stdlib: Use builtin tail-allocated arrays instead of ManagedBuffer to allocate Set and Dictionary buffers
This reduces the amount of SIL generated for Set/Dictionary operations significantly.
The generated code should be mostly the same (modulo different inlining decisions).
2016-09-14 14:54:18 -07:00
Erik Eckstein
1201d96cb2 stdlib: Use builtin tail-allocated arrays instead of ManagedBuffer to allocate contiguous array buffers.
This reduces the amount of SIL generated for array operations significantly.
The generated code should be mostly the same (modulo different inlining decisions).
2016-09-14 14:54:18 -07:00
Erik Eckstein
2a92b84b54 Add builtins to generate instructions for tail-allocated arrays in SIL.
Those builtins are: allocWithTailElems_<n>, getTailAddr and projectTailElems
Also rename the "gep" builtin, which indexes raw bytes, to "gepRaw" and add a new "gep" builtin to index in a typed array.
2016-09-14 14:54:18 -07:00
Erik Eckstein
7c374066e6 Remove the strideof_nonzero builtin.
Because now the stride of all types is at least one, anyway.
2016-09-14 13:24:19 -07:00
Erik Eckstein
c710b04dbf IRGen: Let the stride of a type be at least one, even for zero-sized types like the empty tuple.
This affects the computed stride for fixed-sized types in IRGen as well as the stored stride in value witness tables.
The reason is to let comparisons and difference operations work for pointers to zero-sized types.
(Currently this is achieved by using Builtin.strideof_nonzero in MemoryLayout.stride, but this requires a std::max(1, stride) operation after loading the stride)
2016-09-14 13:24:19 -07:00
practicalswift
9185c052a9 [gardening] Fix inconsistent headers 2016-09-14 20:48:28 +02:00
K Staring
f11d05717e CMAKE_SDK apparenty isn't always filled when cmake runs; always use /usr/local/include for now 2016-09-13 11:18:07 +02:00
K Staring
afc95a5e2a disable handy pthread wrappers on FreeBSD since they don't compile
Things like: PthreadBarriers.swift:114:50: error: cannot convert value of type 'UnsafeMutablePointer<pthread_mutex_t>' (aka 'UnsafeMutablePointer<OpaquePointer>') to expected argument type 'UnsafeMutablePointer<pthread_mutex_t?>' (aka 'UnsafeMutablePointer<Optional<OpaquePointer>>')
on barrier.pointee.mutex . I need to do more research to understand this
2016-09-13 11:08:00 +02:00
K Staring
33d2dec32f Merge branch 'master' of https://github.com/apple/swift 2016-09-15 06:13:55 +02:00
K Staring
6428295d70 Two fixes for FreeBSD build
add /usr/local/include to include path in stdlib/public/stubs
use FreeBSD procfs path to cmdline when building for FreeBSD
2016-09-14 20:00:33 +02:00
Dmitri Gribenko
a4af3e62c3 StdlibUnittest: remove 'expectEmpty()' and 'expectNotEmpty()' 2016-09-12 10:33:07 -07:00
Dmitri Gribenko
243a35cd65 Migrate callsites from 'expectEmpty()' to 'expectNil()' 2016-09-10 20:05:42 -07:00
Dmitri Gribenko
b8a475be72 StdlibUnittest: rename 'expectEmpty()' and 'expectNotEmpty()' to 'expectNil()' and 'expectNotNil()'
The new names are what people generally expect.  The old names made more
sense in the old times when the 'Optional.None' case could not be
created with the 'nil' keyword.
2016-09-10 20:05:42 -07:00
Dmitri Gribenko
b3030fc96e Merge pull request #4691 from apple/stdlib-existential-collection-fix
stdlib: type-erased collections: add forwarding for '_customContainsEquatableElement()'
2016-09-09 13:49:55 -07:00
Dmitri Gribenko
92c180031f stdlib: make 'Sequence.first(where:)' a pure protocol extension (no dynamic dispatch)
SE-0032 did not propose a protocol entry point, only a protocol
extension.

Using a pure protocol extension is the right choice here because a
concrete sequence can't provide a more efficient implementation of this
method than the default one.
2016-09-09 11:30:55 -07:00
Dmitri Gribenko
1e676d0d8c stdlib: type-erased collections: add forwarding for '_customContainsEquatableElement()' 2016-09-09 09:30:56 -07:00
Dmitri Gribenko
23cecf8079 stdlib: change two fixmes into FIXME(ABI) 2016-09-08 01:16:19 -07:00
Joe Groff
2acf98ffd5 Merge pull request #4664 from jckarter/rdar27905230
Foundation overlay: Remove unnecessary precondition that array elements be ObjectiveCBridgeable.
2016-09-07 11:38:06 -07:00
Joe Groff
8232d3355b Foundation overlay: Remove unnecessary precondition that array elements be ObjectiveCBridgeable.
This caused a crash when arrays were bridged from ObjC with `Any` or other non-bridged value type elements. Fixes rdar://problem/27905230.
2016-09-07 10:39:05 -07:00
Grzegorz Miłoś
201c19dc98 Review comments, round 3. 2016-09-07 12:14:48 +01:00
Grzegorz Miłoś
dc3369dffe Review comments. Mostly python improvements in symbolicate-linux-fatal(.py). 2016-09-07 12:14:48 +01:00
Grzegorz Miłoś
f068b1eb33 [SR-755] Tool for re-symbolicating fatal stacktraces on Linux. 2016-09-07 12:14:48 +01:00
Dmitri Gribenko
ef974af339 stdlib: disable an incorrect String comparison optimization on platforms that call ICU directly
... and add a test to ensure that the next attempt at writing this
optimization won't introduce a regression.
2016-09-06 22:46:40 -06:00
Dmitri Gribenko
10b339d2cb StdlibUnittest: improve error messages in checkComparable() 2016-09-06 22:46:40 -06:00
Dmitri Gribenko
bfd5942f15 Merge pull request #4621 from apple/siphash
stdlib: switch string hashing on non-ObjC platforms to SipHash-1-3
2016-09-06 21:44:51 -07:00
Dmitri Gribenko
e8e8b35610 stdlib: use SipHash-1-3 for string hashing on non-ObjC platforms
Part of rdar://problem/24109692
2016-09-06 20:41:03 -07:00
Dmitri Gribenko
daa7bfc281 stdlib: add a secret key for hashing 2016-09-06 20:41:03 -07:00
Dmitri Gribenko
532cf06930 stdlib: add convenience APIs to the SipHash implementation 2016-09-06 20:41:03 -07:00
Dmitri Gribenko
e242b4a472 stdlib: implement SipHash-1-3 and SipHash-2-4 2016-09-06 20:41:03 -07:00