Commit Graph

13406 Commits

Author SHA1 Message Date
fredriss
b6077176ee Merge pull request #21904 from compnerd/mirror-mirror-on-the-wall
SwiftRemoteMirror: add a host build for the tools
2019-02-04 14:56:42 -08:00
Scott Perry
b467e24a9e Apply public documentation and type modifications from proposal acceptance 2019-02-04 13:28:36 -08:00
Jordan Rose
b0f5815d2b Merge pull request #20951 from pitiphong-p/encoders-nested-key-edge-case-bug
Reuse the container when requesting for a new nested container with the old key in JSONEncoder and PlistEncoder
2019-02-04 13:19:42 -08:00
Andrew Trick
a557976f95 Remove useless optional unwrap from Unsafe[Raw]BufferPointer subscript.
It is unfortunate that `Unsafe[Raw]BufferPointer._pointer` and
`baseAddress` are declared Optional. This leaves extra runtime checks
in the code in the most performance critical paths. Contrast this with
Array, which uses an sentinal pointer for the empty representation.

This forces us to use _unsafelyUnwrappedUnchecked whenever we just
want to dereference a non-empty buffer pointer.

Fixes SR-9809: swiftc appears to make some sub-optimal optimization choices
2019-02-03 21:25:41 -08:00
Saleem Abdulrasool
d4660ef8c2 Windows: extend WinSDK module further
This extends the WinSDK modulemap to cover Winsock2 and IPHelp API Set.
These are used in Foundation.
2019-02-02 18:50:20 -08:00
Lily Vulcano
337904fb2e Merge pull request #22311 from millenomi/fix_kvo-take-2
Take 2 of “[SDK] Fix multiple issues with Swift KVO”
2019-02-01 17:18:53 -08:00
Mishal Shah
cc78af105f Merge pull request #22274 from apple/update-master-xcode-10.2-beta-1
Update master to build with Xcode 10.2 beta 1
2019-02-01 16:30:58 -08:00
Ben Cohen
95a15d12bd Revert count(where:) (#22289) 2019-02-01 15:05:06 -08:00
Max Moiseev
91d8615cb9 Merge pull request #22275 from airspeedswift/unsafe-conversion
[stdlib] Restore concrete initializers on Unsafe{Raw}Pointer
2019-02-01 15:04:55 -08:00
Lily Vulcano
bdb4686375 Take 2 of “[SDK] Fix multiple issues with Swift KVO”
This reproposes @lilyball’s fixes in https://github.com/apple/swift/pull/20103 while adding her fix to ensure observations are removed before observed objects in 32-bit testing.
2019-02-01 14:07:44 -08:00
Joe Shajrawi
596dfd9dfb Merge pull request #22297 from millenomi/revert-fix_kvo
Simulator build fix — (temporarily) revert "Merge pull request #20103 from lilyball/fix_kvo"
2019-02-01 13:02:56 -08:00
Max Moiseev
556e089d19 Merge pull request #22138 from moiseev/spring-cleaning
[stdlib] Remove a bunch of declarations marked as obsoleted in 4
2019-02-01 11:03:37 -08:00
Lily Vulcano
ac7a93963c Revert "Merge pull request #20103 from lilyball/fix_kvo"
This reverts commit 7c514196fc, reversing
changes made to 2d7c31b24c.

This patch will be reproposed with fixes.
2019-02-01 10:55:06 -08:00
Ben Cohen
c3239b90b4 Neaten breadcrumb cast 2019-01-31 21:09:40 -08:00
Ben Cohen
779ea19a6a Revert count(where:) 2019-01-31 18:57:17 -08:00
Ben Cohen
2010f02e8a Remove overly-permissive UnsafePointer init 2019-01-31 18:05:11 -08:00
Ben Cohen
351c1291a9 Restore concrete initializers on Unsafe{Raw}Pointer 2019-01-31 17:11:16 -08:00
Mishal Shah
42633218c5 Update master to build with Xcode 10.2 beta 1 2019-01-31 14:48:29 -08:00
Maxim Moiseev
714982bd1b Remove access specifiers on some extensions to avoid warnings 2019-01-31 14:36:55 -08:00
Maxim Moiseev
8f5877b994 Fix INParameter availability 2019-01-31 13:43:19 -08:00
Max Moiseev
5da70012db Merge pull request #22244 from moiseev/macos-inimage
Make APIs using INImage unavailable on macOS
2019-01-30 15:53:27 -08:00
Lily Vulcano
b864a7461f Rebase master; move this to use NSSet, not AnyObject. 2019-01-30 13:06:02 -08:00
Lily Ballard
4dd8bcc548 [SDK] Clean up the KVO swizzles slightly 2019-01-30 12:41:14 -08:00
Lily Ballard
fafaa33f9b [SDK] Replace global KeyPath table with a per-thread table
The global table was vulnerable to race conditions when making
observations concurrently on multiple threads. We can assume the
`NSKeyValueObservingCustomization` methods are invoked synchronously
when creating the observation, so we can use a per-thread table instead.
This per-thread table is still vulnerable in the event that an
implementation of `automaticallyNotifiesObservers(for:)` creates a new
observation using a different `KeyPath` with the same Obj-C path, but
this method really shouldn't be creating any observations of its own.

Unfortunately we can't include the class in the per-thread table key, as
this may produce incorrect results in the presence of subclasses.

rdar://problem/45567020 https://bugs.swift.org/browse/SR-9077
2019-01-30 12:41:14 -08:00
Lily Ballard
e5ba2c8356 [SDK] Fix NSSortDescriptor.keyPath
The previous implementation could return keyPaths other than the one
used to create the `NSSortDescriptor` in the event that any subsequent
observation, `NSExpression`, or `NSSortDescriptor` was created using a
different `KeyPath` that had the same Obj-C keypath value.

https://bugs.swift.org/browse/SR-9076
2019-01-30 12:41:13 -08:00
Lily Ballard
82e3171556 [SDK] Fix potential race with NSKeyValueObservation
If the `NSKeyValueObservation` was being deinited on one thread while a
KVO change notice was being broadcast on another, it could end up trying
to handle the change notice concurrently with deiniting, which will
probably crash.

This also fixes a problem where it was swizzling `NSObject`'s
`observeValue(forKeyPath:of:change:context:)` implementation, which
resulted in potentially invoking undefined behavior if an observer ever
called up to `NSObject`'s implementation.

https://bugs.swift.org/browse/SR-9074
https://bugs.swift.org/browse/SR-9075
2019-01-30 12:41:13 -08:00
Lily Ballard
dd51e9d4bb [SDK] Fix thread safety of KVO swizzling
Swizzling the methods in a different order ensures we don't overwrite
the public `NSObject` method until it's safe to call our replacement.

rdar://problem/36663633 https://bugs.swift.org/browse/SR-6795
2019-01-30 12:41:13 -08:00
Maxim Moiseev
af00487bb8 Make APIs using INImage unavailable on macOS
<rdar://problem/47673006>
2019-01-30 11:10:32 -08:00
Slava Pestov
bcdc9e7c50 Merge pull request #22237 from slavapestov/type-reconstruction-part-3
Type reconstruction rework, part 3
2019-01-30 10:49:18 -05:00
John McCall
8be4ec32e6 Protocol requirement overrides must match in mutating-ness.
Without this change, SILGen will crash when compiling a use of the
derived protocol's requirement: it will instead attempt to use
the base protocol's requirement, but the code will have been
type-checked incorrectly for that.

This has a potential for source-compatibility impact if anyone's
using explicit override checking for their protocol requirements:
reasonable idioms like overriding a mutating requirement with a
non-mutating one will no longer count as an override.  However,
this is arguably a bug-fix, because the current designed intent
of protocol override checking is to not allow any differences in
type, even "covariant" changes like making a mutating requirement
non-mutating.  Moreover, we believe explicit override checking in
protocols is quite uncommon, so the overall compatibility impact
will be low.

This also has a potential for ABI impact whenever something that
was once an override becomes a non-override and thus requires a
new entry.  It might require a contrived test case to demonstrate
that while using the derived entry, but it's quite possible to
imagine a situation where the derived entry is not used directly
but nonetheless has ABI impact.

Furthermore, as part of developing this patch (earlier versions of
which used stricter rules in places), I discovered a number of
places where the standard library was unintentionally introducing
a new requirement in a derived protocol when it intended only to
guide associated type deduction.  Fixing that (as I have in this
patch) *definitely* has ABI impact.
2019-01-30 01:33:09 -05:00
Slava Pestov
36d3f47388 ASTDemangler: Preserve generic arguments for bound generic Objective-C classes
MetadataLookup gives special treatment to imported Objective-C classes,
since there's no nominal type descriptor and metadata is obtained
directly by calling into the Objective-C runtime.

Remote reflection also gives special treatment to imported Objective-C
classes; they don't have field descriptors.

However, the ASTDemangler needs to treat them like ordinary classes,
in particular it wants to preserve the generic arguments here so that
we can round-trip debug info.
2019-01-30 01:28:48 -05:00
Slava Pestov
d29b545870 Merge pull request #22185 from slavapestov/type-reconstruction-part-2
Type reconstruction rework, part 2
2019-01-30 00:13:01 -05:00
Slava Pestov
4a74bf4ba1 ASTDemangler: Add support for lowered function types 2019-01-29 21:55:57 -05:00
swift-ci
eb44285914 Merge pull request #22233 from DougGregor/foundation-error-bridging-info-rename 2019-01-29 18:15:49 -08:00
Doug Gregor
30a6c0fac1 [Foundation] Rename swift_errorBridgingInfo so it doesn't conflict with pre-stable ABI Swift
Fixes rdar://problem/47651565
2019-01-29 17:22:31 -08:00
Maxim Moiseev
d00307202b Uncomment 'obsoleted: 5.0' on a flatMap variant 2019-01-29 16:26:46 -08:00
Slava Pestov
13a50c2d2d ASTDemangler: Add support for lowered metatypes 2019-01-29 19:15:17 -05:00
Slava Pestov
fce933910d ASTDemangler: Implement types in generic local context
If we nest a type inside a local context inside a generic type,
we have to look through the local context(s) to find the outer
generic type when stripping off generic arguments.

We don't support nominal types inside generic local context
right now, but this can happen with type aliases.
2019-01-29 19:15:17 -05:00
Maxim Moiseev
02cc2256e9 [stdlib] Remove a bunch of declarations marked as obsoleted in 4 2019-01-29 11:13:47 -08:00
Michael Munday
6ab83122ac Fix storeEnumTagSinglePayload on big-endian systems
The part of the tag stored in the payload can currently be up to
8 bytes in size (though only the 'low' 4 bytes can be non-zero).
On little-endian machines this doesn't matter, we can always just
store up to 4 bytes and zero the remaining payload bytes. On big-
endian systems however we may need to store more than 4 bytes.

The store implementation now mirrors the runtime code that fetches
the tag on big-endian systems which already treats the payload tag
as an 8 byte integer.

This is a spot fix but longer term we might want to consider
refactoring this code to reduce the number of differences between
big- and little-endian implementations. For example, we could
centralise some of the copying logic and/or make the payload tag
a 4 byte field on all platforms.
2019-01-29 08:11:04 -05:00
Saleem Abdulrasool
85f45dfe30 SwiftRemoteMirror: add a host build for the tools
This adds an explicit version of the SwiftRemoteMirror library for use
in the tools that comprise the toolchain.  This is a separate build from
the target specific builds of the library even though we may be building
the runtime for the (same) host.
2019-01-28 18:00:58 -08:00
Saleem Abdulrasool
18a59bc7a0 Merge pull request #22153 from compnerd/winsdk
WinSDK: extend the module definition for Foundation
2019-01-28 12:38:59 -08:00
swift-ci
8458f10a40 Merge pull request #22150 from DougGregor/remote-ast-extensions 2019-01-28 09:05:45 -08:00
Doug Gregor
2a3b237a82 [swift-reflection-test] Strings read here are not always valid UTF-8.
The “string length” primitive was validating the string data as valid UTF-8
to get the length. However, mangled names, which get read by this operation,
are not always valid UTF-8. Just count the bytes until a ‘0’ and don’t
validate.
2019-01-27 22:03:37 -08:00
Saleem Abdulrasool
c1da7a206a WinSDK: extend the module definition for Foundation
Update the module definition to extend it to support stack symbolication
for use in Foundation.
2019-01-26 10:52:10 -08:00
Arnold Schwaighofer
bcc7588db9 Merge pull request #22125 from aschwaighofer/workaround_dynamic_replacement_failure
DynamicReplacement: Don't fail when a library is closed and reloaded
2019-01-26 07:57:06 -08:00
Slava Pestov
b6951932b4 ASTDemangler: Implement type alias types
Debug info uses a special mangling where type aliases can be
represented without being desugared; attempt to reconstruct
the TypeAliasType in this case.
2019-01-25 21:59:48 -05:00
Ravi Kandhadai
ee222c3fdf [Constant Evaluator] Add support for string appends and equals to
the constant evaluator.
2019-01-25 18:51:33 -08:00
Slava Pestov
55605ceab9 ASTDemangler: Implement DynamicSelfType 2019-01-25 21:44:02 -05:00
Slava Pestov
bbe6a56e22 ASTDemangler: Implement builtin types 2019-01-25 21:44:02 -05:00