Commit Graph

6583 Commits

Author SHA1 Message Date
swift-ci
1b6470ca9c Merge remote-tracking branch 'origin/main' into rebranch 2023-09-20 15:07:15 -07:00
Nate Chandler
43d5743875 [OSSALifeComp] NFC: Extracted visit unreachable.
Extracted the new visitUnreachableLifetimeEnds static member of
OSSALifetimeCompletion from the preexisting
endLifetimeAtUnreachableBlocks which now calls through the former.
2023-09-20 13:40:08 -07:00
Nate Chandler
44b1c54de8 [PrunedLiveness] Added copy constructor.
It's useful to be able to form a second copy of liveness which is
differently pruned by having more instructions added to it, e.g..
2023-09-20 13:40:08 -07:00
Nate Chandler
429090d33e [PrunedLiveness] Gardening: Deleted TODO.
It was already addressed.
2023-09-20 13:40:07 -07:00
Evan Wilde
ae6057984f Revert "Keep certain function that are potentially used in the debugger" 2023-09-20 13:06:12 -07:00
Yuta Saito
c5314bd3af Centralize KeyPath accessor calling convention logic to IRGen
KeyPath's getter/setter/hash/equals functions have their own calling
convention, which receives generic arguments and embedded indices from a
given KeyPath argument buffer.
The convention was previously implemented by:
1. Accepting an argument buffer as an UnsafeRawPointer and casting it to
   indices tuple pointer in SIL.
2. Bind generic arguments info from the given argument buffer while emitting
   prologue in IRGen by creating a new forwarding thunk.

This 2-phase lowering approach was not ideal, as it blocked KeyPath
projection optimization [^1], and also required having a target arch
specific signature lowering logic in SIL-level [^2].

This patch centralizes the KeyPath accessor calling convention logic to
IRGen, by introducing `@convention(keypath_accessor_XXX)` convention in
SIL and lowering it in IRGen. This change unblocks the KeyPath projection
optimization while capturing subscript indices, and also makes it easier
to support WebAssembly target.

[^1]: https://github.com/apple/swift/pull/28799
[^2]: https://forums.swift.org/t/wasm-support/16087/21
2023-09-20 11:25:39 -07:00
Augusto Noronha
3bc42c865e Merge pull request #68558 from augusto2112/keep-funcs-for-debugger
Keep certain function that are potentially used in the debugger
2023-09-20 08:23:46 -07:00
swift-ci
c2d0ed607a Merge remote-tracking branch 'origin/main' into rebranch 2023-09-19 11:33:34 -07:00
Erik Eckstein
ad594f2713 Swift SIL: add some APIs
* `AssignInst`
* `Function.isDestructor`
* `MarkUninitializedInst.kind`
* `Type.isMoveOnly`
* `RefElementAddrInst.isImmutable` and `RefElementAddrInst.set(isImmutable:)`
* `BeginBorrowInst.endBorrows`
* `Context.hadError` and `Context.silStage`
2023-09-19 15:10:30 +02:00
Erik Eckstein
f0b811c45f SIL: add the end_init_let_ref instruction
This instructions marks the point where all let-fields of a class are initialized.
This is important to ensure the correctness of ``ref_element_addr [immutable]`` for let-fields,
because in the initializer of a class, its let-fields are not immutable, yet.
2023-09-19 15:10:30 +02:00
Erik Eckstein
e5eb15dcbe Swift SIL: replace the set_deallocating instruction with begin_dealloc_ref
Codegen is the same, but `begin_dealloc_ref` consumes the operand and produces a new SSA value.
This cleanly splits the liferange to the region before and within the destructor of a class.
2023-09-19 15:10:30 +02:00
Erik Eckstein
83754fa085 Swift SIL: add Builder.createEndCOWMutation 2023-09-19 15:10:30 +02:00
Augusto Noronha
e06ba23c75 Keep certain function that are potentially used in the debugger
Currently, when compiling with no optimizations on, we still delete
functions that are sometimes used in the debugger. For example, users
might want to call functions which are unused, or compiler generated
setters/getters.

rdar://101046198
2023-09-18 13:51:56 -07:00
swift-ci
800adb3c79 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-16 08:33:54 -07:00
Kuba Mracek
50f6430a27 [embedded] Convert thick->thin metatypes on array builtins (copy, take, assign) in mandatory optimizations 2023-09-14 18:09:08 -07:00
swift-ci
f3eb97394b Merge remote-tracking branch 'origin/main' into rebranch 2023-09-13 11:22:12 -07:00
Kuba (Brecka) Mracek
df4f824b02 Merge pull request #68484 from kubamracek/embedded-perfect-bug
[embedded] Fix accidentally reversed logic in isGenericFunction + addAllNonGenericFunctions
2023-09-13 11:16:30 -07:00
swift-ci
ae30cba296 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-13 10:20:48 -07:00
Kuba Mracek
c0750cdd33 [embedded] Fix accidentally reversed logic in isGenericFunction + addAllNonGenericFunctions 2023-09-12 21:27:29 -07:00
Kuba Mracek
d0c2a4ccf8 [embedded] Initial support for generic classes in embedded Swift
- VTableSpecializer, a new pass that synthesizes a new vtable per each observed concrete type used
- Don't use full type metadata refs in embedded Swift
- Lazily emit specialized class metadata (LazySpecializedClassMetadata) in IRGen
- Don't emit regular class metadata for a class decl if it's generic (only emit the specialized metadata)
2023-09-12 09:44:54 -07:00
swift-ci
d754c3ede9 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-07 10:13:42 -07:00
swift-ci
93c42f7a75 Merge pull request #68370 from meg-gupta/fwdops
Add new apis to ForwardingOperation
2023-09-07 10:08:11 -07:00
Meghana Gupta
bacfdbd0b0 Add ForwardingOperation::visitForwardedValues api 2023-09-07 01:17:16 -07:00
Meghana Gupta
79ca1eb1f7 Add ForwardingOperation::getSingleForwardingOperand api 2023-09-07 00:35:14 -07:00
swift-ci
f52fc06ac7 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-06 18:14:46 -07:00
zoecarver
520305332a [embedded] Don't add functions twice; fix a typo. 2023-09-06 10:59:49 -07:00
zoecarver
2d61de8364 [embedded] Introduce RuntimeEffect::Existential and guard diagnostics on embedded feature being enabled. 2023-09-06 10:48:17 -07:00
zoecarver
48513f3c5b [embedded] Introduce isGenericFunction and addAllNonGenericFunctions. 2023-09-06 10:48:17 -07:00
Sophia Poirier
86d368f364 Merge remote-tracking branch 'upstream/main' into fix-rebranch-automerger 2023-08-31 14:10:52 -07:00
Michael Gottesman
37d60a08bb [move-only] Rename mark_must_check -> mark_unresolved_non_copyable_value.
I was originally hoping to reuse mark_must_check for multiple types of checkers.
In practice, this is not what happened... so giving it a name specifically to do
with non copyable types makes more sense and makes the code clearer.

Just a pure rename.
2023-08-30 22:29:30 -07:00
swift-ci
a71f9f0a94 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-29 00:56:07 -07:00
Michael Gottesman
68564f12dc [sendable-non-sendable] When tracking values flow sensitive properties, map a SILValue to the state rather than including the state in the mapping.
Otherwise, we can potentially map the same SILValue twice if its Key state is
slightly different.
2023-08-28 18:39:52 -07:00
swift-ci
86d56fd677 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-24 12:33:30 -07:00
Michael Gottesman
80f4588d0f Merge pull request #68104 from gottesmm/pr-b947139b791a295a9644ab3e87505ccaed9e9259
[send-not-sendable] Eliminate relative includes and add a file header.
2023-08-24 12:17:14 -07:00
swift-ci
5d54a7f351 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-23 15:54:22 -07:00
Michael Gottesman
373a007efa [send-not-sendable] Eliminate relative includes and add a file header.
Specifically, the two routines we were importing relatively were:

1. TypeChecker::conformsToProtocol. I moved this onto a helper routine on
SILType.

2. swift::findOriginalValueType(Expr *). This routine just looks through various
implicit conversions to find the original underlying type. I moved it to a
helper method on Expr.
2023-08-23 14:38:30 -07:00
Nate Chandler
dade867b98 [OpaqueValues] Types with packs remain indirect.
For now, always use indirect convention for types with packs.  This is
motivated by the fact that getting from/setting to a pack currently
requires addresses which aren't materialized for tuples.  In the
fullness of time, these values should be direct in opaque values mode,
but for now it can be postponed.
2023-08-21 20:33:37 -07:00
swift-ci
a643f98929 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-19 20:53:38 -07:00
Michael Gottesman
543063ef0e [silgen] Make ManagedValue::forUnmanaged private and change users to use other more specific APIs.
I have been doing this over the past couple of days in preparation for changing
ManagedValue to specify the type of scope its cleanup is connected to.
2023-08-19 14:11:44 -07:00
swift-ci
174b6bc00c Merge remote-tracking branch 'origin/main' into rebranch 2023-08-18 19:34:12 -07:00
Zak Kent
2abca625d7 Merge branch 'main' into update-immediate 2023-08-18 16:07:14 -07:00
Slava Pestov
c2f1193ae3 Merge pull request #67952 from slavapestov/tuple-conformance-tbd-etc
A pile of mostly unrelated one-liners
2023-08-18 15:31:26 -04:00
Slava Pestov
99d68ba14c IRGen: Some progress toward tuple conformances 2023-08-18 12:12:50 -04:00
zachary0kent
802e63a778 Merge pull request #67973 from zachary0kent/lazy-immediate-globals
[Immediate] JIT'ing Globals
2023-08-18 08:53:18 -07:00
swift-ci
9d38c6b53e Merge remote-tracking branch 'origin/main' into rebranch 2023-08-17 14:34:52 -07:00
nate-chandler
8cab09e429 Merge pull request #67966 from nate-chandler/opaque-values/20230816/1/indirect-pack-tuple-handling
[AddressLowering] Handle indexing into variadic tuples.
2023-08-17 14:20:44 -07:00
Zak Kent
e276c79939 [SIL] [Immediate] Promote linkage of SILFunctions defining requested symbols
Promotes the linkage of `SILFunction`s defining requested symbols,
ensuring they are emitted during IRGen.
2023-08-17 10:11:29 -07:00
zachary0kent
25f078adb5 Merge branch 'main' into lazy-immediate 2023-08-16 19:45:27 -07:00
swift-ci
73cf37d597 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-16 17:33:42 -07:00
Pavel Yaskevich
c38b9b1e08 Merge pull request #67945 from xedin/remove-runtimeMetadata
[Frontend] NFC: Remove code and tests related to rejected @runtimeMetadata feature
2023-08-16 17:16:46 -07:00