Commit Graph

17573 Commits

Author SHA1 Message Date
Gabor Horvath
df27b79579 [cxx-interop] Work around lifetime errors in SwiftifyImport generated code
Unfortunately, this was not discovered earlier as swift-ide-test is not
invoking the SIL passes that produce this diagnostic. When creating
Swift spans from C++ spans we have no lifetime dependency information to
propagate as C++ spans are modeled as escapable types. Hence, this PR
introduces a helper function to bypass the lifetime checks triggered by
this discepancy. Hopefully, the new utility will go away as the lifetime
analysis matures on the Swift side and we get standardized way to deal
with unsafe lifetimes.
2025-02-14 16:40:43 +00:00
Alastair Houghton
864f3dc023 [Backtracing] Fix bug in Compact Image Map decoder.
The `expand` opcode was being decoded incorrectly in the case where we
were trying to expand prefixes with codes of 64 or above.

rdar://144497804
2025-02-14 14:59:20 +00:00
Doug Gregor
2989770cd6 Merge pull request #79352 from DougGregor/strict-sendable-metatypes
Add StrictSendableMetatypes to require Sendable requirements on metatypes
2025-02-14 03:40:36 -08:00
Yuta Saito
5c1a02adfd Merge pull request #79349 from kateinoigakukun/pr-b59229c8b7f3a006cea85209a02c5246f2e75701
[wasm] Use `__visibility__("default")` for all wasm platforms
2025-02-14 16:05:09 +09:00
Doug Gregor
e24598bca1 Use a marker protocol SendableMetatype to model T.Type: Sendable
Introduce a marker protocol SendableMetatype that is used to indicate
when the metatype of a type will conform to Sendable. Specifically,
`T: SendableMetatype` implies `T.Type: Sendable`. When strict
metatype sendability is enabled, metatypes are only sendable when `T:
SendableMetatype`.

All nominal types implicitly conform to `SendableMetatype`, as do the
various builtin types, function types, etc. The `Sendable` marker
protocol now inherits from `SendableMetatype`, so that `T: Sendable`
implies `T.Type: Sendable`.

Thank you Slava for the excellent idea!
2025-02-13 22:48:05 -08:00
Allan Shortlidge
6e3eb96d91 Concurrency: Fix an unused variable warning. 2025-02-13 07:40:53 -08:00
Philipp Gabriel
773561cc27 Expose attosecond representation of Duration (#78202)
* Add Int128 to Duration

* Update stdlib/public/core/Duration.swift

Co-authored-by: Stephen Canon <stephentyrone@gmail.com>

* Add unit tests for duration + attoseconds

* Add docs to duration + attosecond

* Update docs for attoseconds property

* Update stdlib.swift

* Update stdlib.swift

---------

Co-authored-by: Stephen Canon <stephentyrone@gmail.com>
2025-02-13 09:31:02 -05:00
Yuta Saito
35c3d7fd0e [wasm] Use __visibility__("default") for all wasm platforms
The condition previously depended on the specific OS, but the image
boundary is the same for all platforms using Wasm as image format. This
fixes the Emscripten build.
2025-02-13 02:07:36 +00:00
Guillaume Lessard
c7af9a701b Merge pull request #79294 from Azoy/bye-bye-slab
[stdlib] Rename Slab to InlineArray
2025-02-12 12:03:25 -08:00
Erik Eckstein
6407f9a0bd remove the allocVector builtin
It's not needed anymore, because the "FixedArray" experimental feature is replaced by inline-arrays.
2025-02-12 10:51:14 +01:00
Guillaume Lessard
6b90664f54 [concurrency] fix availabilities some more
Extensions cannot be more available than their type for swiftinterface files.
2025-02-11 13:14:49 -08:00
Alejandro Alonso
e4fb1f6761 Rename Slab to InlineArray 2025-02-11 10:26:44 -08:00
Rashmi Mudduluru
f60394db46 [SUA][Runtime] Define swift_coroFrameAlloc function that allocates typed memory (#79200)
[SUA][Runtime] Define `swift_coroFrameAlloc` function that allocates typed memory

Define `swift_coroFrameAlloc` that allocates typed memory if SWIFT_STDLIB_HAS_MALLOC_TYPE is defined.
This function will be used by IRGen to emit typed memory allocations for property accessors.

rdar://141235539
2025-02-11 09:57:08 -08:00
Saleem Abdulrasool
a86743e77e Merge pull request #79278 from compnerd/modular 2025-02-11 05:48:29 -08:00
Guillaume Lessard
e10e476fe4 [concurrency] fix availabilities
These two functions are called from a context that has SwiftStdlib 6.2 availability. Theyshould have that same availability.
2025-02-10 19:14:25 -08:00
Konrad `ktoso` Malawski
edc81e8901 Merge pull request #78625 from ktoso/wip-taskpriority-escalate-api
[Concurrency] Task priority escalation APIs
2025-02-11 09:08:05 +09:00
Saleem Abdulrasool
79d2af759b ClangImporter: support modularizing __msvc_string_view.hpp
This header was introduced in a recent STL release. Modularise the
header properly, adding a shim for compatibility with older releases.

Partially based on a change from @egorzhdan.
2025-02-10 12:48:35 -08:00
Konrad `ktoso` Malawski
26c521d317 [Concurrency] Add new APIs to ABI check & add more tests 2025-02-10 17:55:42 +09:00
Konrad `ktoso` Malawski
29d95cef85 [Concurrency] Fix ptrauth value for __ptrauth_swift_escalation_notification_function
Previously these records were not used at all, so changing this has no
impact on existing runtimes. Note that we changedd the FunctionType
because the previous one was slightly incorrect -- the context comes
LAST in the type, not first.
2025-02-08 17:18:59 +09:00
Konrad `ktoso` Malawski
67e6373c23 [Concurrency] minor renames of new API for adding escalation handlers 2025-02-08 17:18:58 +09:00
Konrad `ktoso` Malawski
655bd67f67 [Concurrency] Task priority escalation handler API 2025-02-08 17:18:58 +09:00
Konrad `ktoso` Malawski
18c25845d6 [Concurrency] Task.escalatePriority 2025-02-08 17:18:57 +09:00
Saleem Abdulrasool
db160d5e81 runtime: tweak the environment handling
We would previously enable "environment variables" on Android via global
properties. Re-order the macros a bit to make it more explicit that the
environment handling is required for that and remove it when environment
variables are unsupported.
2025-02-07 09:26:49 -08:00
Alastair Houghton
c35d65efca Merge pull request #79155 from weissi/jw-bt-leak
fix ELF/DWARF leak
2025-02-07 09:18:06 +00:00
Alejandro Alonso
57234f8034 Merge pull request #70451 from Azoy/read-keypath-optimization
[stdlib] Performance improvements for reading keypaths
2025-02-05 22:57:29 -08:00
Alejandro Alonso
f38e84cfe1 Pass buffer to _projectReadOnly and fix appends 2025-02-05 14:33:30 -08:00
Johannes Weiss
e533b8a7ff fix ELF/DWARF leak 2025-02-05 14:27:18 +00:00
Konrad `ktoso` Malawski
76f3729644 The SWIFT_DUMP_ACCESSIBLE_FUNCTIONS flag must be a bool, not a string 2025-02-05 10:30:53 +09:00
Alejandro Alonso
90bd2a008e Add maxSize helper to buffer and fix reroot 2025-02-04 16:21:09 -08:00
Alejandro Alonso
edee13a612 Take the leaf type into account for max size 2025-02-04 15:16:40 -08:00
Alejandro Alonso
59c53b72f0 Don't do the kvc stored offset optimization on 16 bit platforms 2025-02-04 15:16:40 -08:00
Alejandro Alonso
02401d4bb0 Remove some workarounds 2025-02-04 15:16:39 -08:00
Alejandro Alonso
581376e86e Move variable into closure 2025-02-04 15:16:39 -08:00
Alejandro Alonso
25a4bbe549 Check maxSize on finish 2025-02-04 15:16:39 -08:00
Alejandro Alonso
6fdb684fd2 Optimization for single component and fix tests 2025-02-04 15:16:39 -08:00
Alejandro Alonso
00ace6695f Round up sizeWithMaxSize 2025-02-04 15:16:38 -08:00
Alejandro Alonso
4733da2744 Performance improvements for reading keypaths 2025-02-04 15:16:36 -08:00
Saleem Abdulrasool
6028fde00a Merge pull request #79116 from compnerd/silence
Concurrency: silence some unused variable warnings
2025-02-04 10:28:30 -08:00
Saleem Abdulrasool
0174528f81 stdlib: fix the problem swept under the rug in 58a97f1603
The `-Winvalid-offsetof` warning is valid in this case. `offsetof` is
being applied to types with a non-standard layout. The layout of this
type is undefined by the specification. There is no guarantee that the
type layout is uniform across all ABIs. It is not possible to portably
compute the offset statically, especially efficiently.

Sink this check into a unit test to avoid performing this test at
runtime. In order to do this in the standard library, we would need to
do this check through a global constructor.
2025-02-03 09:25:06 -08:00
Saleem Abdulrasool
8040430bc7 Concurrency: silence some unused variable warnings
This cleans up some warnings from the unused variables. The variables
were referenced by `assert` cases only.
2025-02-03 09:22:50 -08:00
Arnold Schwaighofer
d2d5ad6df4 Merge pull request #79111 from al45tair/eng/PR-144045984
[Backtracing] Local|RemoteMemoryReader only exists on macOS and Linux.
2025-02-03 08:36:53 -08:00
Alastair Houghton
615f884a42 Merge pull request #79057 from al45tair/backtracing-cxxstdlib-dep
[Backtracing] Add missing CxxStdlib dependency.
2025-02-03 16:26:55 +00:00
Alastair Houghton
a60dd8f76d [Backtracing] Local|RemoteMemoryReader only exists on macOS and Linux.
When fixing the previous problem, I should have realised that this
would cascade; the `@_specialize` annotations refer to the cached
versions of the types, and those are now turned off except on macOS
and Linux because they rely on the uncached versions, which are only
available on macOS and Linux.

rdar://144023438
2025-02-03 12:34:42 +00:00
Allan Shortlidge
4799f1e295 Concurrency: Suppress some warnings. 2025-02-01 13:52:43 -08:00
Allan Shortlidge
2b8d1be3ca Backtracing: Suppress a "switch covers known cases" warning. 2025-02-01 10:28:27 -08:00
Allan Shortlidge
e65aab74dd stdlib: Fix an unused variable warning. 2025-02-01 10:28:27 -08:00
Alastair Houghton
dd40b2f501 Merge pull request #79071 from al45tair/eng/PR-143869185
[Backtracing] Bump minimum deployment targets.
2025-02-01 10:28:14 +00:00
Arnold Schwaighofer
9b66fdf272 Merge pull request #79072 from al45tair/eng/PR-143865183
[Backtracing] Uncached(Local|Remote)MemoryReader only exists on macOS and Linux.
2025-01-31 16:02:04 -08:00
Philippe Hausler
854fa5c4e3 [Observation] Disable caching of KeyPaths (#78853)
* [Observation] Disable caching of KeyPaths

* Remove the cached keypath annottion for the ObservationTracked peer macro
2025-01-31 13:50:05 -08:00
Kuba (Brecka) Mracek
3afe8ebdf6 Merge pull request #78919 from kubamracek/embedded-dict-init
[embedded] Support Dictionary.init(uniqueKeysWithValues:) in Embedded Swift
2025-01-31 11:03:04 -08:00