Commit Graph

14787 Commits

Author SHA1 Message Date
Konrad `ktoso` Malawski
0857d0f62b remove last mention of spawnDetached 2021-04-03 10:08:11 +09:00
Konrad `ktoso` Malawski
a5ac6f06fa [Concurrency] detach, spawnUnlessCancelled, priority param cleanup 2021-04-03 09:54:42 +09:00
Konrad `ktoso` Malawski
34f8e768b5 spawnDetached to detach, non-suspending group.spawn, spawnUnlessCancelled 2021-04-03 09:53:32 +09:00
Konrad `ktoso` Malawski
6e746304e1 [Concurrency] Update Task and Group APIs based on Review 1 2021-04-03 09:52:03 +09:00
Michael Ilseman
f495c02afe Merge pull request #36667 from milseman/small_differential
[stdlib] Fix bug in small string uninitialized init
2021-04-02 16:46:51 -06:00
Alexis Laferrière
36f7f1bc87 [SwiftShims] Make the void* arguments of memcmp _Nullable on Darwin
This should correspond to the definition of memcmp in
usr/include/string.h and keep it from being a source of confusion for
the compiler.

rdar://69876253
2021-04-02 10:38:50 -07:00
Xiaodi Wu
cef11cd82e [stdlib][NFC] Final renamings for new integer parsing implementations. 2021-04-02 10:20:04 -04:00
Karoy Lorentey
63d0b734c0 Merge pull request #36669 from lorentey/fix-float16-sendable
[stdlib] Float16/Intel: Add an explicit Sendable conformance to work around a swiftinterface issue
2021-04-02 01:37:07 -07:00
Alex Martini
4b3064ede5 Simplify prose in doc comment.
Incorporates PR feedback from @tbkka.
2021-04-01 16:05:48 -07:00
Alex Martini
1bfce98e8d Revise finite/infinite note for NaN.
Incorporates PR feedback from @tbkka.
2021-04-01 16:05:48 -07:00
Xiaodi Wu
c40c90402a [stdlib] Address reviewer comments and make some minor edits to string-to-integer parsing. 2021-04-01 13:03:56 -04:00
Mike Ash
1173b737aa [Concurrency] Add availability to Concurrency APIs.
This allows programs to target older OSes while using Concurrency behind an availability check. When targeting older OSes, the symbols are weak-linked and the compiler will require the use of Concurrency features to be guarded by an availability check.

rdar://75850003
2021-04-01 10:42:08 -04:00
Slava Pestov
7d46760afb Merge pull request #36614 from slavapestov/reasync-logical-operators
stdlib: Add reasync variants of '&&', '||' and '??'
2021-04-01 10:10:32 -04:00
Karoy Lorentey
cb67f45394 [stdlib] Float16: Add explicit Sendable conformance to work around swiftinterface issue 2021-04-01 00:51:14 -07:00
Doug Gregor
e69df4ef4f Merge pull request #36668 from DougGregor/feature-check-inlined-text 2021-03-31 20:51:25 -07:00
Slava Pestov
c473869141 stdlib: Add reasync variants of '&&', '||' and '??'
Fixes rdar://problem/72770687.
2021-03-31 19:21:08 -04:00
Mike Ash
6d4015e3c7 Merge pull request #36652 from mikeash/getobjcclassmetadata-improvement
[Runtime] Make debug builds accept NULL in swift_getObjCClassMetadata.
2021-03-31 17:40:49 -04:00
Dario Rexin
1ae371b470 Re-add dependency on libatomic for 32-bit Linux platforms (#36659) 2021-03-31 13:31:58 -07:00
Dario Rexin
3daf37f221 [Concurrency] Use correct type for Task.Handle in Task.sleep (#36654) 2021-03-31 12:45:44 -07:00
Mike Ash
e98fc3e304 Merge pull request #36572 from mikeash/async-task-dispatch-integration2
[Concurrency] Make Job objects work as Dispatch objects.
2021-03-31 09:42:58 -04:00
Karoy Lorentey
ec7258e2fc [stdlib] Fix incorrect Float16 extension
This extension (introduced in https://github.com/apple/swift/pull/35264) was placed in a file location where it wasn’t correctly guarded against mentioning Float16 on macOS/x86_64, so the generated .swiftinterface file included a reference to an unavailable declaration. (The dummy stand-in Float16 type that we currently use on Intel macOS.)

Moving the declaration out of the “AnyHashable” section and into a file region that’s more suitable for it (i.e., enclosed in `#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))`) resolves the issue.

rdar://76025365
2021-03-30 18:43:16 -07:00
Doug Gregor
492bca113d [Module interface] Retain #if's with feature checks in inline bodies. 2021-03-30 17:56:42 -07:00
Michael Ilseman
49eddbf318 [stdlib] Fix bug in small string uninitialized init
Fix a bug and enforce the invariant that all bits between the last code unit
and the descriminator in a small string should be unset.
2021-03-30 18:24:28 -06:00
Doug Gregor
46c9de8ba8 [Concurrency] Work around issue with old compilers and newer _Concurrency lib
Fixes rdar://75996690.
2021-03-30 16:27:08 -07:00
Richard Wei
d997526948 Fix function differentiability kind metadata and mangling. (#36601)
* Move differentiability kinds from target function type metadata to trailing objects so that we don't exhaust all remaining bits of function type metadata.
  * Differentiability kind is now stored in a tail-allocated word when function type flags say it's differentiable, located immediately after the normal function type metadata's contents (with proper alignment in between).
  * Add new runtime function `swift_getFunctionTypeMetadataDifferentiable` which handles differentiable function types.
* Fix mangling of different differentiability kinds in function types. Mangle it like `ConcurrentFunctionType` so that we can drop special cases for escaping functions.
    ```
    function-signature ::= params-type params-type async? sendable? throws? differentiable? // results and parameters
    ...
    differentiable ::= 'jf'                    // @differentiable(_forward) on function type
    differentiable ::= 'jr'                    // @differentiable(reverse) on function type
    differentiable ::= 'jd'                    // @differentiable on function type
    differentiable ::= 'jl'                    // @differentiable(_linear) on function type
    ```

Resolves rdar://75240064.
2021-03-30 09:59:06 -07:00
Mike Ash
8743ebd9ea [Runtime] Make debug builds accept NULL in swift_getObjCClassMetadata.
The previous fix here switched dyn_cast for dyn_cast_or_null, but this left us with an assertion failure in cast<>. Instead, explicitly check for NULL at the top of the function.
2021-03-30 12:45:29 -04:00
Xiaodi Wu
5d943f46bd [stdlib] Further simplify string-to-integer parsing and change some inlining choices. 2021-03-29 12:08:28 -04:00
Xiaodi Wu
0319bdc966 [gardening] Fix tab size inconsistency. 2021-03-29 11:30:48 -04:00
Xiaodi Wu
529891c911 [stdlib] Simplify implementation of string-to-integer parsing. 2021-03-29 11:27:21 -04:00
Xiaodi Wu
ebad4bbb5d [stdlib] Specialize FixedWidthInteger.init(_:radix:). 2021-03-29 10:19:22 -04:00
Xiaodi Wu
cc8a351cc1 [stdlib] Never inline two more string-to-integer parsing methods. 2021-03-29 09:02:41 -04:00
Xiaodi Wu
7c333b8e44 [stdlib] Never inline fallback helper methods when parsing strings to integers. 2021-03-28 22:22:50 -04:00
Xiaodi Wu
a9c57c3bcd [stdlib] Make FixedWidthInteger.init?(_:radix:) always inlined, and fix a think-o. 2021-03-28 20:44:11 -04:00
Xiaodi Wu
ad992f48dd [stdlib][SR-7556] Re-implement string-to-integer parsing. 2021-03-28 16:49:09 -04:00
John McCall
98711fd628 Revise the continuation ABI.
The immediate desire is to minimize the set of ABI dependencies
on the layout of an ExecutorRef.  In addition to that, however,
I wanted to generally reduce the code size impact of an unsafe
continuation since it now requires accessing thread-local state,
and I wanted resumption to not have to create unnecessary type
metadata for the value type just to do the initialization.

Therefore, I've introduced a swift_continuation_init function
which handles the default initialization of a continuation
and returns a reference to the current task.  I've also moved
the initialization of the normal continuation result into the
caller (out of the runtime), and I've moved the resumption-side
cmpxchg into the runtime (and prior to the task being enqueued).
2021-03-28 12:58:16 -04:00
Mike Ash
0989524338 [Concurrency] Make Job objects work as Dispatch objects.
Fill out the metadata for Job to have a Dispatch-compatible vtable. When available, use the dispatch_enqueue_onto_queue_4Swift to enqueue Jobs directly onto queues. Otherwise, keep using dispatch_async_f as we have been.

rdar://75227953
2021-03-26 18:31:00 -04:00
Michael Gottesman
209878fa4b Merge pull request #36570 from gottesmm/pr-bb21aa718f0576a56298e737b1282bf7727788aa
[cmake] Add support for building the swift stdlib with LTO.
2021-03-26 12:41:23 -07:00
Doug Gregor
4ca8a66fc5 Merge pull request #36590 from jckarter/task-cancellation-handler-abi
Fix calling convention for withCompletionHandler runtime calls.
2021-03-25 21:49:29 -07:00
Joe Groff
698a975a23 Merge pull request #36586 from jckarter/owned-task-spawn-closures
Allow closures to be `__owned` or `__shared`, and make task spawning closures `__owned`
2021-03-25 16:02:07 -07:00
Joe Groff
4150b31954 Fix calling convention for withCompletionHandler runtime calls.
rdar://75370240
2021-03-25 14:45:47 -07:00
Joe Groff
c6691f3919 Allow closures to be __owned or __shared, and make task spawning closures __owned 2021-03-25 11:36:33 -07:00
Nate Cook
86b69b98cc Fix license headers in concurrency source files 2021-03-25 10:12:02 -05:00
Stephen Canon
09cd45d4c2 Remove a small helper function that took a Builtin.VecNxInt1 type.
It saved some boilerplate, but if it doesn't get inline (as in debug builds), Swift doesn't know how to legalize the type at the call boundary, and we crash.
2021-03-24 23:34:28 -04:00
Stephen Canon
5afe404707 Concrete simd mask operations (#36571)
* Replace lhs/rhs with a/b for clarity of documentation and to match concrete ops.

* Concretize additional SIMDMask operations:

.&=, .|=, .^=, .==, .!=

Also reflect documentation changes back to generic implementations.
2021-03-24 23:15:46 -04:00
Michael Gottesman
24f6c799b6 [cmake] Add support for building the swift stdlib with LTO.
This is controlled with the option SWIFT_STDLIB_ENABLE_LTO=thin|full.
2021-03-24 12:18:35 -07:00
Mike Ash
c4e4e44f71 Merge pull request #36390 from mikeash/concurrency-compatibility-overrides
[Concurrency] Add compatibility overrides to Concurrency library.
2021-03-24 13:07:07 -04:00
Evan Wilde
3f97abf76c Merge pull request #36557 from etcwilde/ewilde/expunge-actor-class-diagnostics
[concurrency] Expunge 'actor class' from diagnostics
2021-03-24 08:34:29 -07:00
Mike Ash
e770154e02 Merge pull request #36555 from mikeash/swift_getObjCClassFromMetadata-nil-check
[Runtime] Accept nil in swift_getObjCClassFromMetadata.
2021-03-23 22:51:34 -04:00
Evan Wilde
42b6918657 NFC: Expunge 'actor class' in comments 2021-03-23 15:06:40 -07:00
Mike Ash
dc7d838853 [Runtime] Accept nil in swift_getObjCClassFromMetadata.
Somehow, clang was generating code that accepted nil and returned nil in swift_getObjCClassFromMetadata, but is no longer doing so. Some code relies on this to work, so switch to dyn_cast_or_null to accept nil explicitly.

rdar://74895271
2021-03-23 16:01:58 -04:00