Commit Graph

21803 Commits

Author SHA1 Message Date
Guillaume Lessard
fa87b3b944 [stdlib] remove bulk-update from MutableRawSpan per SE-0485 2025-07-14 23:04:49 -07:00
Guillaume Lessard
923a6e5292 [stdlib] remove bulk-update from MutableSpan per SE-0485 2025-07-14 23:04:48 -07:00
Guillaume Lessard
97a0bd743a [stdlib] rename MutableRawSpan.extracting functions 2025-07-14 23:04:48 -07:00
Guillaume Lessard
6439a32997 [stdlib] rename MutableSpan.extracting functions 2025-07-14 23:04:48 -07:00
Guillaume Lessard
9e98783ec5 [stdlib] make OutputRawSpan changes from SE-0485 2025-07-14 23:04:48 -07:00
Guillaume Lessard
5f5e6b68c9 [stdlib] make OutputSpan changes from SE-0485 2025-07-14 23:04:47 -07:00
Guillaume Lessard
ada94db18c [stdlib] internal UnsafeRawBufferPointer tweaks 2025-07-14 23:04:47 -07:00
Guillaume Lessard
733a261b28 [stdlib] InlineArray consumed by OutputSpan 2025-07-14 23:04:46 -07:00
Guillaume Lessard
1d776a6b06 [stdlib] in-place initializer for InlineArray 2025-07-14 23:04:46 -07:00
Guillaume Lessard
4ed4f2e63c [stdlib] add OutputRawSpan 2025-07-14 23:04:45 -07:00
Guillaume Lessard
2fce25b53f [stdlib] add OutputSpan 2025-07-14 23:04:45 -07:00
Guillaume Lessard
a2ae072430 [stdlib] alignment-checking functions for pointers
Co-authored-by: Karoy Lorentey <klorentey@apple.com>
2025-07-14 23:04:45 -07:00
Alex Martini
891fbbed9b Add actors to the list of types with identity 2025-07-14 15:21:17 -07:00
Saleem Abdulrasool
85228415a8 core: add some additional unsafe markers (#83016)
Mark the `CVAListPointer` construction as unsafe. This resolves some
warnings when building the standard library for Android.
2025-07-13 13:21:18 -05:00
Saleem Abdulrasool
ff114f8fdc Merge pull request #83005 from compnerd/detection
Runtimes: detect the existence of `dispatch_async_swift_job`
2025-07-11 17:07:03 -07:00
Augusto Noronha
d9d7db99dc Merge pull request #82995 from augusto2112/sort-addresses
[RemoteAddress] Handle comparison of addresses in different spaces
2025-07-11 15:34:38 -07:00
Saleem Abdulrasool
326f18d113 Runtimes: detect the existence of dispatch_async_swift_job
This function is used by the executor to help schedule the async job.
While not currently available on Windows on main, this allows correctly
handling the presence of the symbol for static linking.
2025-07-11 11:28:07 -07:00
Augusto Noronha
c97dfd6b05 [RemoteAddress] Handle comparison of addresses in different spaces
Sometimes it makes sense to compares addresses from different address
spaces.

rdar://148361743
2025-07-11 10:05:16 -07:00
Stephen Canon
d10b3f82fc Optimization pass over String and UTF8Span's allASCII helper (#82540)
This ranges between parity (for very small strings) and 5x faster (for
32-63B strings) in benchmarking on M1 MBP. For largeish strings it
delivers a roughly 2x speedup; further increase in blocksize nets a
small win in microbenchmarks that I do not expect would translate to
real world usage due to codesize impact and the fact that most strings
are smallish.

There's some opportunity for further work here; in particular, if people
start building Swift for a baseline of AVX2 or AVX512, we should have
paths for that (and we should also implement them if/when we get better
multiversioning dispatch machinery in the language). Span adoption would
be interesting. It's likely we should have a dedicated "small core"
implementation that uses only aligned accesses. Still, this is a
significant improvement as-is, and we should land it.


![allASCII](https://github.com/user-attachments/assets/ebbc45ba-5ba8-42dd-bf63-31ca77844fca)
2025-07-11 12:08:17 -04:00
Dmitrii Galimzianov
7989dbe24e Protocol conformance cache for generic types
This change adds a new type of cache (cache by type descriptor) to the protocol conformance lookup system. This optimization is beneficial for generic types, where the
same conformance can be reused across different instantiations of the generic type.

Key changes:
- Add a `GetOrInsertManyScope` class to `ConcurrentReadableHashMap` for performing
  multiple insertions under a single lock
- Add type descriptor-based caching for protocol conformances
- Add environment variables for controlling and debugging the conformance cache
- Add tests to verify the behavior of the conformance cache
- Fix for https://github.com/swiftlang/swift/issues/82889

The implementation is controlled by the `SWIFT_DEBUG_ENABLE_CACHE_PROTOCOL_CONFORMANCES_BY_TYPE_DESCRIPTOR`
environment variable, which is enabled by default.
2025-07-11 03:54:42 +02:00
Konrad `ktoso` Malawski
47db5ade76 [Concurrency] Align Task.isolated with proposal (add task executor) (#82913) 2025-07-11 08:42:19 +09:00
Saleem Abdulrasool
817922175d Merge pull request #82932 from compnerd/static-flags
utils: build static runtime with static dispatch and closure
2025-07-10 14:46:09 -07:00
Konrad 'ktoso' Malawski
5996da0c0c [Concurrency] Remove symbols of startSynchronously, make it AEIC
In preparation for removal. This spelling of Task.immediate was before
SE-review and was NOT accepted and therefore we should try to remove it
entirely.
2025-07-10 17:34:29 +09:00
Konrad 'ktoso' Malawski
664be9bd1e [Concurrency] Add missing Task.immediateDetached, which drops task locals 2025-07-10 14:57:44 +09:00
Konrad 'ktoso' Malawski
358c3e9dcf [Concurrency] a few missing overloads for immediate tasks 2025-07-10 12:40:41 +09:00
Guillaume Lessard
1e3d26f8a6 [stdlib] rename RawSpan.extracting functions 2025-07-09 17:36:35 -07:00
Guillaume Lessard
dd833569e0 [stdlib] rename Span.extracting functions 2025-07-09 17:25:27 -07:00
Augusto Noronha
58df5534d2 [NFC][RemoteInspection] Add an opaque AddressSpace field to RemoteAddress
Add an extra opaque field to AddressSpace, which can be used by clients
of RemoteInspection to distinguish between different address spaces.

LLDB employs an optimization where it reads memory from files instead of
the running process whenever it can to speed up memory reads (these can
be slow when debugging something over a network). To do this, it needs
to keep track whether an address originated from a process or a file. It
currently distinguishes addresses by setting an unused high bit on the
address, but because of pointer authentication this is not a reliable
solution. In order to keep this optimization working, this patch adds an
extra opaque AddressSpace field to RemoteAddress, which LLDB can use on
its own implementation of MemoryReader to distinguish between addresses.

This patch is NFC for the other RemoteInspection clients, as it adds
extra information to RemoteAddress, which is entirely optional and if
unused should not change the behavior of the library.

Although this patch is quite big the changes are largely mechanical,
replacing threading StoredPointer with RemoteAddress.

rdar://148361743
2025-07-09 14:52:42 -07:00
Saleem Abdulrasool
8b74c09b8f utils: build static runtime with static dispatch and closure
Although we would like these to be dynamic, we currently cannot build
them properly due to limitations of the build system. Adjust the build
to pass in additional flags to properly build the runtimes for that
environment as a temporary measure.
2025-07-09 14:41:59 -07:00
Guillaume Lessard
7e2697276a Merge pull request #82851 from glessard/rdar154331399-makeReallyContiguous
[stdlib] Make String.makeContiguousUTF8() strictly true
2025-07-09 08:11:30 -07:00
Pavel Yaskevich
72267bb1d4 Merge pull request #82892 from swiftlang/revert-82833-remove-startSynchronously
Revert "[Concurrency] Remove deprecated `Task.startSynchronously` API"
2025-07-09 00:19:08 -07:00
Alex Martini
e755decf43 Merge pull request #82894 from amartini51/fixup_pr_82558
Revise task group docs for style, fixing issues in the content changed in #82558 and some nearby content.
2025-07-08 20:28:38 -07:00
Alex Martini
74c3dbcd24 Revise doc comment for style & clarity
- Move the definition of 'structured concurrency' to the beginning of
  the section.
- Avoid future tense.  Fix some mixed future+present tense errors.
- Write bullet points as individual sentences, not as the clauses of one
  long sentence.
- Apple Style: Use 'since' only in the sense of 'after'.
- Apple Style: Use 'you' instead of 'one'.
- Apple Style: Close up 'non-' except when ambiguous.
- DevPubs style: Avoid bare 'this' for clarity.  Here, 'this guarantee'
  tells the reader what 'this' refers to.
- DevPubs style: Avoid 'may' which can be ambiguous between possibility
  and permission.
2025-07-08 14:31:29 -07:00
Guillaume Lessard
9341973700 [stdlib] update doc-comments 2025-07-08 14:29:21 -07:00
Pavel Yaskevich
8c4f7e97c8 Revert "[Concurrency] Remove deprecated Task.startSynchronously API" 2025-07-08 13:54:23 -07:00
Guillaume Lessard
77f34f4f29 [stdlib] update doc-comment and add a code comment 2025-07-08 13:20:11 -07:00
Guillaume Lessard
62115791c0 [stdlib] make makeContiguousUTF8 stricter 2025-07-08 13:20:11 -07:00
Doug Gregor
b0739a55b3 Merge pull request #82850 from DougGregor/span-back-deployment-version-fixes
Fix deployment version for Span back-deployment library
2025-07-08 13:05:01 -07:00
Alex Martini
51b2033eeb Fix more 'cancel(l)ed' style issues 2025-07-08 10:50:43 -07:00
Alex Martini
4a7ac28bcb Remove stray spaces
These looks like the side effect of a find-and-replace for PR 82558
fixing 'cancelled' vs 'canceled'.
2025-07-08 10:45:36 -07:00
Guillaume Lessard
fe6a8fac39 Merge pull request #82866 from glessard/rdar155275054-default-inits-allspans
[stdlib] Default initializers for Span-family types
2025-07-08 09:46:14 -07:00
Egor Zhdan
66b8960613 Merge pull request #82817 from egorzhdan/egorzhdan/dictionary-init
[cxx-interop] Allow creating Dictionary from `std::map`
2025-07-08 17:38:20 +01:00
Alastair Houghton
210eae4f7d Merge pull request #82720 from al45tair/eng/PR-154837649
[Backtracing][Linux] Ignore `SHT_NULL` sections.
2025-07-08 15:38:15 +01:00
Changhyun Kang
bf61199e88 [Concurrency] fix documentation typos in TaskGroup.swift (#82291) 2025-07-08 21:02:19 +09:00
Konrad `ktoso` Malawski
fe86091cc1 Merge pull request #82558 from ktoso/wip-cleanup-group-docs 2025-07-08 01:06:51 -07:00
Guillaume Lessard
37737a10f2 [gardening] conditional compilation spelling tweak 2025-07-08 00:46:26 -07:00
Doug Gregor
3594ea12fc Fix minimum deployment versions for Span back-deployment dylib 2025-07-07 22:22:00 -07:00
Guillaume Lessard
619ec95693 [stdlib] add no-parameter initializers for Span types
This was an addition in SE-0485.
2025-07-07 17:57:12 -07:00
Pavel Yaskevich
2b05dc630b Merge pull request #82833 from xedin/remove-startSynchronously
[Concurrency] Remove deprecated `Task.startSynchronously` API
2025-07-07 16:47:15 -07:00
Guillaume Lessard
9d179716f8 Merge pull request #82828 from glessard/mutableSpan-extractingBug
[stdlib] fix some unsafe errors
2025-07-07 14:28:18 -07:00