Commit Graph

184213 Commits

Author SHA1 Message Date
Guillaume Lessard
746324b4ba [test] fix test of InlineArray initializer 2025-07-11 19:03:03 -07:00
Guillaume Lessard
402a0cf2c8 [stdlib] remove bulk-update from MutableRawSpan per SE-0485 2025-07-11 19:03:03 -07:00
Guillaume Lessard
34a26d6d9a [stdlib] remove bulk-update from MutableSpan per SE-0485 2025-07-11 19:03:03 -07:00
Guillaume Lessard
3b4279c671 [stdlib] rename MutableRawSpan.extracting functions 2025-07-11 19:03:03 -07:00
Guillaume Lessard
05fe6fa522 [stdlib] rename MutableSpan.extracting functions 2025-07-11 19:03:03 -07:00
Guillaume Lessard
8c7d0db816 [stdlib] make OutputRawSpan changes from SE-0485 2025-07-11 19:03:02 -07:00
Guillaume Lessard
f11f3a9b72 [stdlib] make OutputSpan changes from SE-0485 2025-07-11 19:03:02 -07:00
Guillaume Lessard
a2a9f46907 [test] simplify OutputSpan-InlineArray test 2025-07-11 19:03:02 -07:00
Guillaume Lessard
ea4083777b [stdlib] internal UnsafeRawBufferPointer tweaks 2025-07-11 19:03:02 -07:00
Guillaume Lessard
ba1446e5f9 [stdlib] list files for cmake 2025-07-11 19:03:02 -07:00
Guillaume Lessard
d078734051 [stdlib] InlineArray consumed by OutputSpan 2025-07-11 19:03:01 -07:00
Guillaume Lessard
9f9565f4b2 [stdlib] in-place initializer for InlineArray 2025-07-11 19:03:01 -07:00
Guillaume Lessard
16afe633d2 [test] abi accounting 2025-07-11 19:03:01 -07:00
Guillaume Lessard
0fc95ef94e [test] OutputSpan tests 2025-07-11 19:03:01 -07:00
Guillaume Lessard
42c5988161 [stdlib] add OutputRawSpan 2025-07-11 19:03:01 -07:00
Guillaume Lessard
850bb23d48 [stdlib] add OutputSpan 2025-07-11 19:03:00 -07:00
Guillaume Lessard
ccffb19afd [stdlib] alignment-checking functions for pointers
Co-authored-by: Karoy Lorentey <klorentey@apple.com>
2025-07-11 19:03:00 -07:00
Augusto Noronha
79824f56b2 [RemoteAddress] Handle comparison of addresses in different spaces
Sometimes it makes sense to compares addresses from different address
spaces.

rdar://148361743
(cherry picked from commit c97dfd6b05)
2025-07-11 16:36:40 -07:00
Augusto Noronha
e2c8b761cd [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
(cherry picked from commit 58df5534d2)
(cherry picked from commit 8f3862b5e7)
2025-07-11 16:36:40 -07:00
Augusto Noronha
9e85b88d9d [RemoteMirrors] Fix losing the remote address on StaticMirror
The Offset field of a DynamicRelocation is either an offset or a remote
address, but was being treated only as a remote address on
getDynamicSymbol.
2025-07-11 16:36:39 -07:00
Ben Barham
919bc88a31 Use SWIFT_COMPILER_VERSION before SWIFT_TOOLCHAIN_VERSION if it exists
We should eventually split these, but for now SWIFT_COMPILER_VERSION
matches SWIFT_TOOLCHAIN_VERSION when it's actually set. Just use it in
preference to SWIFT_TOOLCHAIN_VERSION.

(cherry picked from commit ec46a4f026)
2025-07-11 15:24:08 -07:00
Doug Gregor
d0d1a42b7c [IRGen] Mangling of nonisolated(nonsending) function types was introduced in Swift 6.2
We can't use mangled named when back-deploying earlier.
2025-07-11 14:26:32 -07:00
Doug Gregor
430b26c983 Generalize test for 32-bit platforms 2025-07-11 14:26:32 -07:00
Doug Gregor
81dc98b0c8 [IRGen] Don't use mangled names for metadata including Span et al when back-deploying
If back-deploying prior to the introduction of name mangling and
runtime support for invertible constraints (~Copyable, ~Escapable),
don't use mangled names to access metadata. The code already existed
for this, but had a carve-out that still used mangled names for
standard library types that have always existed but got generalized to
support non-copyable & non-escapable types.

Tweak that carve-out to not apply to types like Span that come from a
back-deployment library. Fixes crashes when using metadata for Span et
al on older platforms.

Fixes rdar://155639204.
2025-07-11 14:26:32 -07:00
Konrad `ktoso` Malawski
9ac4ebc603 Merge pull request #82984 from ktoso/pick-task-group-docs 2025-07-12 05:01:37 +09:00
Alexis Laferrière
f0db19d4ef Tests: Add missing -target clang flags in @cdecl Interpreter tests
rdar://155013885
2025-07-11 11:01:37 -07:00
Doug Gregor
4501026c94 Merge pull request #82955 from DougGregor/strict-memory-safety-spurious-warning-fixes-6.2
[6.2] Fix spurious warnings with strict memory safety
2025-07-11 10:53:18 -07:00
Adrian Prantl
bfb026cb9e [RemoteInspection] Change RemoteAbsolutePointer (NFC)
This patch changes RemoteAbsolutePointer to store both the symbol and
the resolved address. This allows us to retire some ugly workarounds
to deal with non-symbolic addresses and it fixes code paths that would
need these workarounds, but haven't implemented them yet (i.e., the
pack shape handling in the symbolicReferenceResolver in MetadatyaReader.

Addresses parts of rdar://146273066.
rdar://153687085

(cherry picked from commit 9381a54c67)
(cherry picked from commit a6eafcb311)
2025-07-11 09:43:17 -07:00
Meghana Gupta
e3f0cfb80c Merge pull request #82980 from meg-gupta/fixsilcombinecp
[6.2] Fix SILCombine of inject_enum_addr when the enum is non-trivial but payload is trivial
2025-07-11 08:51:12 -07:00
Hamish Knight
9fb2e2f6a1 Merge pull request #82967 from hamishknight/len-check-6.2
[6.2] [Refactoring] Handle argument count mismatches in `renameLabelsLenient`
2025-07-11 14:53:51 +01:00
Hamish Knight
f807cbe30e Enable InlineArray type sugar
Promote it from an experimental feature.

rdar://155607927
2025-07-11 13:26:24 +01:00
Konrad `ktoso` Malawski
c0732b7347 Merge pull request #82977 from ktoso/wip-pick-immediate-with-task-executor 2025-07-11 20:29:01 +09:00
Finagolfin
91360ab37b [build] Fix libcurl for typos and correct name of build target 2025-07-11 16:24:30 +05:30
Finagolfin
0bdc26a7a7 [build] Set CMAKE_Swift_COMPILER_TARGET when cross-compiling corelibs 2025-07-11 16:23:55 +05:30
finagolfin
43970ac2f0 [android] Fix an install path and the displayed NDK in the build log (#82620)
I just noticed the install issue when cross-compiling Testing with a
freshly-built compiler, which I'd never done before. Also, fix the NDK
path shown in the CMake output.
2025-07-11 16:21:18 +05:30
finagolfin
21d90c5a41 [test] Fix or disable tests for 32-bit platforms (#82501)
Fix two IRGen tests that are failing on Android armv7 and disable eight ClangImporter, C++ Interop, and SILOptimizer tests, two of which that were already failing on other 32-bit platforms.
2025-07-11 16:20:08 +05:30
Hamish Knight
cbad87d977 Merge pull request #82950 from hamishknight/ident-range-6.2
[6.2] [SourceKit] Fix raw identifier handling for semantic tokens
2025-07-11 10:09:00 +01:00
Pavel Yaskevich
4e93e74898 [Concurrency] Don't downgrade explicit isolation attribute clashes
The compiler shouldn't accept mismatch in explicit isolation attributes
because it could lead to incorrect isolation selection.

Resolves: rdar://155589753

(cherry picked from commit a9373c0f3f)
2025-07-10 22:29:20 -07:00
Alex Martini
12b998e4bc 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-11 12:00:54 +09:00
Alex Martini
430f49b98b Fix more 'cancel(l)ed' style issues 2025-07-11 11:45:25 +09:00
Alex Martini
929a167eda Remove stray spaces
These looks like the side effect of a find-and-replace for PR 82558
fixing 'cancelled' vs 'canceled'.
2025-07-11 11:45:22 +09:00
Konrad `ktoso` Malawski
7a6527af83 Merge pull request #82558 from ktoso/wip-cleanup-group-docs 2025-07-11 11:45:15 +09:00
Changhyun Kang
1416a74f11 [Concurrency] fix documentation typos in TaskGroup.swift (#82291) 2025-07-11 11:44:52 +09:00
Konrad `ktoso` Malawski
ce0d16652c add newline at end of startImmediately.swift file 2025-07-11 09:52:42 +09:00
Michael Gottesman
1f9e30276a [rbi] Teach SendNonSendable how to more aggressively suppress sending errors around obfuscated Sendable functions
Specifically the type checker to work around interface types not having
isolation introduces casts into the AST that enrich the AST with isolation
information. Part of that information is Sendable. This means that we can
sometimes lose due to conversions that a function is actually Sendable. To work
around this, we today suppress those errors when they are emitted (post 6.2, we
should just change their classification as being Sendable... but I don't want to
make that change now).

This change just makes the pattern matching for these conversions handle more
cases so that transfernonsendable_closureliterals_isolationinference.swift now
passes.
2025-07-10 17:25:01 -07:00
Michael Gottesman
35c3b9e12c [concurrency] Perform some fixes so that transfernonsendable_closureliterals_isolationinference.swift now passes.
The reason why this failed is that concurrently to @xedin landing
79af04ccc4, I enabled
NonisolatedNonsendingByDefault on a bunch of other tests. That change broke the
test and so we needed to fix it.

This commit fixes a few issues that were exposed:

1. We do not propagate nonisolated(nonsending) into a closure if its inferred
context isolation is global actor isolated or if the closure captures an
isolated parameter. We previously just always inferred
nonisolated(nonsending). Unfortunately since we do not yet have capture
information in CSApply, this required us to put the isolation change into
TypeCheckConcurrency.cpp and basically have function conversions of the form:

```
(function_conversion_expr type="nonisolated(nonsending) () async -> Void"
   (closure_expr type="() async -> ()" isolated_to_caller_isolation))
```

Notice how we have a function conversion to nonisolated(nonsending) from a
closure expr that has an isolation that is isolated_to_caller.

2. With this in hand, we found that this pattern caused us to first thunk a
nonisolated(nonsending) function to an @concurrent function and then thunk that
back to nonisolated(nonsending), causing the final function to always be
concurrent. I put into SILGen a peephole that recognizes this pattern and emits
the correct code.

3. With that in hand, we found that we were emitting nonisolated(nonsending)
parameters for inheritActorContext functions. This was then fixed by @xedin in

With all this in hand, closure literal isolation and all of the other RBI tests
with nonisolated(nonsending) enabled pass.

rdar://154969621
(cherry picked from commit 648bb8fe30)
2025-07-10 17:24:48 -07:00
Meghana Gupta
212e55e055 [6.2] Fix SILCombine of inject_enum_addr when the enum is non-trivial but payload is trivial 2025-07-10 17:17:25 -07:00
Konrad 'ktoso' Malawski
fba13f8eda [Concurrency] Add missing Task.immediateDetached, which drops task locals 2025-07-11 08:45:08 +09:00
Konrad 'ktoso' Malawski
6f3099b564 [Concurrency] a few missing overloads for immediate tasks 2025-07-11 08:45:03 +09:00
Meghana Gupta
5c85c65278 Disable retain and release sinking when rc root values are ~Copyable 2025-07-10 16:13:13 -07:00