Commit Graph

21434 Commits

Author SHA1 Message Date
Alastair Houghton
31df4edb7c [Concurrency] Add a test for the new custom executor feature.
Added an executor implementation and a test that tries to use it.
Also fix up a few issues in `ExecutorImpl.h`.

rdar://135380149
2024-09-30 17:15:40 +01:00
Alastair Houghton
4ef4305f13 [Concurrency] Install ExecutorImpl.h in include/swift in toolchain.
When Embedded Concurrency is enabled, install `ExecutorImpl.h` in the
`include/swift` directory in the toolchain.

rdar://135380149
2024-09-30 17:15:40 +01:00
Alastair Houghton
26b5fa697a [Concurrency] Rename ExecutorHooks.h, tidy up the interface.
`ExecutorHooks.h` is now nothing to do with hooks, so rename it.  Also
there are some additional functions it should declare, and a couple of
places where we've slightly messed up the boundary, for instance
`swift_task_asyncMainDrainQueue` was defined in `Task.cpp` rather than
in the executor implementations, which is wrong, so fix that too.

`CooperativeGlobalExecutor.cpp` now builds against the interface from
`ExecutorImpl.h`, rather than including the all the concurrency headers.

rdar://135380149
2024-09-30 17:15:40 +01:00
Alastair Houghton
efe5d660f2 [Concurrency] Refactor executors so they are in their own object module.
C++ executor implementations were `#include`ed into `GlobalExecutor.cpp`,
which makes it difficult to replace the global executor when using the
Embedded Concurrency library.  Refactor things so that they build into
separate objects, which means replacing them is just a matter of writing
the relevant functions yourself.

rdar://135380149
2024-09-30 17:15:38 +01:00
Joe Groff
4b3931c8ce Merge pull request #76734 from jckarter/atomic-layout-runtime
Runtime: Set 'is not bitwise borrowable' bit for raw layout types.
2024-09-30 05:53:43 -10:00
nate-chandler
ba8f8ea282 Merge pull request #76526 from nate-chandler/general-coro/20240906/1
[CoroutineAccessors] Initial framing.
2024-09-30 07:04:04 -07:00
Konrad `ktoso` Malawski
45b97f146b Merge branch 'main' into wip-experimental-isolated-deinit 2024-09-30 13:47:39 +09:00
Mykola Pokhylets
aeb71c4cb4 Disable retain count checks in actor deinit for embedded runtime 2024-09-30 03:41:40 +01:00
Kuba Mracek
f1c2334c9a [Concurrency] Enable TaskGroup/DiscardingTaskGroup in Embedded Swift 2024-09-28 17:52:05 -07:00
Amritpan Kaur
6066418340 Merge pull request #73242 from amritpan/metatype-kp-implementation 2024-09-28 02:46:15 -07:00
Ben Barham
684166e24c [embedded] Skip C++ stdlib for unicode stubs
`stdint.h` should be picked up from `clang/lib/Headers`, but is instead
being picked up by the system libc++. There's no C++ stdlib being used
here, so just exclude it.

Resolves rdar://134584685.
2024-09-27 21:19:16 -07:00
Mike Ash
33f1860db9 Merge pull request #76757 from mikeash/fromTaskExecutorPreference-before-enqueue
[Concurrency] Fix crash from calling fromTaskExecutorPreference after enqueueing job.
2024-09-27 23:08:59 -04:00
Kuba (Brecka) Mracek
39161a2cc8 Merge pull request #76751 from kubamracek/embedded-none-macho-arm64e
[embedded] Also build arm64e on top of arm64 for -apple-none-macho triple
2024-09-27 17:35:50 -07:00
Mike Ash
efa62e7c33 [Concurrency] Fix crash from calling fromTaskExecutorPreference after enqueueing job.
After we've enqueued a job, another thread may run it and destroy it. Don't try to get the job's task executor preference when we try to schedule it. Instead, get the task executor preference before enqueueing the job, then use that preference when scheduling if necessary. Since getting the executor preference is potentially somewhat expensive (we need to search the status records for an executor preference record), only do this if the pre-compare-and-swap states look like they'll need it.

rdar://136281920
2024-09-27 17:32:29 -04:00
Joe Groff
6e565b52ba Runtime: Set 'is not bitwise borrowable' bit for raw layout types.
When initializing metadata for layout-dependent raw layout types, set the
"is not bitwise borrowable" bit.
2024-09-27 11:27:47 -07:00
Kuba Mracek
eb1f9f74c5 [embedded] Also build arm64e on top of arm64 for -apple-none-macho triple 2024-09-27 10:12:53 -07:00
Philippe Hausler
4f53f189e0 [Embedded] Enable RangeSet for embedded targets (#76614) 2024-09-27 09:20:11 -07:00
Egor Zhdan
fcb590690e [cxx-interop] Support char8_t C++20 type
https://en.cppreference.com/w/cpp/keyword/char8_t

This is based on a patch from Varun Gandhi: https://github.com/swiftlang/swift/pull/26153

rdar://39988329 / resolves https://github.com/swiftlang/swift/issues/68726
2024-09-27 13:56:03 +01:00
Mike Ash
0d747d4d2b Merge pull request #76498 from mikeash/lazy-realization-support
[Runtime] Support lazy ObjC realization of Swift classes.
2024-09-27 00:10:17 -04:00
Nate Chandler
091368ba21 [CoroutineAccessors] Added read.
The name is a placeholder for the mutating single-yield coroutine
accessor.
2024-09-26 18:10:39 -07:00
Nate Chandler
98a2e6a7df [CoroutineAccessors] Added modify.
The name is a placeholder for the mutating single-yield coroutine
accessor.
2024-09-26 18:10:39 -07:00
Amritpan Kaur
1c494c4d89 [StdLib] Handle nil property descriptors. 2024-09-25 12:54:52 -07:00
Kuba (Brecka) Mracek
d3c5149714 Merge pull request #76658 from kubamracek/embedded-managed-buffer
[embedded] Add support for ManagedBuffer to Embedded Swift
2024-09-25 02:54:55 -07:00
Kuba Mracek
0b50c2155e Don't emit upcast to the same type in SimplifyAllocRefDynamic, add test, add comment 2024-09-24 08:48:51 -07:00
Justice Adams
579d2bc942 set install dir correctly for libSwiftRemoteMirror 2024-09-23 15:34:18 -07:00
Kuba Mracek
c7a5569c4f [embedded] Add support for ManagedBuffer to Embedded Swift
This makes ManagedBuffer available and usable in Embedded Swift, by:

- Removing an internal consistency check from ManagedBuffer that relies on metatypes.
- Making the .create() API transparent (to hoist the metatype to the callee).
- Adding a AllocRefDynamicInst simplification to convert `alloc_ref_dynamic` to `alloc_ref`, which removes a metatype use.
- Adding tests for the above.
2024-09-23 13:32:50 -07:00
Konrad `ktoso` Malawski
b9319d80f1 Merge branch 'main' into wip-experimental-isolated-deinit 2024-09-23 09:01:06 +09:00
Konrad `ktoso` Malawski
62b04be2fa Revert "Revert "[Distributed] remote calls over-retain returned values"" 2024-09-21 14:50:35 +09:00
Konrad `ktoso` Malawski
9779137dc9 Revert "[Distributed] remote calls over-retain returned values" 2024-09-21 13:58:43 +09:00
Konrad `ktoso` Malawski
3f371fd0a6 Merge pull request #76595 from ktoso/wip-release-dist-execute-return
[Distributed] remote calls over-retain returned values
2024-09-21 08:21:38 +09:00
Tim Kientzle
5d5627ae82 Merge pull request #76586 from tbkka/tbkka-enum-with-CF
Better support CoreFoundation types in RemoteMirror
2024-09-20 13:09:26 -07:00
Meghana Gupta
961e6ea104 Merge pull request #76294 from meg-gupta/rewritenext
Rewrite UnsafeRawBufferPointer.Iterator.next
2024-09-20 12:10:39 -07:00
Konrad `ktoso` Malawski
d89347bed0 Merge branch 'main' into wip-experimental-isolated-deinit 2024-09-20 18:34:45 +09:00
Konrad `ktoso` Malawski
b3c5bc47fe Merge pull request #76560 from amartini51/task_docs_style 2024-09-20 15:06:12 +09:00
Konrad `ktoso` Malawski
a12420a739 [Distributed] Must deinitialize return value of remoteCall
resolves rdar://136338200
resolves rdar://136313477
2024-09-20 14:33:46 +09:00
Guillaume Lessard
af262949a9 Merge pull request #76583 from glessard/nc-generics-annotation-cleanup
[gardening] remove obsolete annotations
2024-09-19 19:33:24 -07:00
Tim Kientzle
da5383c4c3 Better support CoreFoundation types in RemoteMirror
This plugs a hole where we failed to recognize a CF type when it
appeared as the payload of an enum stored as a property.  Curiously,
RemoteMirror is able to reflect this when the enum appears by itself,
just not when it's stored as a property.

The simplest fix is to hook into the TypeInfo calculation which
computes a TypeInfo (basically, the tree of fields) from a TypeRef
(basically, the name of the type, including generic context).
Specifically, we sometimes end up here with a "type alias" that
none of the lookup support seems to be able to handle.  Fortunately,
these aliases demangle into a pretty predictable shape, so this
just pattern-matches the specific demangle tree shape to recognize
these as "type aliases in the `__C` module whose name starts with `CF`
and ends with `Ref`".

Resolves rdar://82465109
2024-09-19 13:50:41 -07:00
Guillaume Lessard
a35dea18c5 [gardening] remove obsolete annotations 2024-09-19 12:56:31 -07:00
Alex Martini
44ecc6325f Revise for documentation style
- Use the spelling "canceled" per Apple Style Guide
- Use code voice for symbol name
- Use contractions
- Avoid parenthesis for asides
- Change "it" to "that function" to reduce ambiguity
2024-09-18 15:42:14 -07:00
Alastair Houghton
0963036734 [Build] Make sure we declare LINUX_STATIC dependencies on Musl.
Everywhere there's a `SWIFT_MODULE_DEPENDS_LINUX Glibc`, there should be
a corresponding `SWIFT_MODULE_DEPENDS_LINUX_STATIC Musl`.

This usually won't bite us, depending on build order and parallelism, but
I hit one of these yesterday so went looking to see if there were any
others.

rdar://136208589
2024-09-18 09:40:58 +01:00
Konrad `ktoso` Malawski
fc03688e63 Merge pull request #76508 from swiftlang/ktoso-patch-17 2024-09-18 13:17:26 +09:00
Konrad `ktoso` Malawski
57bf319577 Update Task.swift 2024-09-18 09:38:02 +09:00
Konrad `ktoso` Malawski
6c8d0c9e1b Apply suggestions from code review
Co-authored-by: Alex Martini <amartini@apple.com>
2024-09-18 09:29:04 +09:00
Konrad `ktoso` Malawski
5e29d51674 Apply suggestions from code review
Co-authored-by: Alex Martini <amartini@apple.com>
2024-09-18 09:13:18 +09:00
Tony Allevato
9279ddfd1b Merge pull request #76519 from allevato/various-fixes
[NFC] Small cleanup in stdlib/public/runtime.
2024-09-17 15:06:14 -04:00
Tony Allevato
c68c4333b9 [NFC] Small cleanup in stdlib/public/runtime.
These changes fix minor issues that cause compilation errors with our
C++ toolchain's stricter default settings:

* `Exception.cpp`: The return type of `__cxa_begin_catch` should be
  `void *`, not `void` (see https://libcxxabi.llvm.org/spec.html).
* `Leaks.mm`: `''` is not a valid C char literal; use `'\0'` instead.
2024-09-17 10:45:28 -04:00
Konrad `ktoso` Malawski
7d1ce789ad Revert "Revert "Isolated synchronous deinit"" 2024-09-17 17:35:38 +09:00
Konrad `ktoso` Malawski
6d37240ef2 Update Task.cancel() with more details
Add more details into cancel() docs, some developers were worried if they are allowed to call it concurrently and multiple times etc.
2024-09-17 09:38:43 +09:00
Kuba (Brecka) Mracek
142df19324 Merge pull request #76231 from kubamracek/embedded-deinit-release
[embedded] Handle retain/retain ops inside deinit in Embedded Swift's swift_release
2024-09-16 16:13:08 -07:00
Ian Anderson
7961e8d3e2 Merge pull request #76471 from ian-twilightcoder/tgmath_fix
Import tgmath_h instead of Darwin.C.tgmath
2024-09-16 15:53:28 -07:00