Commit Graph

5543 Commits

Author SHA1 Message Date
Julian Lettner
381dcc24fc [TSan] Do not report benign race on _swiftEmptyArrayStorage
A previous commit [1] identified and fixed a benign race on
`_swiftEmptyArrayStorage`.  Unfortunately, we have some code duplication
and the fix was not applied to all the necessary places.  Essentially,
we need to ensure that the "empty array storage" object that backs many
"array like types" is never written to.

I tried to improve the test to capture this, however, it is very
finicky.  Currently, it does not go red on my system even when I remove
the check to avoid the benign race in Release mode.

Relevant classes: Array, ArraySlice, ContiguousArray, ArrayBuffer,
ContiguousArrayBuffer, SliceBuffer.

[1] b9b4c789f3

rdar://55161564
2019-10-21 11:22:25 -07:00
David Smith
a1c1779c9f Guard against passing endIndex to foreignScalarAlign when back-deploying to 5.0 stdlibs 2019-10-18 14:24:23 -07:00
swift-ci
a91d4aaa52 Merge pull request #27670 from Catfish-Man/fastscii-2 2019-10-15 18:39:45 -07:00
David Smith
007ff00617 Add fast paths for String(decoding:…, as: Unicode.ASCII.self) 2019-10-15 17:26:23 -07:00
Dan Zheng
2bd55f6755 [Autodiff upstream] Add build-script flag for differentiable programming. (#27595)
Add `--enable-experimental-differentiable-programming` build-script flag.

The build-script flag enables/disables standard library additions
related to differentiable programming. This will allow official Swift
releases to disable these additions.

The build-script flag is on by default to ensure testing of
differentiable programming standard library additions. An additional
driver flag must be enabled to use differentiable programming features:
https://github.com/apple/swift/pull/27446
2019-10-14 14:34:48 -07:00
David Smith
3d321c1905 Fix the new Swift NSMutableArray subclass to match edge case behavior in two more cases 2019-10-02 15:47:51 -07:00
own2pwn
3ec5e76ee3 Update FloatingPointTypes.swift.gyb (#27461)
Corrects intent that this type seems to be available only on MacOS targets.
2019-10-02 15:41:42 -04:00
swift-ci
d1c87f3c93 Merge pull request #24270 from natecook1000/nc_lazyscan_fix 2019-09-28 20:53:45 -07:00
Nate Cook
f6547cc828 Address feedback from @amartini51. 2019-09-26 13:25:15 -05:00
David Smith
1cce12f20c Add an Array-based NSMutableArray subclass 2019-09-24 18:15:33 -07:00
David Smith
90037745ad Add C calling convention shims for creating arrays and strings from buffers 2019-09-24 13:06:54 -07:00
David Smith
b8fb2e5eae Merge pull request #27155 from Catfish-Man/shim-shim-sher-ee-2
Remove stdlib and runtime dependencies on Foundation and CF
2019-09-13 09:43:38 -07:00
Doug Gregor
5285afdbe6 [SIMD] Use @_alwaysEmitIntoClient rather than @_transparent 2019-09-12 21:31:36 -07:00
David Smith
1efa946caf Remove stdlib and runtime dependencies on Foundation and CF 2019-09-12 18:03:14 -07:00
Doug Gregor
87516934cd [SIMD] Add disambiguating += and -= operators.
The introduction of += and -= default implementations on
AdditiveArithmetic introduces an ambiguity with the += and -=
implementations on SIMD (where Scalar: FloatingPoint). Break the
ambiguity by adding another set of definitions of += and -= on
AdditiveArithmetic & SIMD where Self.Scalar: FloatingPoint.

Fixes rdar://problem/55278156.
2019-09-12 17:54:46 -07:00
Nate Cook
06102a9ffa Minor additional revisions 2019-09-11 10:09:55 -05:00
Karoy Lorentey
9638e9167c [doc] ManagedBuffer: Fix cross-reference to isKnownUniquelyReferenced 2019-09-10 18:52:26 -07:00
Karoy Lorentey
6bc4c85005 [doc] Avoid use of “iff” in public API documentation 2019-09-10 18:52:01 -07:00
Nate Cook
ce28cdee93 Update the error message when subscripting String with Int. (#27069)
Instead of referring to a doc comment that isn't really accessible to the
developer, let's be accurate about what type they should be using here.
2019-09-10 12:23:09 -05:00
swift-ci
b8f42d6165 Merge pull request #26466 from nvzqz/is_concrete_builtin 2019-08-28 19:10:37 -07:00
swift-ci
7039277e4d Merge pull request #26906 from amartini51/master 2019-08-28 13:44:31 -07:00
swift-ci
f804efd5af Merge pull request #25430 from natecook1000/nc-prefixwhile-degyb 2019-08-28 13:21:05 -07:00
Nate Cook
55f9be3291 Switch "may" to "might" per comments from @amartini51. 2019-08-28 13:37:00 -05:00
Alex Martini
64c32f3331 Add missing ) and code voice.
rdar://problem/46680213
2019-08-28 10:36:34 -07:00
Michael Gottesman
447f00892a [ownership] Enable ownership lowering on overlays. I still need to flip the switch to enable this on the tests/rest of the world. 2019-08-27 18:26:15 -07:00
Nikolai Vazquez
6e542bf22a Annotate Swift._isConcrete with @_transparent
Returns `false` otherwise in Debug builds because it is generic.
2019-08-27 16:51:09 -07:00
Nikolai Vazquez
890409effd Elaborate in docs for Swift._isConcrete 2019-08-27 16:51:09 -07:00
Nikolai Vazquez
ba0612f2e9 Add Builtin.isConcrete<T>(T.Type) -> Int1
Returns `true` if `T.Type` is known to refer to a concrete type. The
implementation allows for the optimizer to specialize this at -O and
eliminate conditional code.

Includes `Swift._isConcrete<T>(T.Type) -> Bool` wrapper function.
2019-08-27 16:51:09 -07:00
Karoy Lorentey
895f13657f Merge pull request #26760 from lorentey/♪-hold-me-use-me-autorelease-me-♬
[stdlib] AutoreleasingUnsafeMutablePointer: eliminate questionable pointer use
2019-08-27 10:22:04 -07:00
Arnold Schwaighofer
fe69a86929 Revert "Remove stdlib and runtime dependencies on Foundation and CF"
It is causing bots to fail.

* Revert "The __has_include(<os/system_version.h>) branch here wasn't quite right, we'll just use the dlsym one for now"

This reverts commit f824922456.

* Revert "Remove stdlib and runtime dependencies on Foundation and CF"

This reverts commit 3fe46e3f16.

rdar://54709269
2019-08-26 13:00:08 -07:00
Steve (Numerics) Canon
273616f513 Remove BuiltinMath funcs for Float80/Android
These were previously removed in SE-0246, so they weren't modified when Float80 was removed elsewhere on Android. Reverting SE-0246 on master triggers an Android break.
2019-08-24 21:48:15 -04:00
swift-ci
3256392211 Merge pull request #26630 from Catfish-Man/shim-shim-sher-ee 2019-08-23 17:08:59 -07:00
David Smith
3fe46e3f16 Remove stdlib and runtime dependencies on Foundation and CF 2019-08-23 14:10:23 -07:00
Stephen Canon
d80b1d39a3 Backout SE-0246 (#26809)
* Revert "Add availability information to the new Math function protocols (#24187)"

This reverts commit d2f695935f.

* Revert "SE-0246: Protocols and static functions (#23824)"

This reverts commit 57a4553832.

* Expected abi changes.
2019-08-23 16:41:17 -04:00
Karoy Lorentey
b8dc0f4735 [stdlib] AutoreleasingMutableUnsafePointer: switch to _unsafeReferenceCast for extra validation 2019-08-22 14:25:19 -07:00
Nate Cook
90f9dd480e Merge branch 'master' into nc_lazyscan_fix 2019-08-22 10:47:47 -05:00
Nate Cook
3dcdd451a6 [stdlib] Revisons to lazy prefix documentation. 2019-08-22 10:42:42 -05:00
Karoy Lorentey
88630e8ea3 [stdlib] AutoreleasingUnsafeMutablePointer: use typed pointers rather than UnsafeRawPointer
This improves code generation in -Onone mode. (UnsafeRawPointer.load/.storeBytes isn’t @_transparent and it doesn’t get specialized in unoptimized builds.)
2019-08-21 18:43:57 -07:00
Karoy Lorentey
b9e3ada255 [stdlib] Make Unmanaged.takeUnretainedValue, .takeRetainedValue transparent
This improves codegen in debug builds.
2019-08-21 18:31:28 -07:00
Karoy Lorentey
61c5ac118d [stdlib] AutoreleasingUnsafeMutablePointer: update docs 2019-08-21 18:25:55 -07:00
Alex Martini
f040edaa85 Typo fix: of of -> of
rdar://problem/54218099
2019-08-21 10:40:18 -07:00
Karoy Lorentey
6a92bb9e2e [stdlib] AutoreleasingUnsafeMutablePointer: eliminate questionable pointer use
AutoreleasingUnsafeMutablePointer is pointing to a +0 reference, but in its pointee property’s getter/setter implementations, it is loading the pointer into regular Unsafe[Mutable]Pointers. Those are assuming that the addressed memory contain a +1 reference, which can mislead the compiler into doing optimizations that aren’t valid.

Change the getter/setter implementations so that they use UnsafeRawPointer and load/store Unmanaged values instead. As long as Unmanaged.passUnretained(_:) and Unmanaged.takeUnretainedValue() do the right thing, then AutoreleasingUnsafeMutablePointer won’t have issues, either. (This boils down to ensuring that loading a strong reference out of an unmanaged(unsafe) value works correctly.)
2019-08-20 20:15:49 -07:00
swift-ci
5f80f77343 Merge pull request #26747 from natecook1000/nate/doc_copymemory_backwards 2019-08-20 12:49:57 -07:00
Nate Cook
15f78fc7af Document that raw copyMemory methods handle overlapping memory. 2019-08-20 13:15:20 -05:00
Greg Titus
dd4c6053a7 Warning fixes for core stdlib. 2019-08-15 10:14:50 -07:00
David Smith
bd3643a1b2 Merge pull request #26588 from Catfish-Man/shadow-backflip
Re-shim tagged NSString creation
2019-08-12 18:01:23 -07:00
David Smith
f559a94f1b Redo CFStringCreateWithBytes shim 2019-08-12 15:15:10 -07:00
Michael Gottesman
bd4953475a [ownership] Compile stdlibCore with ownership stripping after serialization. 2019-08-12 03:32:59 -07:00
Scott Perry
15904df5d4 Review feedback from @lorentey 2019-08-10 09:30:25 -07:00
Scott Perry
e01e964dd9 Review feedback from @xwu 2019-08-09 12:35:32 -07:00