Commit Graph

12848 Commits

Author SHA1 Message Date
Doug Gregor
446dfbff3e Merge pull request #69741 from DougGregor/typed-throws-minor-fixes
Typed throws minor fixes
2023-11-09 10:17:58 -08:00
Doug Gregor
1a2f521aef [Debug info] Make sure we establish a generic scope for the thrown error type 2023-11-08 14:36:50 -08:00
Michael Gottesman
48b4ca0b24 Merge pull request #69686 from gottesmm/rdar117880194
[region-isolation] When assigning RValues into memory, use tuple_addr_constructor instead of doing it in pieces.
2023-11-07 20:15:58 -08:00
Kavon Farvardin
ab6734aa04 Merge pull request #69590 from kavon/check-if-copyable-inferred
[NoncopyableGenerics] Synthesize conditional conformances
2023-11-07 18:19:23 -08:00
Kuba (Brecka) Mracek
add012cb44 Merge pull request #69682 from kubamracek/embedded-debuginfo-irgen
[embedded] Avoid materializing generic functions for debuginfo purposes in embedded Swift
2023-11-07 13:29:12 -08:00
Mishal Shah
74840cc60a Revert "Add mandatory SIL pass implementing '@_alwaysEmitConformanceMetadata' protocol attribute" 2023-11-06 22:41:12 -08:00
Kuba (Brecka) Mracek
3b5cd06b0a Merge pull request #69674 from eeckstein/fix-generic-embedded-classes
Fix specialization of generic classes in embedded swift
2023-11-06 17:04:29 -08:00
Kavon Farvardin
a9c64baaa3 [Sema] refactor TypeDecl::isNoncopyable
In preparation for reporting whether the inverse marking on a TypeDecl
was inferred instead of explicit.
2023-11-06 15:40:12 -08:00
Kuba Mracek
84561f9e69 [embedded] Avoid materializing generic functions for debuginfo purposes in embedded Swift 2023-11-06 15:37:57 -08:00
Michael Gottesman
6a65c7829e [sil] Add tuple_addr_constructor an instruction that can be used to initial a tuple in memory from individual address and object components.
This commit just introduces the instruction. In a subsequent commit, I am going
to add support to SILGen to emit this. This ensures that when we assign into a
tuple var we initialize it with one instruction instead of doing it in pieces.
The problem with doing it in pieces is that when one is emitting diagnostics it
looks semantically like SILGen actually is emitting code for initializing in
pieces which could be an error.
2023-11-06 15:32:05 -08:00
Artem Chikin
031f1127f8 Merge pull request #69609 from artemcm/AlwaysEmitConformanceMetadataPreservation
Add mandatory SIL pass implementing '@_alwaysEmitConformanceMetadata' protocol attribute
2023-11-06 13:32:07 -08:00
Erik Eckstein
b33bb3828d IRGen: fix the superclass pointer for generic classes in embedded swift
fixes in IRGen crash
2023-11-06 21:08:22 +01:00
swift-ci
6532b23b3e Merge pull request #69591 from kavon/noncopyable-generics-pt3
[NoncopyableGenerics] Basic end-to-end testing (without stdlib).
2023-11-03 13:06:43 -07:00
Artem Chikin
feb5d457f6 Add mandatory SIL pass implementing '@_alwaysEmitConformanceMetadata' protocol attribute
Ensuring that conformances to such protocols must have their type metadata always emitted into the binary, regardless of wheter they are used or `public`.
2023-11-02 09:26:08 -07:00
swift-ci
43634590b1 Merge pull request #69568 from ktoso/wip-prepare-task-executor-protocol
Task Executors: Prepare for new TaskExecutor protocol
2023-11-02 01:50:51 -07:00
Konrad `ktoso` Malawski
c29bffd2be remove buildOrdinaryTaskExecutorRef until we need it 2023-11-02 15:50:43 +09:00
Kavon Farvardin
575f033fdd [IRGen] update isNoncopyable query
resolves rdar://117594962
2023-11-01 16:49:35 -07:00
nate-chandler
789774b547 Merge pull request #69543 from nate-chandler/irgen/print-vwitness-names
[IRGen] NFC: Print value witness names in IR.
2023-11-01 07:20:17 -07:00
Konrad `ktoso` Malawski
5546f4da7b Rename ExecutorRef to SerialExecutorRef 2023-11-01 18:39:44 +09:00
Konrad `ktoso` Malawski
9e75142911 Task Executors: Prepare for new TaskExecutor protocol & builtins 2023-11-01 16:02:39 +09:00
Nate Chandler
88579b233b [IRGen] NFC: Print vwitness name in IR.
It eases reading the code.  Updated a few tests that were overly strict
(requiring registers to be named with only numbers) to accept more
register names.
2023-10-31 15:21:00 -07:00
Slava Pestov
05ccd9734c SIL: Introduce ThrowAddrInst 2023-10-31 16:58:54 -04:00
Alex Lorenz
bd372c2d68 Merge pull request #69473 from hyp/eng/consuming-params
[interop][SwiftToCxx] consuming parameters should be passed using an …
2023-10-30 15:19:28 -07:00
Nuri Amari
5b2e534e56 Merge pull request #69407 from apple/vfe-function-merger-fixes
[swift-vfe][swift-wme] Stop disabling function mergers for Swift VFE / WME
2023-10-30 10:14:31 -07:00
Nate Chandler
3de047479c [Gardening] IRGen: Clarified comments. 2023-10-30 07:49:28 -07:00
Doug Gregor
40e07cf900 [Typed throws] IR generation and runtime support for function type metadata
Extend function type metadata with an entry for the thrown error type,
so that thrown error types are represented at runtime as well. Note
that this required the introduction of "extended" function type
flags into function type metadata, because we would have used the last
bit. Do so, and define one extended flag bit as representing typed
throws.

Add `swift_getExtendedFunctionTypeMetadata` to the runtime to build
function types that have the extended flags and a thrown error type.
Teach IR generation to call this function to form the metadata, when
appropriate.

Introduce all of the runtime mangling/demangling support needed for
thrown error types.
2023-10-29 09:12:32 -07:00
Kavon Farvardin
29acda5136 Merge pull request #69406 from kavon/noncopyable-generics-pt2
[NoncopyableGenerics] handle `~Copyable` in `where`, `some`, and compositions.
2023-10-28 22:36:22 -07:00
Slava Pestov
3b51407224 Merge pull request #69459 from slavapestov/fix-extended-existential-metadata-weak
IRGen: Weak-link references to swift_getExtendedExistentialTypeMetadata()
2023-10-28 11:55:32 -04:00
Alex Lorenz
4e519a8d8b [interop][SwiftToCxx] consuming parameters should be passed using an additional copy
Fixes https://github.com/apple/swift/issues/69372
2023-10-27 17:29:52 -07:00
nate-chandler
137ba61db4 Merge pull request #69400 from nate-chandler/irgen/note-implicitly-completed-metadata
[IRGen] Propagate locally-cached metadata completion to transitive dependencies.
2023-10-27 17:13:25 -07:00
Slava Pestov
c9c0572be5 IRGen: Weak-link references to swift_getExtendedExistentialTypeMetadata()
Fixes rdar://117530421.
2023-10-27 17:36:28 -04:00
Meghana Gupta
3c244c30b0 Merge pull request #69436 from apple/revert-69416-revert-69254-dwarf-version
Revert "Revert "Make the DWARF version emitted by the Swift compiler configurable.""
2023-10-27 13:38:48 -07:00
Nuri Amari
a67b81843b Merge pull request #69434 from apple/vfe-objc-fixes
[swift-vfe] Disable for @objc classes
2023-10-27 12:42:56 -07:00
Nate Chandler
b8990b51e8 [IRGen] Promote generic args to complete.
When metadata record for a generic type is locally cached as ::Complete,
the metadata is known to be complete in that scope.  If it's for a
generic type, being complete means that all of its recursive generic
arguments are also complete.

Previously, though, that fact was not exploited.  So a metadata record
for such an argument which was originally obtained via an incomplete
request would remain cached in that incomplete state even when a generic
type in which it appeared as a generic argument was cached as complete.
At worst, the result was a runtime call (checkMetadataState) to promote
the complete the metadata record for the recursive argument.

Here, when a bound generic type's metadata is locally cached as
complete, its recursive generic arguments are visited; for each such
type for which a metadata record is already locally cached, the
preexisting record is recached as complete.
2023-10-27 12:04:27 -07:00
Saleem Abdulrasool
a94d22e017 Merge pull request #69455 from compnerd/out-in-inout 2023-10-26 22:46:01 -07:00
Saleem Abdulrasool
1cb0099901 IRGen,Serialization: account for transitive dynamic linkage
When building complex projects, there may cases of static libraries
which expose `@inlinable` functions which reference functions from
dynamically linked dependencies. In such a case, we need to consider the
provenance of the `function_ref` when determining the DLL storage for
linkage. We would previously use the deserialised metadata on the
`SILFunction` as there are entities where the `DeclContext` may not be
deserialised. However, this leaves us in a state where we are unable to
determine the actual provenance correctly in some cases. By simply
accessing the parent module directly from the `SILFunction` we ensure
that we properly identify the origin of the function allowing us to
query the DLL storage property. This further allows us to remove the
extra storage required for whether the `SILFunction` is statically
linked.
2023-10-26 18:03:45 -07:00
Alex Lorenz
b527c5923f Merge pull request #69424 from hyp/eng/117494091
[cxx-interop] use raw pointer metadata for dynamic FRT field metadata
2023-10-26 12:54:54 -07:00
Adrian Prantl
5d978b44ca Revert "Revert "Make the DWARF version emitted by the Swift compiler configurable."" 2023-10-26 12:29:18 -07:00
Nuri Amari
87b3127697 [swift-vfe] Disable for @objc classes
Swift methods can be called from Objective-C without a vtable
load, and more importantly without emitting an `llvm.type.checked.load`
instruction. These are effectively virtual callsites that are not
visible to the VFE logic in GlobalDCE.

To to safely enable swift-vfe we must prevent vtables whose functions
are callable from Objective-C from being eliminated.

To do this we ensure such vtables have public vcall_visibility, which
indirectly prevents GlobalDCE from stripping them.
2023-10-26 11:37:10 -07:00
Alex Lorenz
737a623e62 [cxx-interop] use raw pointer metadata for dynamic FRT field metadata
rdar://117494091
2023-10-26 08:19:44 -07:00
Adrian Prantl
2a32ca5944 Revert "Make the DWARF version emitted by the Swift compiler configurable." 2023-10-25 13:28:28 -07:00
Nuri Amari
a2eb58227a [swift-vfe][swift-wme] Stop disabling function mergers for Swift VFE / WME
The Swift and LLVM function mergers were disabled when Swift VFE or WME
are enabled because the function merger did not respect metadata on
calls to `llvm.type.checked.load`. This is no longer the case,
so we can turn these passes back on.
2023-10-25 11:09:47 -07:00
Allan Shortlidge
d0a4f2633c NFC: Fix unused variable warnings. 2023-10-25 09:42:21 -07:00
Adrian Prantl
d19fe381fa Use LLVM definitions for Swift section names (NFC) 2023-10-24 10:58:40 -07:00
Augusto Noronha
8e9c7fd992 Merge pull request #69335 from augusto2112/emit-xi-di-basic
Emit extra inhabitants in debug info for basic types
2023-10-23 16:11:21 -07:00
Kavon Farvardin
66712ce6e0 [Sema] introduce InverseType
This type will become the corresponding type that is resolved for an
`InverseTypeRepr`. This kind of type is not expected to appear past type
 checking (currently, not even past requirement lowering!).
2023-10-23 10:37:22 -07:00
Mishal Shah
aa6a588f45 Merge pull request #69163 from apple/rebranch
Merge `rebranch` into `main` to support `stable/20230725` llvm-project branch
2023-10-23 09:26:37 -07:00
Augusto Noronha
75e45bd024 Emit extra inhabitants in debug info for basic types
To support debugging embedded Swift, we will need to store information
that previously we searched in metadata. Extra inhabitants is one of
those.
2023-10-20 16:14:52 -07:00
swift-ci
b2dcca3e96 Merge pull request #69242 from ktoso/wip-handle-library-evolution-mode-with-distributed-actors
[Distributed] Handle dispatch thunks and superclasses in ad-hoc witness for decodeNextArguent
2023-10-19 23:40:30 -07:00
Konrad `ktoso` Malawski
b542a5dc19 Simplify branching logic 2023-10-20 13:43:46 +09:00