Commit Graph

12816 Commits

Author SHA1 Message Date
Kuba Mracek
2babc5d67f [embedded] Use ASTContext directly from IRGenModule 2023-09-24 20:51:51 -07:00
Kuba Mracek
211f613e10 [embedded] Stop emitting metadata for extensions 2023-09-24 20:49:10 -07:00
swift-ci
965bf05a40 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-23 18:56:09 -07:00
Kuba Mracek
fda2a2a65e [embedded] Disallow use of VWTs for take/copy/assign/destroy operations, even under -Osize 2023-09-22 22:54:25 -07:00
swift-ci
33f718de98 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-22 22:17:24 -07:00
Kuba Mracek
3061564563 [embedded] Disable autolinking in embedded Swift 2023-09-21 22:30:52 -07:00
swift-ci
bc73f15add Merge remote-tracking branch 'origin/main' into rebranch 2023-09-21 15:22:08 -07:00
Dario Rexin
70e7df902e Merge pull request #68675 from drexin/wip-remove-nul
[IRGen+Runtime] Remove unnecessary null terminator in layout strings
2023-09-21 14:56:07 -07:00
swift-ci
6637cc5a27 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-21 12:13:50 -07:00
Kavon Farvardin
a69bcf8a61 Merge pull request #67930 from kavon/copyable-requirement
Copyable as a Requirement Against the Machine
2023-09-21 11:49:23 -07:00
Dario Rexin
75f6103898 [IRGen+Runtime] Remove unnecessary null terminator in layout strings
The last offset also signals the end of the layout string, so the null terminator is unnecessary
2023-09-21 10:46:19 -07:00
Evan Wilde
b6ce82ff79 Merge pull request #68656 from apple/revert-68558-keep-funcs-for-debugger
Revert "Keep certain function that are potentially used in the debugger"
2023-09-20 20:11:12 -07:00
Kavon Farvardin
f1142d5da4 [nfc] rename or eliminate isPureMoveOnly APIs
I think from SIL's perspective, it should only worry about whether the
type is move-only. That includes MoveOnlyWrapped SILTypes and regular
types that cannot be copied.

Most of the code querying `SILType::isPureMoveOnly` is in SILGen, where
it's very likely that the original AST type is sitting around already.
In such cases, I think it's fine to ask the AST type if it is
noncopyable. The clarity of only asking the ASTType if it's noncopyable
is beneficial, I think.
2023-09-20 15:23:17 -07:00
swift-ci
1b6470ca9c Merge remote-tracking branch 'origin/main' into rebranch 2023-09-20 15:07:15 -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
eeckstein
97668d5b94 Merge pull request #68349 from eeckstein/let-property-lowering
SIL+Optimizer: a better representation for class let-fields
2023-09-19 20:27:43 +02:00
swift-ci
75488a48d3 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-19 09:14:58 -07: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
09b443d9e3 IRGen: fix emission of constant single-case enums without payload
This is a follow-up of https://github.com/apple/swift/pull/68516 which didn't handle the no-payload case correctly

Fixes a compiler crash

rdar://115666971
2023-09-19 10:28:51 +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
0d132bc4a7 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-18 10:14:22 -07:00
Kuba (Brecka) Mracek
26653a7344 Merge pull request #68564 from kubamracek/embedded-closures
[embedded] Fix compiler asserts when building closures
2023-09-18 10:05:49 -07:00
Egor Zhdan
f0be52accd [cxx-interop] Add conversion to Bool for types that define operator bool()
C++ `operator bool()` is currently imported into Swift as `__convertToBool()`, which shouldn't be used by clients directly.

This adds a new protocol into the C++ stdlib overlay: `CxxConvertibleToBool`, along with an intitializer for `Swift.Bool` taking an instance of `CxxConvertibleToBool`.

rdar://115074954
2023-09-18 14:54:45 +01:00
swift-ci
800adb3c79 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-16 08:33:54 -07:00
Kuba Mracek
a5d5621398 [embedded] Fix compiler asserts when building closures 2023-09-15 18:40:39 -07:00
Kuba Mracek
350107e153 [embedded] Also cover DestroyArray builtin in embedded Swift mode 2023-09-15 06:56:11 -07:00
Kuba Mracek
78a5b68343 [embedded] Emit array builtins (copy, take, assign) as loops to avoid runtime calls 2023-09-14 17:11:35 -07:00
swift-ci
2e2e79810f Merge remote-tracking branch 'origin/main' into rebranch 2023-09-14 09:59:30 -07:00
Erik Eckstein
9cf0229824 IRGen: fix emission of constant single-case enums
Enums which have a single case with a payload were emitted with wrong field alignement into the data section.

Fixes a miscompile:
rdar://115251963
2023-09-14 12:17:06 +02:00
swift-ci
190021146d Merge remote-tracking branch 'origin/main' into rebranch 2023-09-13 21:59:05 -07:00
Alejandro Alonso
60774fb722 Merge pull request #68450 from Azoy/fix-array-like
[IRGen] Some fixes for raw layout types and noncopyable types in the stdlib
2023-09-13 21:49:48 -07:00
swift-ci
ae30cba296 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-13 10:20:48 -07:00
Shubham Sandeep Rastogi
712e87c23c Merge pull request #68441 from rastogishubham/MCCASSwift2
Add driver options to swift to enable MCCAS
2023-09-13 10:18:07 -07:00
Kuba Mracek
6ad968467f [embedded] only track specialized class metadata in embedded mode 2023-09-12 22:34:21 -07:00
Kuba Mracek
56085205d8 [embedded] specialize generic classes based on MetatypeInst too, fix lazy emit assert 2023-09-12 21:24:14 -07:00
Kuba Mracek
e2de477609 [embedded] avoid metadata accessors, fix vtable map, add a diagnostic on non-final generic functions 2023-09-12 16:57:09 -07:00
Shubham Sandeep Rastogi
7a1a3d61ed Add MCCAS options to swift and guard mccas.swift properly
Revert "Revert "Add driver options to swift to enable MCCAS.""

This reverts commit 0e8554bb15.
2023-09-12 14:10:59 -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
Alejandro Alonso
6fde84eb70 Fix size and alignment for fixed 2023-09-11 20:59:46 -07:00
Alejandro Alonso
ab143ee3ee Some fixes for raw layout types and noncopyable types in the stdlib 2023-09-11 20:45:09 -07:00
swift-ci
9977c4ec7f Merge remote-tracking branch 'origin/main' into rebranch 2023-09-11 17:55:02 -07:00
Evan Wilde
0e8554bb15 Revert "Add driver options to swift to enable MCCAS."
This reverts commit 3c949028e8.
2023-09-11 13:36:36 -07:00
Kuba Mracek
51f54b4efb [embedded] add test for calling methods on classes, fix layout 2023-09-11 12:26:01 -07:00
Kuba Mracek
ae63e7549b [embedded] Add support for (non-generic) classes in embedded Swift
- In embedded Swift, classes get a simplified metadata: Basically just a vtable + destructor + superclass pointer.
- Only non-resilient (intended as permanent restriction), non-generic classes (for now) supported.
- Relax the check that prohibits metadata emission and usage to allow classes.
2023-09-11 11:22:11 -07:00
swift-ci
af7aa91358 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-08 19:13:48 -07:00
Slava Pestov
ffbc65c8c4 Merge pull request #68405 from slavapestov/magical-vanishing-tuple-conformances
Magical vanishing tuple conformances
2023-09-08 21:58:53 -04:00