Commit Graph

12816 Commits

Author SHA1 Message Date
Erik Eckstein
2950e4521e SIL: representation for specialized witness tables
The main change here is to associate a witness table with a `ProtocolConformance` instead of a `RootProtocolConformance`.
A `ProtocolConformance` is the base class and can be a `RootProtocolConformance` or a `SpecializedProtocolConformance`.
2024-09-25 19:32:08 +02:00
swift-ci
4a3f5dbeb2 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-25 08:16:11 -07:00
Arnold Schwaighofer
9c929e62ef Merge pull request #76686 from aschwaighofer/large_types_reg2mem_undef
LargeTypesReg2Mem: Map `undef` SIL values to an undefined address on the stack
2024-09-25 08:07:18 -07:00
swift-ci
753b917274 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-25 05:36:07 -07:00
Joe Groff
57a56e5804 IRGen: Set a "not bitwise borrowable" bit in value witnesses for @_rawLayout types.
For types like `Atomic` and `Mutex`, we want to know that even though they are
technically bitwise-takable, they differ from other bitwise-takable types until
this point because they are not also "bitwise-borrowable"; while borrowed,
they are pinned in memory, so they cannot be passed by value as a borrowed
parameter, unlike copyable bitwise-takable types. Add a bit to the value witness
table flags to record this.

Note that this patch does not include any accompanying runtime support for
propagating the flag into runtime-instantiated type metadata. There isn't yet
any runtime functionality that varies based on this flag, so that can
be implemented separately.

rdar://136396806
2024-09-24 19:08:50 -07:00
Arnold Schwaighofer
e909720e4d LargeTypesReg2Mem: Map undef SIL values to an undefined address on the stack
SIL can have undefined values along some path (which dynamically is
never executed).

rdar://136600129
2024-09-24 15:43:38 -07:00
Slava Pestov
0cd27bf7d9 IRGen: Add a FrontendStatsTracer
We didn't measure time spent in IRGen in multi-threaded mode previously.
2024-09-23 17:12:45 -04:00
Konrad `ktoso` Malawski
b9319d80f1 Merge branch 'main' into wip-experimental-isolated-deinit 2024-09-23 09:01:06 +09:00
swift-ci
658a00ce26 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-20 14:14:24 -07:00
Kuba (Brecka) Mracek
4a51cfaf27 Merge pull request #76572 from kubamracek/embedded-class-bound-existentials
[embedded] Introduce class-bound existentials into Embedded Swift
2024-09-20 13:58:06 -07:00
swift-ci
ec742a3482 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-20 10:54:04 -07:00
Arnold Schwaighofer
f1a64571fb Merge pull request #76579 from aschwaighofer/async_frame_pointer_all_option
IRGen: Add an option to force emission of an async context pointer on the stack for leaf funclets
2024-09-20 10:43:59 -07:00
Konrad `ktoso` Malawski
d89347bed0 Merge branch 'main' into wip-experimental-isolated-deinit 2024-09-20 18:34:45 +09:00
swift-ci
ae4fee5d4e Merge remote-tracking branch 'origin/main' into rebranch 2024-09-19 13:54:31 -07:00
Doug Gregor
6039df3a34 Merge pull request #76565 from DougGregor/remove-if-config
Remove IfConfigDecl from the AST
2024-09-19 13:49:03 -07:00
Arnold Schwaighofer
b49e30c01b IRGen: Add an option to force emission of an async context pointer on the stack for leaf funclets
`-Xfrontend -enable-async-frame-pointer-all`

rdar://135746607
2024-09-19 12:28:57 -07:00
Kuba Mracek
6b9a3051e3 [embedded] Introduce class-bound existentials into Embedded Swift
Motivated by need for protocol-based dynamic dispatch, which hasn't been possible in Embedded Swift due to a full ban on existentials. This lifts that restriction but only for class-bound existentials: Class-bound existentials are already (even in desktop Swift) much more lightweight than full existentials, as they don't need type metadata, their containers are typically 2 words only (reference + wtable pointer), don't incur copies (only retains+releases).

Included in this PR:
[x] Non-generic class-bound existentials, executable tests for those.
[x] Extension methods on protocols and using those from a class-bound existential.
[x] RuntimeEffects now differentiate between Existential and ExistentialClassBound.
[x] PerformanceDiagnostics don't flag ExistentialClassBound in Embedded Swift.
[x] WTables are generated in IRGen when needed.

Left for follow-up PRs:
[ ] Generic classes support
2024-09-19 07:49:50 -07:00
swift-ci
e517de766b Merge remote-tracking branch 'origin/main' into rebranch 2024-09-19 05:14:50 -07:00
Doug Gregor
5b2520e379 Remove IfConfigDecl from the AST
The swift-syntax tree retains information about the parsed #if
regions. Drop it from the semantic AST.
2024-09-18 20:51:54 -07:00
Arnold Schwaighofer
e85d6ae818 IRGen: Split async funclets need to be marked noinline to not loose async_entry/return metadata
rdar://134460666
2024-09-18 16:20:54 -07:00
Konrad `ktoso` Malawski
7d1ce789ad Revert "Revert "Isolated synchronous deinit"" 2024-09-17 17:35:38 +09:00
Ben Barham
a7b50f357f Merge remote-tracking branch 'origin/main' into manual-main-merge
Conflicts:
  - `lib/Driver/ToolChains.cpp` conflicting with the `addAllArgs` rename
    for multiple options
2024-09-16 13:53:18 -07:00
Slava Pestov
c86ce649ff IRGen: Small cleanup 2024-09-16 12:30:50 -04:00
Slava Pestov
a62ab6907d IRGen: Workaround for type substitution limitation
If a constrained extension has fewer conformance requirements
than the nominal type declaration, because some of the type
parameters of the nominal type are fixed to concrete types by
the extension, we would run into trouble because interface
type substitution does not correctly handle this case.

Applying an identity substitution map to an interface type
does not look up concrete types in the output generic
signature, so we get back a type parameter that is not valid.

getReducedType() has a hack to deal with this. I'd like to
get rid of the hack and fix interface type substitution to
do this correctly, but until then, this will do.

Fixes https://github.com/swiftlang/swift/issues/76479
2024-09-16 12:30:49 -04:00
Slava Pestov
f35c90a6b7 Merge pull request #76445 from slavapestov/maptypeintocontext
Overhaul mapTypeIntoContext()
2024-09-14 08:45:20 -04:00
Felipe de Azevedo Piovezan
58bbadd28e [DebugInfo] Dont generate line information at the split point of async funclets
Unless there is some meaningful code on the same line as an await call (e.g.
other parts of an expression), there should be no additional line entries
associated with that line on the continuation funclet.

This patch changes codegen to avoid emitting debug location for the "prologue" code
at the start of a funclet, instead of simply copying the debug location of the
split point.
2024-09-13 19:06:56 -07:00
Allan Shortlidge
02dbb96b94 AST: Rename AvailabilityContext to AvailabilityRange.
The generality of the `AvailabilityContext` name made it seem like it
encapsulates more than it does. Really it just augments `VersionRange` with
additional set algebra operations that are useful for availability
computations. The `AvailabilityContext` name should be reserved for something
pulls together more than just a single version.
2024-09-13 16:25:18 -07:00
Arnold Schwaighofer
8e9cd5db68 Merge pull request #76150 from aschwaighofer/async_entry_ret_metadata
IRGen: Add metadata for async funclets denoting frame entry and frame exists
2024-09-13 11:52:00 -07:00
Arnold Schwaighofer
c9c45a1e53 Revert "Merge pull request #74192 from drexin/wip-typed-throws-abi"
This reverts commit 35b2b71475, reversing
changes made to c3b57f24eb.
2024-09-12 11:42:01 -07:00
Arnold Schwaighofer
7955ba9fc6 Revert "Merge pull request #74839 from drexin/wip-130783369"
This reverts commit 4edda08d26, reversing
changes made to ac5763bb50.
2024-09-12 11:37:01 -07:00
Arnold Schwaighofer
9b10362a09 Revert "Merge pull request #74840 from drexin/wip-130781414"
This reverts commit 7feb5927db, reversing
changes made to 4edda08d26.
2024-09-12 11:35:32 -07:00
Arnold Schwaighofer
25bc3875fa Revert "Merge pull request #75072 from drexin/wip-refactor-te-callemission"
This reverts commit 22b6319c71, reversing
changes made to 4e4d547825.
2024-09-12 11:24:10 -07:00
Arnold Schwaighofer
790c2692d4 Revert "Merge pull request #75149 from drexin/wip-ptr-cast-tt"
This reverts commit 32af2f6c19, reversing
changes made to d84a9190a2.
2024-09-12 11:23:42 -07:00
Arnold Schwaighofer
85c5648d6d Revert "Merge pull request #75150 from drexin/wip-130971168"
This reverts commit 8fca31efde, reversing
changes made to 32af2f6c19.
2024-09-12 11:23:15 -07:00
Arnold Schwaighofer
9bebe11183 Revert "Merge pull request #75221 from drexin/wip-129359370"
This reverts commit c11b301188, reversing
changes made to 1921b60ff4.
2024-09-12 11:22:55 -07:00
Arnold Schwaighofer
8be107735e Revert "Merge pull request #75316 from drexin/wip-131960281"
This reverts commit e3577ed266, reversing
changes made to f3acbb079f.
2024-09-12 11:22:14 -07:00
Arnold Schwaighofer
2bc788c102 Revert "Merge pull request #75379 from drexin/wip-132122011"
This reverts commit 618a9bf7c5, reversing
changes made to 448596c03e.
2024-09-12 11:20:14 -07:00
Arnold Schwaighofer
291abb6255 Revert "Merge pull request #75677 from drexin/wip-133006541"
This reverts commit 739c7192ae, reversing
changes made to 7d1c505ae1.
2024-09-12 11:17:55 -07:00
Arnold Schwaighofer
66586a69ad Revert "Merge pull request #76129 from aschwaighofer/irgen_typed_throws_irgenthunk"
This reverts commit dd0de58b52, reversing
changes made to 74b3221042.
2024-09-12 10:33:33 -07:00
Arnold Schwaighofer
55252e5f0b Revert "Merge pull request #76302 from drexin/wip-typed-throws-empty"
This reverts commit cf2af6809e, reversing
changes made to 0c30f5532e.
2024-09-12 10:33:20 -07:00
Arnold Schwaighofer
617a089115 Revert "Merge pull request #76396 from aschwaighofer/async_typed_throws_empty_errors"
This reverts commit ba8b7e44b8, reversing
changes made to 4693a4765f.
2024-09-12 10:31:26 -07:00
Slava Pestov
354a194ad1 IRGen: Use mapConformanceRefIntoContext() in OpaqueTypeDescriptorBuilder 2024-09-12 11:49:59 -04:00
Alejandro Alonso
3b741ee488 Merge pull request #76303 from Azoy/rawlayout-fixes
[IRGen] Collect metadata from like type and add type information when GEPing into raw layouts
2024-09-11 16:25:24 -07:00
Arnold Schwaighofer
ba8b7e44b8 Merge pull request #76396 from aschwaighofer/async_typed_throws_empty_errors
IRGen: Async throwing functions with empty error types pass the error indirectly
2024-09-11 16:02:50 -07:00
Alejandro Alonso
389716a9bb Only collect count information if it's a value parameter 2024-09-11 09:11:15 -07:00
Arnold Schwaighofer
ede9f33c52 Fix the fix 2024-09-11 08:20:48 -07:00
Arnold Schwaighofer
fe15d04505 IRGen: Async throwing functions with empty error types pass the error indirectly
rdar://135304464
2024-09-10 17:33:10 -07:00
Doug Gregor
cd52e2d4e5 Fix ABI mismatch involving Sendable-refining protocols and deployment targets
A change to the way we determined whether a protocol conformance is
"dependent" for marker protocols caused an ABI break for
Sendable-refining protocols built with pre-6.0 Swift compilers. The
fix for this issue (https://github.com/swiftlang/swift/pull/75769)
gated the change on deployment target.

The deployment target change fixed the original problem, then caused a
related issue when a project mixes deployment targets (pre-6.0 and
6.0+) with non-resilient protocols. Exempt non-resilient protocols from
this change so we get consistent behavior.

Fixes rdar://134953989.
2024-09-10 11:40:50 -07:00
Meghana Gupta
a7518ac3d9 Merge pull request #76255 from meg-gupta/disablemangling
Delete lifetime dependence mangling
2024-09-09 19:59:16 -07:00
swift-ci
3cd6e6d181 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-06 11:54:55 -07:00