Commit Graph

21434 Commits

Author SHA1 Message Date
Erik Eckstein
3f6f163598 stdlib: annotate some floating point functions with "optimize.sil.inline.constant.arguments" 2025-04-01 18:12:45 +02:00
Alastair Houghton
5b5f486a31 [Concurrency] Use the correct Dispatch clock.
This caused a hard-to-reproduce bug where a machine that had slept for
a long time would take a very long time to run some of the tests because
we'd be scheduling Dispatch executions with the wrong clock.

rdar://148337712
2025-04-01 16:07:12 +01:00
Kuba (Brecka) Mracek
a1cdd336f0 Merge pull request #80420 from kubamracek/embedded-drop-mach-apple
[embedded] Stop using -D__APPLE__ and -D__MACH__
2025-04-01 06:25:44 -07:00
Allan Shortlidge
c6cbcd8553 stdlib: Address StrictMemorySafety warnings in Cxx String related code. 2025-03-31 16:45:08 -07:00
Allan Shortlidge
d2e8edfc93 stdlib: Address StrictMemorySafety warnings in Span related code. 2025-03-31 16:45:08 -07:00
Allan Shortlidge
3a574c0e6f stdlib: Address StrictMemorySafety warnings in Concurrency related code. 2025-03-31 16:45:08 -07:00
Allan Shortlidge
dbd3d40c07 stdlib: Address StrictMemorySafety warnings in KeyPath related code. 2025-03-31 16:45:08 -07:00
Allan Shortlidge
60e66f3613 stdlib: Address StrictMemorySafety warnings in String related code. 2025-03-31 16:45:08 -07:00
Allan Shortlidge
b3038e6d81 stdlib: Address StrictMemorySafety warnings in Set related code. 2025-03-31 16:45:08 -07:00
Allan Shortlidge
87db90c0da stdlib: Address StrictMemorySafety warnings in Dictionary related code. 2025-03-31 16:45:08 -07:00
Allan Shortlidge
322443d91d stdlib: Address StrictMemorySafety warnings in Array related code. 2025-03-31 16:43:01 -07:00
Konrad `ktoso` Malawski
240a43b054 Revert "Concurrency: remove workaround for silencing UB" 2025-04-01 07:09:57 +09:00
Kuba Mracek
6d71f45101 [embedded] Stop using -D__APPLE__ and -D__MACH__ 2025-03-31 15:07:11 -07:00
Guillaume Lessard
e3234f8ae2 [stdlib] a better pointer as associated object id 2025-03-31 12:05:50 -07:00
Guillaume Lessard
6059be4bca [stdlib] simplify spans of bridged substrings 2025-03-31 12:05:50 -07:00
Guillaume Lessard
85a9be6a1b [stdlib] spans over bridged Substring instances 2025-03-31 12:05:50 -07:00
Guillaume Lessard
9ae58c992b [stdlib] span properties for bridged String instances 2025-03-31 12:05:50 -07:00
Guillaume Lessard
af0aa94c18 [stdlib] lazy-eager bridging for non-UTF8 NSString instances 2025-03-31 12:05:50 -07:00
Guillaume Lessard
a061425aae [stdlib] add storage property to Substring.UTF8View 2025-03-31 12:05:50 -07:00
Guillaume Lessard
3015bf522d [stdlib] add storage property to String.UTF8View 2025-03-31 12:05:50 -07:00
Alastair Houghton
b1c345f1be Merge pull request #80266 from al45tair/custom-executors-take2
[Concurrency] Provide a Swift interface for custom main and global executors.
2025-03-31 09:53:48 +01:00
Allan Shortlidge
e5d0cd4e51 Merge pull request #80322 from tshortli/allow-swift-runtime-symbol-declarations 2025-03-30 16:14:40 -07:00
Allan Shortlidge
8f2d5a759e Merge pull request #80321 from tshortli/warnings 2025-03-30 16:14:21 -07:00
Allan Shortlidge
2fb76a468a Merge pull request #80333 from tshortli/clock-measure-unsafe-inherit-executor 2025-03-30 16:14:07 -07:00
Henrik G. Olsson
87f5309144 [Swiftify] enable mutable span (#80387)
* [Swiftify] Emit Mutable[Raw]Span when possible

Previously wrappers would use UnsafeMutable[Raw]Pointer for mutable
pointers, and Span for non-const std::span, to prevent the compiler from
complaining that MutableSpan didn't exist.

Now that MutableSpan has landed we can finally emit MutableSpan without
causing compilation errors. While we had (disabled) support for MutableSpan
syntax already, some unexpected semantic errors required additional
changes:
 - Mutable[Raw]Span parameters need to be inout (for mutation)
 - inout ~Escapable paramters need explicit lifetime annotations
 - MutableSpan cannot be directly bitcast to std::span, because it is
   ~Copyable, so they need unwrapping to UnsafeMutableBufferPointer

rdar://147883022

* [Swiftify] Wrap if-expressions in Immediately Called Closures

When parameters in swiftified wrapper functions are nullable, we use
separate branches for the nil and nonnil cases, because
`withUnsafeBufferPointer` (and similar) cannot be called on nil.
If-expressions have some limitations on where they are allowed in the
grammar, and cannot be passed as arguments to a function. As such, when
the return value is also swiftified, we get an error when trying to
pass the if-expression to the UnsafeBufferPointer/Span constructor.
While it isn't pretty, the best way forward seems to be by wrapping the
if-expressions in Immediately Called Closures.

The closures have the side-effect of acting as a barrier for 'unsafe':
unsafe keywords outside the closure do not "reach" unsafe expressions
inside the closure. We therefore have to emit "unsafe" where unsafe
expressions are used, rather than just when returning.

rdar://148153063
2025-03-29 05:05:01 -07:00
Saleem Abdulrasool
50e4cc78f6 Merge pull request #80246 from compnerd/playing-with-pointy-pointers
Concurrency: remove workaround for silencing UB
2025-03-28 18:34:27 -07:00
Guillaume Lessard
c9b1ab8c42 Merge pull request #79650 from glessard/rdar138440979-MutableSpan
[SE-0467] MutableSpan, with mutableSpan properties to Array, ArraySlice and ContiguousArray.
2025-03-28 17:59:47 -07:00
Alex Martini
0bd4ee3ca6 Merge pull request #80359 from amartini51/doc_fixes
Documentation fixes
2025-03-28 15:33:40 -07:00
Mike Ash
ecdcb82b97 Merge pull request #80316 from mikeash/lock-record-begone
[Concurrency] Eliminate StatusRecordLockRecord.
2025-03-28 17:18:40 -04:00
nate-chandler
b8c97b9836 Merge pull request #80361 from nate-chandler/general-coro/20250327/1
[CoroutineAccessors] Open code alloc/dealloc functions.
2025-03-28 13:20:01 -07:00
Allan Shortlidge
0c69e2db07 Distributed: Add visionOS to Apple platform conditionals. 2025-03-28 12:33:40 -07:00
Allan Shortlidge
322daab362 Distributed: Add unsafe keyword to uses of pthreads. 2025-03-28 12:33:40 -07:00
Allan Shortlidge
aef0d2105b Runtime: Fix unused declaration warnings in Backtrace.cpp. 2025-03-28 12:33:39 -07:00
Allan Shortlidge
82cd87187f AST: Introduce the AllowRuntimeSymbolDeclarations experimental feature.
This feature only exists as a mechanism to suppress the warning introduced in
https://github.com/swiftlang/swift/pull/75378. The RegexParser module, which is
effectively part of the standard library, declares a Swift runtime symbol and
as a result every build of the compiler and stdlib produces warnings which
there are no plans to address. Warnings that are not going to be addressed need
some way of being suppressed, and an experimental features seems like a
reasonable mechanism for this one.
2025-03-28 12:32:47 -07:00
Doug Gregor
fd24d29055 Merge pull request #80357 from DougGregor/strict-safety-improvements
Strict safety improvements
2025-03-28 11:58:44 -07:00
Alastair Houghton
6e28716319 [Concurrency] Address some review comments.
Tweaked diagnostic to use a string instead of a type.  Renamed the
feature in `FeatureAvailability.def` (and added the `TaskExecutor`
feature to 6.2).  Also fixed the `swift_getActiveExecutor()`
function to return the main executor only when on the main thread.

rdar://141348916
2025-03-28 10:15:14 +00:00
Alastair Houghton
a418ce4931 [Concurrency] Fix some comments and a typo.
There were a couple of comments that needed updating, and a typo
in a function name.

rdar://141348916
2025-03-28 10:15:14 +00:00
Alastair Houghton
0c96a257f6 [Concurrency] Fix task-to-thread model linking.
We need to provide some of the additional functions, as stubs, for
task-to-thread model.

rdar://141348916
2025-03-28 10:15:14 +00:00
Alastair Houghton
47fa71787f Revert "Merge pull request #80224 from glessard/revert-79789-custom-executors"
This reverts commit 06f6358067, reversing
changes made to 033f6679e8.
2025-03-28 10:15:07 +00:00
Doug Gregor
b2f0ce44cc Remove a use of @safe @unsafe from the standard library 2025-03-27 22:05:21 -07:00
Karoy Lorentey
5583e6916c Merge pull request #73258 from lorentey/you-cannot-escape-optionals
[stdlib] Generalize some constructs for non-escapable types
2025-03-27 20:02:00 -07:00
Nate Chandler
2af30b2f04 [NFC] CoroutineAccessors: Remove old runtime files
The functions are open-coded now.
2025-03-27 19:23:09 -07:00
Nate Chandler
c141586838 [CoroutineAccessors] Open code dealloc fn. 2025-03-27 19:23:09 -07:00
Nate Chandler
dd238343bb [CoroutineAccessors] Open code alloc fn.
Replace the runtime function with an open-coded version.
2025-03-27 19:23:09 -07:00
nate-chandler
b878155a5a Merge pull request #80335 from nate-chandler/general-coro/20250326/2
[CoroutineAccessors] Move functions and add dealloc bit.
2025-03-27 19:19:25 -07:00
Guillaume Lessard
abf29e7433 [stdlib] adjust MutableSpan’s element constraint 2025-03-27 17:19:15 -07:00
Guillaume Lessard
6a7dbb02f3 [stdlib] update lifetime annotations for Mutable[Raw]Span 2025-03-27 16:55:06 -07:00
Guillaume Lessard
7a160a2dfc [stdlib] de-underscore the extracting() methods 2025-03-27 16:55:05 -07:00
Guillaume Lessard
107b38f9e0 [stdlib] add mutableSpan to array types 2025-03-27 16:55:05 -07:00
Alex Martini
7ee720bfc4 Use verb fragment, per API reference style 2025-03-27 16:51:25 -07:00