Commit Graph

2572 Commits

Author SHA1 Message Date
Nate Chandler
5534eb4043 [DefaultOverides] Install in vtables at runtime. 2025-03-25 07:22:44 -07:00
Nate Chandler
fba93fc207 [Test] Reenable tbd validation.
This was fixed previously.
2025-03-25 07:22:13 -07:00
Amritpan Kaur
3c30d68d2e Merge pull request #78823 from amritpan/method-keypaths
[Sema/SILGen/IRGen] Implement method & initializer keypaths.
2025-03-19 18:59:17 -07:00
Amritpan Kaur
98cd675eb9 Guard feature behind experimental flag. 2025-03-19 10:54:09 -07:00
Amritpan Kaur
15c219cd70 [Tests] Add tests. 2025-03-19 10:54:09 -07:00
Mike Ash
2d06496197 [Test] Disable backtracing for dynamic_isolation_checks_for_closures.swift and preconcurrency_conformances.swift.
These tests verify that the program crashed by checking for the absence of an "OK" line. The backtracer's memory dumps can sometimes contain the string "OK" by chance, resulting in a spurious failure.

rdar://146577558
2025-03-18 10:43:01 -04:00
Alejandro Alonso
c1bb143648 Make ValueGenerics feature always available 2025-02-27 10:03:37 -08:00
Pavel Yaskevich
9cbd8e1f10 Merge pull request #79382 from xedin/more-Sendable-to-Any-problems
[Concurrency] Fix a few issues with `Senable` and `Any`
2025-02-15 08:23:28 -08:00
Pavel Yaskevich
484e0a7437 [ConstraintSystem] Sendable-to-Any: Allow conversion when in inout positions
It should be possible to pass values with `any Sendable` as arguments
to `inout` parameters that expect `Any`. This is pretty much the same
as an l-value conversion.

Resolves: https://github.com/swiftlang/swift/issues/79361
Resolves: rdar://144794132
2025-02-13 17:03:00 -08:00
Dario Rexin
401cd64a61 [IRGen] Apply correct type to conversion for direct values and erorrs with typed throws
rdar://144719032

When converting the combined result back to the actual types when directly returning typed errors, in case
the error or result value was a single value smaller then pointer size and the combined value was larger,
the value was converted to the combined type instead of the actual type, making it a no-op, which caused
undefined behavior when writing the value to the coerced alloca.
2025-02-13 12:53:12 -08:00
Amritpan Kaur
1c025f5b04 Add tests. 2025-02-09 10:19:44 -08:00
Dario Rexin
923cccf1ea [Runtime] Add specialized CVW entry points for multi payload enums
rdar://143852239

Adding these specialized entry points reduces the overhead of the witness functions by removing the first indirection.
2025-01-30 14:44:49 -08:00
Stefan Gränitz
76243a25db [windows][toolchain] Build sanitizers and builtins standalone for all SDKs (#78861)
Unified builds of compiler-rt together with LLVM failed for the Android SDKs. It got too complicated to redirect the way LLVM would configure the nested build-trees. Standalone builds slightly increase build time, but they turned out much simpler and we end up with less duplication of definitions.
2025-01-28 22:08:07 +01:00
Erik Eckstein
66e801b0e8 tests: fix lifetimes of objects in two tests
Those tests rely on lexical object lifetimes. But lifetimes are only guaranteed for "variables" but not for temporary objects.
Storing those objects in variables fixes the issue.

This fixes the tests when running them in optimize mode and when OSSA modules are enabled.

This is part of rdar://140229560.
2025-01-27 10:38:30 +01:00
Erik Eckstein
42fef1fb68 SILGen: let withoutActuallyEscaping also catch an escaping closure in the throwing case
withoutActuallyEscaping checks that the passed closure has not beed escaped by ensuring that its reference count is exactly 1 at the end of the code block.
So far this was only done in the regular return case. But if the code block throws, the check was not done.

Fixes an undetected undefined behavior.
2025-01-24 18:57:40 +01:00
Dario Rexin
30e7ba13b2 [IRGen] Add indirect typed error slot when async function has indirect result
rdar://142918657

Erorrs have to be passed indirectly whenever the result type is indirect.
2025-01-16 15:29:13 -08:00
Alexis Laferrière
f4f61d23ff Merge pull request #78530 from xymus/local-cache-for-appkit
Tests: Use a local cache for many tests importing AppKit
2025-01-10 12:43:33 -08:00
Alexis Laferrière
11c448d954 Tests: Use a local cache for many tests importing AppKit
Tests importing AppKit have a tendency to be flaky if they share a
module cache with other builds using a different set of framework search
flags. Make sure they use a local cache to avoid picking incompatible
cached modules.

Alternatively, we could align all builds using the same cache to have
exactly the same framework search paths or enable explicit module
builds. I picked the module cache as it's the most reliable solution in
the short and long term.

The 5 tests below import AppKit and have been known to be flaky.
Adapting them to use a custom cache with require more care. For now,
let's use them as control group to validate that the fix works. If these
5 fail without the fixed ones, we should extend the same corresponding
fix to them.

- Interpreter/SDK/GLKit.swift
- Interpreter/SDK/cf_extensions.swift
- Interpreter/SDK/cf_type_bridging.swift
- Interpreter/SDK/mapkit_header_static.swift
- Interpreter/SDK/objc_ns_enum.swift

rdar://142296731
2025-01-09 12:22:02 -08:00
Pavel Yaskevich
0a0a34c853 [CSApply] Add support for l-value to l-value and inout unsafe casts
`any Sendable` -> `Any` in generic argument positions should be
supported for l-value and inout types as well otherwise it won't
be possible to call setters and mutating methods.
2025-01-07 17:21:33 -08:00
Pavel Yaskevich
636525ebd9 Merge pull request #78171 from xedin/rdar-140300022
[TypeChecker/SILGen] Allow `any Sendable` to match `Any` while matching generic arguments
2024-12-17 20:24:34 -08:00
Hamish Knight
a1b56fbb29 [test] Disable variadic_generic_opaque_type.swift for back deployment
rdar://139913681
2024-12-16 14:02:25 +00:00
Pavel Yaskevich
0de9e9cd1d [CSSimplify] Extend any Sendable -> Any conversion support to function argument/result positions in generic argument context 2024-12-13 17:27:06 -08:00
Pavel Yaskevich
5e08f7e257 [CSApply/SILGen] Implement any Sendable to Any erasure for generic arguments
In non-strict concurrency mode when `@preconcurrency` declarations
are involved `any Sendable` should be treated as `Any` in generic
argument positions to support passing types that (partially) adopted
concurrency annotations to types that haven't yet done so.
2024-12-11 17:19:14 -08:00
Hiroshi Yamauchi
32832dd1e1 Revert "[windows][toolchain] Enable builtins and sanitizers"
Revert https://github.com/swiftlang/swift/pull/77770

To fix CI https://ci-external.swift.org/job/swift-main-windows-toolchain-arm64/785/consoleText
2024-12-06 14:22:30 -08:00
Saleem Abdulrasool
3ab2a3ee4c Merge pull request #77770 from weliveindetail/windows-toolchain-sanitizers
[windows][toolchain] Enable builtins and sanitizers
2024-12-05 15:46:46 -08:00
Saleem Abdulrasool
03eeffdbb7 test: disable failing test
Disable the test until someone can look into why the path is getting
corrupted.
2024-12-05 15:17:30 -08:00
Saleem Abdulrasool
499e4227c6 test: fix the broken test
swiftlang/swift-driver#1741 fixed a bug in the swift-driver which
exposed a bug in this test. The use of `%FileCheck` is a problem as that
sanitises the output substituting `BUILD_DIR` for the build directory
that is now properly computed. Because `PATH` is being configured to an
invalid path the actual driver is not found and the test fails.
2024-12-04 11:24:27 -08:00
Stefan Gränitz
2f7116a36f Disable tests newly included with asan_runtime available, but not supported on Windows yet 2024-12-03 18:41:49 +01:00
Mike Ash
08e0cd8868 [Test] Sign test dylibs in Interpreter/coroutine_accessors_default_implementations.swift and Interpreter/typed_throws_abi.swift.
rdar://140456842
2024-12-02 10:54:24 -05:00
Joe Groff
5822bc3685 Merge pull request #77605 from jckarter/capture-metadata-for-fixed-box-to-run-deinit
IRGen: Capture NecessaryBindings in fixed boxes that may invoke deinits.
2024-11-21 09:59:51 -08:00
Joe Groff
b5e79d5590 IRGen: Capture NecessaryBindings in fixed boxes that may invoke deinits.
Noncopyable types may have user-defined code in their `deinit`s that requires
passing the type's generic parameters, so a box for a captured noncopyable type
needs to capture the generic environment even when the captured type is fixed-
layout. Fixes rdar://138958210.
2024-11-20 11:19:10 -08:00
Meghana Gupta
e8abd59da5 Update tests 2024-11-18 18:09:19 -08:00
Dario Rexin
abfa450e3e Merge pull request #77597 from drexin/wip-139375022
[IRGen] Set minimum runtime availability version for CVW
2024-11-14 06:11:37 -08:00
Dario Rexin
c0c31c0613 [IRGen] Set minimum runtime availability version for CVW
rdar://139375022

CVW should not be generated when the deployment target does not have the necessary runtime functions.
2024-11-13 22:36:15 -08:00
Dario Rexin
735aa98aad Merge pull request #77569 from drexin/wip-139708680
[Runtime] Add entry for native swift objc reference to initWithTakeTa…
2024-11-12 19:29:28 -08:00
Meghana Gupta
184058e4ac Merge pull request #76588 from meg-gupta/lifetimeremovefeatureguardincompiler
Remove feature guard on lifetime dependence inference
2024-11-12 18:38:41 -08:00
Dario Rexin
591c2cbb65 [Runtime] Add entry for native swift objc reference to initWithTakeTable in CVW runtime
rdar://139708680

The entry was missing in the function table, causing runtime crashes.
2024-11-12 15:12:19 -08:00
Meghana Gupta
b7c4ef44e0 Update some test configs where stdlib is loaded later 2024-11-12 12:05:19 -08:00
Dario Rexin
3301541be5 [IRGen] Fix crash in CVW generation for ObjC references
rdar://139664644

The code that differentiates between regular ObjC and native Swift ObjC references could crash when generics were involved. Instead of through the TypeInfo, we are going directly throught the SILType to the type decl, which avoids the crash caused by casting the TypeInfo.
2024-11-11 16:23:59 -08:00
nate-chandler
aab880da05 Merge pull request #77429 from nate-chandler/general-coro/20241104/1
[CoroutineAccessors] Synthesize default requirement implementations.
2024-11-10 07:43:11 -08:00
Dario Rexin
8d44f62c57 [Tests] Add missing executable_test requirement to Interpreter/typed_throws_abi.swift
rdar://139480718

Executable tests need to be marked as such to prevent failures in non-executable test environments.
2024-11-08 08:57:23 -08:00
Nate Chandler
da71271d8f [CoroutineAccessors] Synthesize default req impls.
When a protocol which has a read (or modify) requirement is built with
the CoroutineAccessors feature, it gains a read2 (or modify2,
respectively) requirement.  For this to be compatible with binaries
built without the feature, a default implementation for these new
requirements must be provided.  Cause these new accessor requirements to
have default implementations by returning `true` from
`doesAccessorHaveBody` when the context is a `ProtocolDecl` and the
relevant availability check passes.
2024-11-07 16:47:09 -08:00
Dario Rexin
0d7054b637 Merge pull request #76630 from drexin/wip-135954459
[IRGen] Reintroduce typed throws ABI
2024-11-07 15:56:22 -08:00
Dario Rexin
4ea0c9bbee Merge pull request #77431 from drexin/wip-138487964
[IRGen+Runtime] Fix tag bit mask handling for objc, unknown objects a…
2024-11-07 15:55:08 -08:00
Dario Rexin
8beed309a9 [Test] Add more test coverage for typed throws ABI
Adding more cases with errors of different sizes
2024-11-07 10:22:54 -08:00
Dario Rexin
d6689d80b9 [Test] Add executable tests for non-matching error/result values in direct error return typed throws 2024-11-07 10:22:54 -08:00
Dario Rexin
06a9e9fd49 [Test] Add executable tests for typed throws ABI 2024-11-07 10:22:54 -08:00
Dario Rexin
ffd9f205b3 [IRGen] Re-introduce typed throws ABI
rdar://135954459
2024-11-07 10:22:49 -08:00
Dario Rexin
3c7b556cf1 [IRGen+Runtime] Fix tag bit mask handling for objc, unknown objects and blocks
rdar://138487964

On platforms that don't have reserved bits in objc (including unknown) pointers, we use the spare bits for Swift enums, so they have to be masked out. Blocks don't have reserved bits on any platform.
2024-11-07 09:55:40 -08:00
Alejandro Alonso
400bfb227c Remove disable parser round trip on some tests 2024-11-06 13:56:06 -08:00