Commit Graph

1350 Commits

Author SHA1 Message Date
Nate Chandler
e0ead75622 [CoroutineAccessors] Use typed-malloc. 2025-10-30 03:59:18 -07:00
nate-chandler
580f2e4fd6 Merge pull request #84635 from nate-chandler/rdar161606892
[VariadicGenerics] Fix memeffect of metadata accessor.
2025-10-02 19:14:52 -07:00
Nate Chandler
0c685d07f6 [VariadicGenerics] Fix memeffect of metadata accessor.
The metadata accessor for a variadic generic type takes as arguments
packs of metadata records and witness tables, and each such pack is
passed in a buffer.  So any such accessor is not correctly annotated
`memory(none)`.

rdar://161606892
2025-10-01 15:43:07 -07:00
Ellis Hoag
2c919e138e [ObjC][Gen] Emit ObjC strings to respective sections (#84300)
Clang emits ObjC strings into special sections

d5e7c27d53/clang/lib/CodeGen/CGObjCMac.cpp (L4056-L4072)

As far as I can tell from `CGObjCMac.cpp`:
* types go into `__objc_methtype`
* class, category, and protocol names go into `__objc_classname`
* method names, property names, and property types go into
`__objc_methname`

See also https://github.com/swiftlang/swift/pull/84236.
2025-09-30 08:42:11 -07:00
Slava Pestov
6bf5213d41 Merge pull request #84251 from slavapestov/fix-rdar151171381
Fix @_opaqueReturnTypeOf module interface syntax for parameter packs
2025-09-13 08:44:44 -04:00
Slava Pestov
10fa09cae6 IRGen: Remove a bit of duplicated code 2025-09-12 15:43:31 -04:00
John McCall
fb9a1e301b Fix IRGen to pass complete metadata to various concurrency builtins
Fixes rdar://146155888
2025-09-11 18:27:39 -04:00
Gábor Horváth
56a525b0c9 Merge pull request #84152 from Xazax-hun/add-nullptr-to-metadata
[cxx-interop] Make the size of anonymous types metadata is unchanged
2025-09-08 17:44:43 +01:00
Gabor Horvath
cae23fd098 [cxx-interop] Make the size of anonymous types metadata is unchanged
Add a null pointer to the value witness table instead of completely
skipping emitting the pointer.
2025-09-08 11:51:10 +01:00
John McCall
64d020ec45 [NFC] Introduce a convenience specialization of CanTypeVisitor that
forwards the paired nominal type methods to common implementations.
2025-09-05 14:02:36 -04:00
Gabor Horvath
0c909a8395 [cxx-interop] Basic support for anonymous structs with non-copyable fields
Anonymous structs cannot be copied or moved, these operations only can
happen to their enclosing non-anonymous types. Stop trying to emit
special member functions and value witness tables for these structs.
2025-09-04 15:20:17 +01:00
Dario Rexin
69cafe42a3 Merge pull request #83837 from drexin/wip-157795547
[IRGen] Do not set HasLayoutString flag for non-copyable types requir…
2025-08-27 13:58:59 -07:00
Dario Rexin
67d0a22e2f [IRGen] Do not set HasLayoutString flag for non-copyable types requiring metadata instantiation
rdar://157795547

When types contain stored properties of resilient types, we instantiate their metadata at runtime. If those types are non-copyable, they won't have layout strings, so we must not set the flag.
2025-08-20 17:12:59 -07:00
Egor Zhdan
b440c4ff70 [cxx-interop] Enable reference-counted types on Windows
This enables the use of reference-counted foreign reference types on Windows. As it turns out, the assertion that was failing on Windows previously was unnecessary. This also enabled many of the tests on Windows.

rdar://154694125 / resolves https://github.com/swiftlang/swift/issues/82643
2025-08-20 12:35:10 +01:00
Allan Shortlidge
78f50ba741 AST: Refactor ConditionallyAvailableSubstitutions to use AvailabilityQuery.
Conditionally available opaque return types should support availability
conditions that are evaluated in any availability domain. Update
`ConditionallyAvailableSubstitutions` to model its conditions with
`AvailabilityQuery` instead of assuming that conditions are always a single
version query for the current platform.
2025-08-06 18:01:10 -07:00
Anthony Latsis
f8577a2731 IRGen: Address llvm::Type::getPointerTo deprecation
See https://github.com/llvm/llvm-project/pull/113331.
2025-07-21 12:37:15 +01:00
Konrad 'ktoso' Malawski
1f87f60d6c Revert revert & fix distributed protocol and TBD handling
This reverts a revert that was done internally here https://stashweb.sd.apple.com/projects/DEVTOOLS/repos/swift/pull-requests/8697/overview
and corrects some issues with the reverted code while at it.

This fix is crucial to land for correctness and necessary to fix the
rdar://144568615 which had a fix submitted however that assumed that
THIS change also was present, so the fix submitted for 144568615 is
incomplete without this change as well.

This enables, and adds more TBD testing and was explicitly checked
against the GameKit reproducer project from rdar://144568615.

I will also upstream the necessary parts missing from OSS repo there so
we have alignment between all branches.
2025-06-30 11:13:05 +09:00
Anthony Latsis
1ceeb7089b Merge pull request #82338 from AnthonyLatsis/jepa
ASTBridging: Bridge more enums directly
2025-06-20 23:13:50 +01:00
Anthony Latsis
3e9923f0c0 ASTBridging: Bridge swift::AccessorKind directly 2025-06-19 04:26:52 +01:00
Dario Rexin
5ec58209dc [IRGen] Fix placeholder logic for emission of conditionally inverted protocols
rdar://153681688

Instead fo counting the actual conformances, the logic took the size of the bit field, i.e. used the highest set bit, so when a type had a conditional conformance only on ~Escapable, but not on ~Copyable, it would still add 2 placeholders, but only fill one.
2025-06-18 11:28:13 -07:00
Susana Monteiro
6164af2f46 Merge pull request #81832 from swiftlang/susmonteiro/class-metadata-private-fields
[cxx-interop] Support for printing C++ foreign references
2025-06-11 11:58:45 +01:00
susmonteiro
848fad0021 [cxx-interop] Support for printing C++ foreign references 2025-06-10 12:15:21 +01:00
Konrad 'ktoso' Malawski
30d54531a7 [Distributed] Don't drop dist get accessors from witness tables.
This actually manifested as an pointer auth crash, but the real reason
being is that we messed up the order of elements in the witness table.
If we'd skip the accessor like this, the types we sign/auth with would
no longer align and manifest in a crash.

There is no real reason to skip this entry so we just bring it back, and
avoid making this special in any way.

This unlocks a few tests as well as corrects any distributed+protocol
use where a requirement distributed var was _followed by_ other
requirements.

resolves rdar://125628060
2025-06-05 16:58:00 +09:00
susmonteiro
c3077bfedb [cxx-interop] Ensure field offset vector matches the structs/fields metadata 2025-05-29 18:35:30 +01:00
Susana Monteiro
e805d93d95 Merge pull request #81035 from swiftlang/susmonteiro/metadata-private-fields
[cxx-interop] Fix metadata mismatch regarding fields of structs
2025-05-21 19:25:08 +01:00
susmonteiro
72b13b3b48 [cxx-interop] Fix metadata mismatch regarding fields of structs 2025-05-20 10:15:14 +01:00
Dario Rexin
ee9c0cc14c Merge pull request #81530 from drexin/wip-151176697
[IRGen] Don't set HasLayoutString flag on non-copyable generic types
2025-05-15 15:27:26 -07:00
Dario Rexin
a904fee7fe [IRGen] Don't set HasLayoutString flag on non-copyable generic types
rdar://151176697

While generic types generally have layout strings (when enabled), non-copyable types don't, so
we have to make sure the flag does not get set.
2025-05-15 10:21:22 -07:00
Alejandro Alonso
c165509147 Correctly emit inverse proto comps with extended shape symbolic refs 2025-04-30 13:43:01 -07:00
Konrad 'ktoso' Malawski
957a95be63 [Distributed] Distributed actor usage through protocol with lib-evo must work
This corrects how we were dealing with dispatch thunks -- mostly be
removing a lot of special casing we did but doesn't seem necessary and
instead we correct and emit all the necessary information int TBD.

This builds on  https://github.com/swiftlang/swift/pull/74935 by further refining how we fixed that issue, and adds more regression tests. It also removes a load of special casing of distributed thunks in library evolution mode, which is great.

Resolves and adds regression test for for rdar://145292018

This is also a more proper fix to the previously resolved but in a not-great-way which caused other issues:
- resolves rdar://128284016
- resolves rdar://128310903
2025-04-18 11:21:01 +09:00
nate-chandler
2c335eef5a Merge pull request #80556 from nate-chandler/bug/20250404/2
[IRGen] Fix type of deleted coro error func.
2025-04-07 14:44:03 -07:00
Konrad `ktoso` Malawski
97be02d5b2 [Distributed] Dont emit TBD also for distributed thunks (#80526)
* [Distributed] Accessor must be available cross module in resilient mode

This is an important fix for libraries using @Resolvable in resilient
libraries. Without the fix we're missing an accessor and this will fail
some remote calls which make use of remote calls on resolvable
protocols. This would manifest as missing accessor error thrown by the
executeDistributedTarget function.

resolves rdar://148224780

* Disable test on windows since %env not supported

* [Distributed] Dont emit TBD also for distributed thunks

This resolves pedantic "all" TBD validation issues, i.e. we dont emit
unexpected records anymore - we would before as we only checked for
is_distributed but we also want to skip those for is_distributed_thunk

resolves rdar://128284016
2025-04-07 06:55:19 -07:00
Konrad `ktoso` Malawski
f21d029b82 [Distributed] Accessor must be available cross module in resilient mode (#80523)
* [Distributed] Accessor must be available cross module in resilient mode

This is an important fix for libraries using @Resolvable in resilient
libraries. Without the fix we're missing an accessor and this will fail
some remote calls which make use of remote calls on resolvable
protocols. This would manifest as missing accessor error thrown by the
executeDistributedTarget function.

resolves rdar://148224780

* Disable test on windows since %env not supported
2025-04-07 02:09:23 -07:00
Nate Chandler
ce61e2ea11 [IRGen] Fix type of deleted coro error func.
It was previously erroneously an async function pointer.  Also fix the
name.
2025-04-04 18:18:11 -07:00
nate-chandler
0063af561f Merge pull request #80520 from nate-chandler/general-coro/20250403/1
[CoroutineAccessors] Use async bit in descriptors.
2025-04-04 15:47:19 -07:00
Nate Chandler
66ca0d8d4b [CoroutineAccessors] Use async bit in descriptors.
To facilitate back deployment, make use of the fact that the async bit
has up to now never been set for read and modify accessors and claim
that set bit to indicate that it is a callee-allocated coroutine.  This
has the virtue of being completely back deployable because like async
function pointers coro function pointers must be auth'd and signed as
data.
2025-04-03 19:49:44 -07:00
Slava Pestov
e475b08011 AST: Remove AssociatedType 2025-04-03 17:35:35 -04:00
Slava Pestov
ea05708716 AST: Eliminate GenericEnvironment::mapConformanceRefIntoContext() 2025-04-03 17:35:34 -04: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
Nate Chandler
2cdbfa77bf [DefaultOverrides] IRGen. 2025-03-25 07:22:43 -07:00
Doug Gregor
731f58443c Address review feedback on AbstractConformance in ProtocolConformanceRef 2025-03-23 20:54:39 -07:00
Alastair Houghton
8b15b05c63 Revert "[Concurrency] Provide a Swift interface for custom main and global executors." 2025-03-22 02:38:11 -07:00
Alastair Houghton
8443b5f76c Merge pull request #79789 from al45tair/custom-executors
[Concurrency] Provide a Swift interface for custom main and global executors.
2025-03-21 09:05:03 +00:00
Slava Pestov
8bcd09aaa4 SIL: Preliminary refactoring of SILWitnessTable::AssociatedConformanceWitness
The Protocol field isn't really necessary, because the conformance
stores the protocol. But we do need the substituted subject type
of the requirement, just temporarily, until an abstract conformance
stores its own subject type too.
2025-03-18 19:38:42 -04:00
Alastair Houghton
55afa47bea [Concurrency] More work on the custom executor implementation.
Added an `-executor-factory` argument to the compiler to let you safely
specify the executors you wish to use (by naming a type that returns
them).

Also added some tests of the new functionality.

rdar://141348916
2025-03-13 13:34:41 +00:00
Tony Allevato
97d9ca1a20 Preserve existing printing/mangling behavior for C++ specializations.
Imported C++ template specializations receive identifiers that contain
their type signature; e.g., `X<Y, Z>`. Since this means the identifier
contains non-identifier characters, the new behavior was trying to
escape them with backticks in ASTPrinter, ASTMangler, and the runtime
metadata. This pulls that back to preserve the current behavior for
specifically those types.
2025-03-11 17:26:26 -04:00
Tony Allevato
d94bd80c62 Add support for raw identifiers.
Raw identifiers are backtick-delimited identifiers that can contain any
non-identifier character other than the backtick itself, CR, LF, or other
non-printable ASCII code units, and which are also not composed entirely
of operator characters.
2025-03-11 17:18:43 -04:00
susmonteiro
18ee0ee6f1 [cxx-interop] Use qualified name in import info of clang declarations 2025-03-10 12:39:32 +00:00
Nate Chandler
6581fec9e1 [CoroutineAccessors] PtrAuth. 2025-03-07 11:46:51 -08:00
Nate Chandler
35d06c325d [CoroutineAccessors] Witness and vtable dispatch.
And thunking.
2025-03-07 11:46:50 -08:00