Commit Graph

2588 Commits

Author SHA1 Message Date
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
Alex Hoppen
9a48cad432 Merge pull request #76939 from ahoppen/enable-parser-roundtrip
Enable experimental parser round-trip in test cases that no longer need it
2024-11-05 18:51:31 -08:00
Dario Rexin
47265438b7 Merge pull request #77383 from drexin/wip-139106139
[IRGen+Runtime] Differentiate between pure Swift and regular ObjC ref…
2024-11-05 11:20:22 -08:00
Daniel Rodríguez Troitiño
5abb1ea6ac [test] Remove some REQUIRES: for features not longer used in those files
While doing #76740 I iteratively was adding new `REQUIRES:` as new
usages of the features were found, but I did not realize that at the
same time other people might be removing some of those usages. The tests
in this commit had some `REQUIRES:` line for a previous
`-enable-experimental/upcoming-feature`, but they not longer use those
features, so the `REQUIRES:` were effectively disabling the tests (at
least in the case of `KeyPathWithStaticMembers`. In other cases they
might still had executed).
2024-11-04 20:53:07 -08:00
Dario Rexin
4e7ce5a058 [IRGen+Runtime] Differentiate between pure Swift and regular ObjC references in CVW
rdar://139106139

Regular ObjC references do not have unused bits or extra inhabitants for storing enum tags, because they may be tagged pointers. However, ObjC classes that are implemented in Swift do, so we must differentiate between the two.
2024-11-04 18:52:26 -08:00
Alex Hoppen
9bbdeaa8c0 Enable experimental parser round-trip in test cases that no longer need it
Also, track all remaining uses of `-disable-experimental-parser-round-trip` by issues.
2024-11-04 15:49:47 -08:00
Daniel Rodríguez Troitiño
ba68faaed5 [test] Mark tests that use experimental/upcoming features as such
Find all the usages of `--enable-experimental-feature` or
`--enable-upcoming-feature` in the tests and replace some of the
`REQUIRES: asserts` to use `REQUIRES: swift-feature-Foo` instead, which
should correctly apply to depending on the asserts/noasserts mode of the
toolchain for each feature.

Remove some comments that talked about enabling asserts since they don't
apply anymore (but I might had miss some).

All this was done with an automated script, so some formatting weirdness
might happen, but I hope I fixed most of those.

There might be some tests that were `REQUIRES: asserts` that might run
in `noasserts` toolchains now. This will normally be because their
feature went from experimental to upcoming/base and the tests were not
updated.
2024-11-02 11:46:46 -07:00
Pavel Yaskevich
5d77f3ca01 [Frontend] NFC: Remove KeyPathWithStaticMembers feature flag
This is a temporary way to land SE-0438 changes without disrupting
anything else.
2024-10-30 10:53:42 -07:00
Dario Rexin
c67b0c73e1 Merge pull request #77197 from drexin/wip-138085348
[Runtime] Fix SwiftError handling in CVW runtime
2024-10-24 13:13:24 -07:00
Dario Rexin
edd9955673 [Runtime] Fix SwiftError handling in CVW runtime
rdar://138085348

Even though errors are ObjC boxes, they can't be tagged pointers and in fact may use that bit to store enum tags, so treating them like regular ObjC references here can cause ref count issues.
2024-10-23 17:31:11 -07:00
Allan Shortlidge
f827e7c6d3 Tests: Remove -disable-availability-checking in variadic generics tests. 2024-10-20 15:37:15 -07:00
Allan Shortlidge
6f55aa4170 Tests: Remove -disable-availability-checking in tests that use opaque types.
Use the `%target-swift-5.1-abi-triple` substitution to compile the tests for
deployment to the minimum OS versions required for use of opaque types, instead
of disabling availability checking.
2024-10-19 19:39:18 -07:00
Allan Shortlidge
cb578172ea Tests: Remove -disable-availability-checking in more tests that use concurrency.
Use the `%target-swift-5.1-abi-triple` substitution to compile the tests for
deployment to the minimum OS versions required for use of _Concurrency APIs,
instead of disabling availability checking.
2024-10-19 12:35:20 -07:00
Allan Shortlidge
082f0ac4b5 Tests: Use a more natural spelling for ABI triple lit substitutions.
`%target-swift-5.8-abi-triple` instead of `%target-swift-abi-5.8-triple`, for
example.
2024-10-18 10:11:36 -07:00
Dario Rexin
5d69905ab9 Merge pull request #77092 from drexin/wip-138141889
[Tests] Fix Interpreter/layout_string_witnesses_objc.swift
2024-10-18 08:54:37 -07:00
Slava Pestov
13da4c2ad3 Merge pull request #77034 from slavapestov/fix-rdar117815191
IRGen: Fix emission of calls to opaque return type metadata access function with packs
2024-10-18 08:11:35 -04:00
Dario Rexin
daf09a5234 [Tests] Fix Interpreter/layout_string_witnesses_objc.swift
rdar://138141889

The allocation and destruction was accidentally using a wrapper, but the initialization did not, so this test could crash if the uninitialized memory contained a valid address.
2024-10-17 16:07:47 -07:00
Dario Rexin
2bcece3e52 [Runtime] Use aligned offset to compute new field offset for unmanaged properties in CVW
The original fix only added the field size to the unaligned offset, which is not correct.
2024-10-17 10:31:07 -07:00
Dario Rexin
e617c4ec65 Merge pull request #77056 from drexin/wip-137954177
[IRGen] Don't try to emit single payload CVW for incompatible multi p…
2024-10-17 09:42:45 -07:00
Dario Rexin
0ec1f4b6ce Merge pull request #76799 from drexin/wip-137066879
[Runtime] Properly compute offset for unmanaged properties in generic…
2024-10-17 09:42:22 -07:00
Dario Rexin
decab5dcfc [IRGen] Don't try to emit single payload CVW for incompatible multi payload enums
rdar://137954177

There was a missing condition in the branch that caused the compiler to try to emit a single payload enum compact value witness for multi payload enums, when the multi payload enum contained an incompatible case.
2024-10-16 15:35:00 -07:00
Slava Pestov
6437e32e2c IRGen: Fix emission of calls to opaque return type metadata access function with packs
We need to heap-ify the packs here, because the runtime demangler
assumes the input hacks are on the heap.

Fixes rdar://117815191.
2024-10-15 17:39:08 -04:00
Alejandro Alonso
e450f25f39 Update value_generics.swift 2024-10-15 13:12:35 -07:00
Dario Rexin
a5bb53aee9 [Runtime] Properly compute offset for unmanaged properties in generic CVW instantiation
rdar://137066879

An unmanaged property does not map to an operation in CVW, instead it will be copied like primitive values. When instantiating the layout string, we correctly do not emit an operation, but we compute the offset to the next field as if we did. This is causing the offset to be incorrect and subsequent operations to be executed on the wrong address, causing crashes or other misbehavior.
2024-10-01 11:25:14 -07:00
Amritpan Kaur
8ebc928649 Guard feature behind experimental flag. 2024-09-27 22:42:04 -07:00
Amritpan Kaur
c69e5cb49c [Tests] Add static keypaths tests. 2024-09-27 22:42:04 -07:00
Amritpan Kaur
6a6e6eeb87 [Tests] Update Interpreter tests. 2024-09-27 22:42:01 -07:00
Andrew Trick
2ed7ca9426 Fix convenience_init_peer_delegation.swift; avoid specialization.
Fixes rdar://133393259
(Swift CI: test: Interpreter/convenience_init_peer_delegation.swift)
2024-09-13 20:13:44 -07:00
Kavon Farvardin
034dab8af2 Merge pull request #76293 from kavon/ncgenerics-opaque-dependent-conformance-mangling
ASTMangler: skip mangling Copyable dependents
2024-09-09 18:20:32 -07:00
Kavon Farvardin
6f6a46f225 ASTMangler: skip mangling Copyable dependents
Typically, a conformance that is dependent on a conformance to a marker
protocol never reaches this point in the compiler, where we're mangling
the metadata for an opaque return type.

But with the invertible protocols like Copyable, we do permit them, so
we should avoid mangling Copyable as that's generally ABI incompatible
with existing code.

resolves rdar://135310019
2024-09-09 14:36:54 -07:00
Alex Hoppen
702474fedf Merge pull request #76312 from ahoppen/disable-parser-round-trip-value-generics
[test] Add `-disable-experimental-parser-round-trip` to value generic tests
2024-09-06 13:43:34 -07:00
Ben Langmuir
44b68cb5dc Merge pull request #75914 from benlangmuir/turn-it-up-to-11
Bump the deployment target for the compiler to macOS 13.0
2024-09-06 13:23:47 -07:00
Alex Hoppen
50a892425d [test] Add -disable-experimental-parser-round-trip to value generic tests
Parsing of integer literals as generic arguments isn’t implemented in SwiftParser yet, blocking swift-syntax PR testing.
2024-09-06 08:16:23 -07:00
Alejandro Alonso
9faf615c88 Add runtime availability checking for value generics 2024-09-04 15:13:51 -07:00
Alejandro Alonso
451e7259a1 Add ValueGenerics experimental feature 2024-09-04 15:13:49 -07:00