Commit Graph

21434 Commits

Author SHA1 Message Date
Mike Ash
b7d7159782 [Runtime] Support lazy ObjC realization of Swift classes.
When the ObjC runtime indicates that it supports lazy realization, avoid forcing realization of classes while setting them up. This saves time and memory for classes that never touch the parts of the ObjC runtime that trigger realization

rdar://136102084
2024-09-16 17:12:26 -04:00
Meghana Gupta
58c6a2fb31 Merge pull request #76455 from meg-gupta/enablestdlib
Enable NonEscapableTypes in standard library and make the feature suppressible
2024-09-16 11:52:41 -07:00
Stephen Canon
a4c20e043b Add borrowing _withUnprotectedUnsafePointer (#76446)
* Add non-inout `_withUnprotectedUnsafePointer`

For withUnsafePointer we have both an inout and a borrowing form, allowing it to be used with immutable values. Add a parallel form for the unprotected variant.

* Update LifetimeManager.swift
2024-09-16 14:11:34 -04:00
Kuba Mracek
b4431db2c5 [embedded] Add a more detailed explaining comment to swift_release_n_ 2024-09-16 10:37:40 -07:00
Mike Ash
bc6c027a1f [Concurrency] Add a debug variable that holds the current version of the concurrency library.
This allows lldb to know which version of the internals layout it needs to use.

rdar://135886268
2024-09-16 09:14:03 -04:00
Ian Anderson
488c47b6be Import tgmath_h instead of Darwin.C.tgmath
Recent Apple SDKs moved tgmath.h from Darwin.C.tgmath to tgmath_h.

rdar://135982993
2024-09-13 17:56:58 -07:00
Meghana Gupta
9184923089 Enable experimental feature NonescapableTypes in the stdlib 2024-09-13 01:54:20 -07:00
Ian Anderson
52d9d8006d Merge pull request #76359 from ian-twilightcoder/dont-build-overlays-on-apple
[CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms
2024-09-12 06:14:01 -07:00
Alastair Houghton
3494c40fef Merge pull request #76399 from al45tair/eng/PR-135787913
[Backtracer][macOS] Fix crashing thread index when Rosetta is in use.
2024-09-12 11:21:55 +01:00
Ian Anderson
5bf2c937ab [CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms
The Apple SDKs have been providing the Darwin overlay since macOS 10.14.4, iOS 12.2, et al. More recently the SDK version has diverged from the Swift version making them incompatible. Stop building the overlay from Swift. Once the SDK overlays aren't being built, the clang overlays need to be built in testing.

rdar://115192929
2024-09-11 22:26:37 -07:00
Mike Ash
ea6e5e707f Merge pull request #76047 from mikeash/remote-mirror-resilient-superclasses
[RemoteMirror] Fix generic subclasses of resilient superclasses.
2024-09-11 18:19:19 -04:00
Jonathan Grynspan
db7a030a71 Extend internal _mangledTypeName() function to take non-copyable types. (#76041)
`_mangledTypeName()` returns the Swift-mangled typename of a given type. This PR extends it to take non-copyable types as well.

Related to our use case in Swift Testing, but not to the PR directly: #69146 #69147 #71112

Resolves rdar://134278607.
2024-09-11 16:11:58 -04:00
Doug Gregor
b272a05ea9 Merge pull request #76363 from DmT021/wp/print-diagnostic-groups
[Diagnostics] Add -print-diagnostic-groups flag
2024-09-11 13:04:07 -07:00
Mike Ash
6cf878cb48 Merge pull request #76371 from mikeash/unsafe-at-any-cvalistpointer
[Stdlib] Mark CVaListPointer as @unsafe.
2024-09-11 14:29:16 -04:00
Mike Ash
b35a2a11f1 Merge pull request #76309 from mikeash/mirror-thin-metatypes
[Mirror] Handle fields of thin metatypes.
2024-09-11 10:52:05 -04:00
Konrad `ktoso` Malawski
4aaf47181e Merge pull request #75878 from jamieQ/stream-termination 2024-09-11 22:42:52 +09:00
Dmitrii Galimzianov
a8b71ea97f Add -print-diagnostic-groups flag
This change adds the `-print-diagnostic-groups` flag as described by SE-0443.
2024-09-11 13:34:42 +02:00
Alastair Houghton
4c47540ecf [Backtracer][macOS] Fix crashing thread index when Rosetta is in use.
If you're using Rosetta 2, there are ARM64 threads in your process as
well, which the backtracer skips.  Unfortunately doing that messed up
the crashing thread index, so the backtracer might have crashed or
told you that a different thread was crashing than the one you
thought.

This only affects running x86-64 code on an Apple Silicon Mac.

rdar://135787913
2024-09-11 10:44:35 +01:00
Mike Ash
3937ceecc7 [Stdlib] Mark CVaListPointer as @unsafe.
rdar://135604375
2024-09-10 14:49:38 -04:00
Allan Shortlidge
60f049d9ac Merge pull request #76349 from tshortli/resolve-warnings
Resolve recently introduced warnings
2024-09-09 18:17:09 -07:00
Allan Shortlidge
28bc3ca834 Backtracing: Use internal import in swift-backtracing.
The `swift-backtracing` module is an executable rather than a library so it
should have no reason to use the deprecated `@_implementationOnly import` over
`internal import`.
2024-09-09 12:48:28 -07:00
Allan Shortlidge
ba3cd79b6f Concurrency: Remove superflous _SwiftConcurrencyShims imports.
The `_SwiftConcurrencyShims` module was imported `@_implementationOnly` which
was causing warnings to be emitted during the stdlib build. The module
currently serves no purpose; the only declaration it contains is a defunct
`_SwiftContext` struct which is not referenced by anything. The module needs to
continue to exist for source compatibility, though, since it is part of the
toolchain and imported publicly from other modules.
2024-09-09 12:20:13 -07:00
Artem Chikin
1baff87879 Revert "[CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms" 2024-09-09 09:57:14 -07:00
Alastair Houghton
e98e43141a Merge pull request #75948 from RSilicon/atom
Specify atomicity for compare_exchange_strong
2024-09-08 09:46:09 +01:00
Alastair Houghton
e34d23f56e Merge pull request #76310 from al45tair/eng/PR-135413803
[Windows][Concurrency] Use the same clock as Dispatch.
2024-09-07 08:42:59 +01:00
Ian Anderson
8959dd97fe [CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms
The Apple SDKs have been providing the Darwin overlay since macOS 10.14.4, iOS 12.2, et al. More recently the SDK version has diverged from the Swift version making them incompatible. Stop building the overlay from Swift. Once the SDK overlays aren't being built, the clang overlays need to be built in testing.

%target-swift-emit-pcm doesn't use the sdk, but %target-swift-frontend does, which will cause them to have a mismatch with "builtin headers belong to system modules, and _Builtin_ modules are ignored for cstdlib headers" aka LANGOPT(BuiltinHeadersInSystemModules) aka -fbuiltin-headers-in-system-modules.

rdar://115192929
2024-09-06 13:28:14 -07:00
Alastair Houghton
8e91ae48e6 [Concurrency][Windows] Remove use of GetProcAddress().
Since we're linking `mincore.lib`, we don't need to use
`GetProcAddress()` to find `Query[Unbiased]InterruptTimePrecise()`.

rdar://135413803
2024-09-06 17:16:27 +01:00
Alastair Houghton
86c643ddc8 [Concurrency][Windows] Also update swift_get_clock_res().
I should have updated this to match as well.

rdar://135413803
2024-09-06 15:51:55 +01:00
Alastair Houghton
f5b146b095 [Windows][Concurrency] Use the same clock as Dispatch.
The Concurrency runtime calculates deadlines for scheduling itself
using `swift_get_time()`; unfortunately, on Windows that was using
`QueryPerformanceCounter()`, while Dispatch uses
`QueryInterruptTimePrecise()`.  The problem with that is that the two do
not necessarily correspond *at all*.  In general
`QueryPerformanceCounter()` may be using any of a number of hardware
timers depending on the machine on which we're running.

In the VM I was testing on, the two differed by 20ms, but the worst case
is that they are completely unrelated, in which case `Task.sleep()` will
wait essentially a random amount of time.

rdar://135413803
2024-09-06 15:39:22 +01:00
Mike Ash
7d3451316a [Mirror] Handle fields of thin metatypes.
Fields containing metatypes with no possible subtypes are thin i.e. they have no storage. There is only one possible value they can have: the corresponding type. Mirror attempted to copy the nonexistent field value from the nonexistent storage, producing garbage. Instead, special-case thin metatypes and copy the instance type out of the metatype metadata rather than trying to copy it from the field.

rdar://108280543
2024-09-06 10:38:25 -04:00
Egor Zhdan
0a14f04fe5 Merge pull request #76260 from swiftlang/egorzhdan/cxxshim-maccatalyst
[cxx-interop] Install CxxShim library for macCatalyst
2024-09-06 13:09:21 +01:00
Meghana Gupta
2f37e10674 Rewrite UnsafeRawBufferPointer.Iterator.next to avoid non natural loop in SIL
The current implementation creates a non-natural loop and none of the SIL and
LLVM loop passes will work for such loops. We have to find a way to fix this in
SIL. Until then, rewrite so we get a natural loop in SIL.
2024-09-05 15:35:39 -07:00
Alejandro Alonso
45d7ea39a5 Merge pull request #75518 from Azoy/integer-generics
Implement Value generics
2024-09-05 15:33:46 -07:00
Allan Shortlidge
a39ee131ad Concurrency: swift_deletedAsyncMethodError() should be internal.
This function is an implementation detail of the runtime, not something that
clients of the _Concurrency library should be able to directly name. Make it
`@usableFromInline internal` instead of `public` so that it remains as ABI but
doesn't show up in auto-complete or documentation.
2024-09-05 11:12:58 -07:00
Alejandro Alonso
f431e0064a Fix abi test for new initRaw runtime function 2024-09-04 15:13:51 -07:00
Alejandro Alonso
3d8a9d4554 Implement same type checking at runtime 2024-09-04 15:13:51 -07:00
Alejandro Alonso
f2f82a7de6 Add initRawStructMetadata2 for safety 2024-09-04 15:13:51 -07:00
Alejandro Alonso
8a9303b3cf Consistently negate the value from demangling 2024-09-04 15:13:50 -07:00
Alejandro Alonso
c1dd957c75 Use intptr_t more consistently 2024-09-04 15:13:50 -07:00
Alejandro Alonso
9903d71f91 More changes to get off of ssize_t 2024-09-04 15:13:49 -07:00
Alejandro Alonso
22349bcfb9 Use intptr_t instead of ssize_t and more test fixes 2024-09-04 15:13:49 -07:00
Alejandro Alonso
4f07c060b7 Future proof the initRawStructMetadata entrypoint 2024-09-04 15:13:46 -07:00
Alejandro Alonso
f4f60f4344 Remove Value requirement Add GenericTypeParamKind 2024-09-04 15:13:43 -07:00
Alejandro Alonso
7c85261a77 Add runtime support 2024-09-04 15:13:27 -07:00
Alejandro Alonso
75c2cbf593 Implement value generics
Some requirement machine work

Rename requirement to Value

Rename more things to Value

Fix integer checking for requirement

some docs and parser changes

Minor fixes
2024-09-04 15:13:25 -07:00
Egor Zhdan
0d19a7763c [cxx-interop] Install CxxShim library for macCatalyst
This is a follow-up after the change that enabled Cxx and CxxStdlib overlays on macCatalyst: https://github.com/swiftlang/swift/pull/74994.

The compiler relies on the presence of these shim libraries in the toolchain.

rdar://135275773
2024-09-04 19:09:46 +01:00
Rose
7f2787e249 Use instancetype for the benchmark and SwiftNativeNSObject
This is more for consistency than anything else, really.
2024-09-04 13:07:04 -04:00
Egor Zhdan
03abb1f0f8 Merge pull request #76223 from ishon19/76220-string-should-conform-to-comparable
Add comparable conformance for C++ strings
2024-09-04 12:50:44 +01:00
Alex Hoppen
c5aa49ba64 Revert "Isolated synchronous deinit" 2024-09-03 18:11:26 -07:00
Allan Shortlidge
de963486d0 Merge pull request #76228 from tshortli/actor-label-at-end-of-compound-statement
Concurrency: Suppress a -Wc++23-extensions warning
2024-09-03 17:20:54 -07:00