Commit Graph

17868 Commits

Author SHA1 Message Date
Alastair Houghton
57d056e1a3 Merge pull request #82457 from al45tair/external-executor-test-support
[Concurrency] Add functions to allow testing of external executors.
2025-07-04 09:52:57 +01:00
Konrad `ktoso` Malawski
ec8caf3cdd Remove the experimental @Task macro (#82437) 2025-07-03 10:15:21 -07:00
Alex Martini
c727b0e3bc Merge pull request #82635 from amartini51/typo_154473231
Fix repeated words in documentation

Fixes: rdar://154473231
2025-07-02 19:26:55 -07:00
Stephen Canon
fddd8bd5b9 Mark the concrete SIMD/Scalar comparisons disfavored (#82686)
Adding the concrete versions (https://github.com/swiftlang/swift/pull/81892) introduced an ambiguity for concrete vec .<= .zero comparisons; previously the concrete SIMD .<= SIMD operation would win (because we didn't have a concrete overload for SIMD .<= SIMD.Scalar). We can restore the old behavior by marking these disfavored.
2025-07-02 11:59:07 -04:00
Alastair Houghton
fbd87591d0 [Backtracing][Linux] Ignore SHT_NULL sections.
The ELF specification says that if a section's type is set to `SHT_NULL`,
_none_ of the other fields are valid, so we shouldn't even be trying to
read the section name.

(We won't crash, because of how all of this code works, but we might
read an incorrect name.)

rdar://154837649
2025-07-02 14:35:16 +01:00
Doug Gregor
46572f80a2 Merge pull request #82661 from DougGregor/back-deploy-main-actor-isolated-deinit
[SE-0371] Back-deploy support for main-actor-isolated deinit
2025-07-01 20:50:19 -07:00
Doug Gregor
bfb62e1262 Don't implement swift_task_deinitOnExecutorMainActorBackDeploy in the task-to-thread model 2025-07-01 16:06:05 -07:00
Alastair Houghton
26878c98de [Concurrency] Add functions to allow testing of external executors.
Added a couple of functions to allow for the testing of executors that
aren't implemented inside the concurrency runtime itself.

rdar://154195821
2025-07-01 16:48:03 +01:00
Doug Gregor
f736677022 Switch to the appropriate C calling convention for pthread_main_np 2025-07-01 08:15:54 -07:00
Alastair Houghton
76f235154d Merge pull request #82624 from al45tair/eng/PR-154282813
[Backtracing][Linux] Fix crash handler for musl.
2025-07-01 11:17:28 +01:00
Luke Howard
451f309935 build with 64-bit time_t on 32-bit platforms (#82595)
It is good practice to build with 64-bit `time_t`/timeval on 32-bit
platforms to avoid the Y2038 issue. This is the default when building on
Yocto for armv7, for example. Unfortunately `suseconds_t` is not an
alias to a type of the correct width (unlike time_t).

Question: on release/6.1, tv_usec is assumed to be `Int32`, but on main
it is `Int`, but appears to be the same commit hash?

#### git blame main stdlib/public/Platform/Platform.swift

```
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 350) @available(SwiftStdlib 5.7, *)
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 351) extension timeval {
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 352)   @available(SwiftStdlib 5.7, *)
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 353)   public init(_ duration: Duration) {
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 354)     let comps = duration.components
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 355)   // Linux platforms define timeval as Int/Int
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 356)   self.init(tv_sec: Int(comps.seconds),
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 357)               tv_usec: Int(comps.attoseconds / 1_000_000_000_000))
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 358)   }
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 359) }
```

#### git blame release/6.1 stdlib/public/Platform/Platform.swift

```
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 455) @available(SwiftStdlib 5.7, *)
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 456) extension timeval {
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 457)   @available(SwiftStdlib 5.7, *)
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 458)   public init(_ duration: Duration) {
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 459)     let comps = duration.components
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 460) #if os(Linux)
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 461)   // Linux platforms define timeval as Int/Int
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 462)   self.init(tv_sec: Int(comps.seconds),
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 463)               tv_usec: Int(comps.attoseconds / 1_000_000_000_000))
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 464) #else
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 465)     // Darwin platforms define timeval as Int/Int32
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 466)     self.init(tv_sec: Int(comps.seconds),
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 467)               tv_usec: Int32(comps.attoseconds / 1_000_000_000_000))
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 468) #endif
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 469)   }
e675b310f8 (Philippe Hausler    2022-02-17 09:32:46 -0800 470) }
```
2025-06-30 18:19:32 -07:00
Doug Gregor
7789a0ce64 [SE-0371] Back-deploy support for main-actor-isolated deinit
When targeting a platform that predates the introduction of isolated
deinit, make a narrow exception that allows main-actor-isolated deinit
to work through a special, inlineable entrypoint that is
back-deployed. This implementation

  1. Calls into the real implementation when available, otherwise
  2. Checks if we're on the main thread, destroying immediately when
we are, otherwise
  3. Creates a new task on the main actor to handle destruction.

This implementation is less efficient than the implementation in the
runtime, but allows us to back-deploy this functionality as far back
as concurrency goes.

Fixes rdar://151029118.
2025-06-30 17:38:08 -07:00
Guillaume Lessard
5d4c445347 [stdlib] some span properties are more available 2025-06-30 17:13:35 -07:00
Stephen Canon
377c66b6e7 Replace some precondition with _precondition in the stdlib. (#82641) 2025-06-30 19:12:00 -04:00
Guillaume Lessard
f97961a86f [stdlib] fix _makeMutableAndUniqueUnchecked() 2025-06-30 16:05:00 -07:00
Henrik G. Olsson
e9ba8f8a03 Merge pull request #81855 from hnrklssn/swiftify-availability-check-sdk
[Swiftify] Adjust _SwiftifyImport invocation to align with the signature
2025-06-30 12:00:20 -07:00
Alastair Houghton
f2c820a35c Merge pull request #82563 from al45tair/eng/PR-154346018
[Concurrency] Prevent negative sleeps from sleeping forever.
2025-06-30 17:45:36 +01:00
Alex Martini
3928ddfeb4 Fix repeated text 2025-06-30 09:36:37 -07:00
Alastair Houghton
b498b39b79 [Backtracing][Linux] Fix crash handler for musl.
Musl's `clone()` wrapper returns `EINVAL` if you try to use `CLONE_THREAD`,
which seems a bit wrong (certainly it is in this particular application,
since we *really* don't care whether the thread is a valid C library
thread at this point).

Also properly support ELF images that are built with a base address other
than zero (this typically isn't an issue for dynamically linked programs,
as they will be relocated at runtime anyway, but for statically linked
binaries it's very common to set the base address to a non-zero value).

rdar://154282813
2025-06-30 14:21:27 +01:00
Konrad `ktoso` Malawski
396379ecbf Merge pull request #82227 from ktoso/wip-deprecate-extractisolation 2025-06-30 20:32:30 +09:00
Henrik G. Olsson
bd11926bf7 [Swiftify] Adjust _SwiftifyImport invocation to align with the signature
of the macro in the currently laoded macro module

Stdlib macros are shipped with the SDK, so we need to make sure that the
way we invoke the macro matches the version of the macro in the SDK.
This patch skips the `spanAvailability` parameter if it isn't present.
There's no good way to test this, because we will always pick up the
current macro in our llvm-lit test suite, but I've tested it manually.

rdar://152278292
2025-06-27 19:10:23 -07:00
David Smith
1a56da655f Native implementation of -lengthOfBytesUsingEncoding, plus handling ASCII-subset MacRoman in a few places (#81791)
Fixes rdar://154341146
2025-06-27 13:48:10 -07:00
Guillaume Lessard
96f6f5e25a Merge pull request #82442 from glessard/rdar147500261-utf8span-32bit 2025-06-27 08:18:46 -07:00
Alastair Houghton
80791035a3 [Concurrency] Prevent negative sleeps from sleeping forever.
Requests to sleep until a negative timestamp would result in sleeping
until `UINT64_MAX` nanoseconds from the start of the relevant clock,
which is about 585 years.

rdar://154346018
2025-06-27 11:15:05 +01:00
Ben Rimmington
1b1e9d4d80 [stdlib] Update InlineArray documentation (#82363)
Remove misleading big O notation from initializers.
2025-06-27 11:14:24 +01:00
Guillaume Lessard
4927c0c1c8 [stdlib] improve more accessor declarations 2025-06-26 14:57:21 -07:00
Guillaume Lessard
c8092f50d1 [stdlib] simplify borrowing accessors 2025-06-26 14:57:21 -07:00
Guillaume Lessard
bbfe648c54 [stdlib] improve accessor declarations 2025-06-26 14:57:21 -07:00
Alejandro Alonso
883716bd1a Merge pull request #80858 from Azoy/remove-wubp-inlinearray
[stdlib] Remove _withUnsafeBufferPointer APIs on InlineArray
2025-06-26 14:44:08 -07:00
Alastair Houghton
f7f4a19baf Merge pull request #82417 from al45tair/eng/PR-153531418
[Concurrency] Rename Dummy(Main|Task)Executor.
2025-06-26 10:53:57 +01:00
Guillaume Lessard
791dd4cb0a [stdlib] name your constants better
- computed properties have an ABI impact; a function is fine here
2025-06-25 22:01:28 -07:00
Alejandro Alonso
596b015994 Adjust ABI test and guard address of property 2025-06-25 14:08:53 -07:00
Alejandro Alonso
6953a7c6f9 Update InlineArray.swift 2025-06-25 14:00:16 -07:00
Alejandro Alonso
5ac3a655d4 Update InlineArray.swift 2025-06-25 14:00:15 -07:00
Alejandro Alonso
db13bf0802 Update InlineArray.swift 2025-06-25 14:00:14 -07:00
Alejandro Alonso
8058bd26f6 Remove underscored with buffer pointer APIs on InlineArray 2025-06-25 14:00:12 -07:00
Gábor Horváth
7f7a5b19eb Merge pull request #81024 from swiftlang/gaborh/fix-cpp-benchmarks
[cxx-interop] Reenable C++ benchmarks
2025-06-25 12:30:01 +02:00
Konrad `ktoso` Malawski
989ec93762 Merge branch 'main' into wip-deprecate-extractisolation 2025-06-25 16:57:52 +09:00
Guillaume Lessard
4a13c916d7 [stdlib] name your constants 2025-06-24 17:19:48 -07:00
Guillaume Lessard
e8f0d52fe2 [gardening] labels for conditional compilation markers 2025-06-24 17:10:37 -07:00
eeckstein
830a842b7b Merge pull request #82455 from eeckstein/adress-of-borrow-feature
Guard InlineArray addressors with feature flag
2025-06-24 20:58:18 +02:00
Gabor Horvath
3dda301496 [cxx-interop] Reenable C++ benchmarks
The underlying issue was fixed in #82309

rdar://149402670
2025-06-24 17:57:42 +01:00
David Smith
08233afee9 Extend the existing memoization of NSString's Hashable conformance to cover AnyObjects that are actually NSStrings as well (#82440)
Fixes rdar://154123172 (Consider memoizing the lookup for NSString's
conformance to Hashable)
2025-06-24 08:21:13 -07:00
Erik Eckstein
0dbc63a00b Guard InlineArray addressors with feature flag
To be able to parse a recent Swift.swiftinterface file with a 6.2 compiler.
This is a follow-up fix for https://github.com/swiftlang/swift/pull/81441

rdar://154118968
2025-06-24 16:02:54 +02:00
Konrad `ktoso` Malawski
a28515ec7e Merge pull request #82372 from ktoso/wip-NeverErrorTaskShouldNotThrowInOperation 2025-06-24 15:35:43 +09:00
Guillaume Lessard
0473190189 [stdlib] adjust small string for contiguity 2025-06-23 18:38:33 -07:00
Guillaume Lessard
3aad241019 [stdlib] address 32-bit watchOS ABI issue 2025-06-23 18:31:16 -07:00
Adrian Prantl
31a9b798bb Merge pull request #82356 from adrian-prantl/catchall
[reflection] Fine-tune error messages
2025-06-23 15:13:10 -07:00
Alastair Houghton
0d14682f99 [Concurrency] Rename Dummy(Main|Task)Executor.
`UnimplementedExecutor` seems like a better name.

rdar://153531418
2025-06-23 16:47:50 +01:00
Allan Shortlidge
008efc432f stdlib: Fix missing unsafe operators in more places.
Add `unsafe` where it is still missing. I missed these in previous passes due
to conditional compilation.
2025-06-22 18:46:57 -07:00