Commit Graph

12848 Commits

Author SHA1 Message Date
eeckstein
f9b3302cd5 Merge pull request #71810 from eeckstein/remove-inst-leak-checking
SIL: remove instruction leaks checking
2024-02-22 21:13:14 +01:00
Mishal Shah
cb96ec2893 Merge remote-tracking branch 'origin/main' into bump-swift-version-to-6 2024-02-22 09:44:44 -08:00
eeckstein
d1961e1126 Merge pull request #71808 from eeckstein/global_async_function_pointers
Support statically initialized global async function pointers
2024-02-22 16:44:38 +01:00
Akira Hatanaka
97a814805a [IRGen] Make sure a C++ constructor thunk is called when it's needed (#71790)
This fixes a bug where the thunk for a C++ constructor call wasn't being
called when the constructor was called the second time.
2024-02-22 07:05:07 -08:00
nate-chandler
4154cdb475 Merge pull request #71799 from nate-chandler/noncopyable-bugs/20240221/2
[IRGen] Outlined value functions that destroy move-only-with-deinit types take and forward those types' metadata.
2024-02-22 06:53:05 -08:00
Konrad `ktoso` Malawski
1d44e2e8e0 [Distributed] Undo new record and mangling scheme for dist.p.witnesses (#71801) 2024-02-22 23:02:29 +09:00
Erik Eckstein
3488cd364f SIL: remove instruction leaks checking
It's not thread safe and can cause false alarms in case multiple modules exist in different threads. E.g. when building swiftmodules from interfaces.
The leaking check is not important anymore because the builder APIs enforce that instructions are not leaking.
I.e. it's not possible to create an instruction without inserting it into a basic block. Also, it's not possible to remove an instruction from a block without deleting it.

rdar://122169263
2024-02-22 14:09:11 +01:00
Erik Eckstein
9aff04a65a Support statically initialized global async function pointers
rdar://123327436
2024-02-22 09:38:18 +01:00
Nate Chandler
36b473d365 [IRGen] Pass deinit metadata to outlined release.
Given a releasable value which contains a noncopyable value type with a
deinit, that values outlined release function, among other things, must
call the deinit of that noncopyable value type.  In order to do that,
its type metadata must be passed to the value function if it has an
archetype.
2024-02-21 19:31:52 -08:00
Nate Chandler
f3b9dec880 [IRGen] Collect nc deinit metadata for outlining.
Some outlined functions call deinits for noncopyable values.  These
deinits require the metadata for the full type.

Teach the OutliningMetadataCollector to collect the metadata for these
types, when the new needsDeinit flag is set.

Also add the new needsLayout flag.  For now, all outlined functions need
it.
2024-02-21 19:31:52 -08:00
Arnold Schwaighofer
e6ca3a670e Merge pull request #71791 from aschwaighofer/large_types_reg2mem_sigh
LargeTypesReg2Mem: Gracefully handle the case when the Container type is deemed small but the Containee is not
2024-02-21 19:12:43 -08:00
Nate Chandler
4cd073a841 [Gardening] IRGen: Marked a function private. 2024-02-21 17:53:34 -08:00
Nate Chandler
1056067e73 [Gardening] IRGen: Tweaked some variable names.
Made a function reasonably debuggable (type -> ty) and renamed
misleading variable (formalType -> astType).
2024-02-21 17:53:34 -08:00
Nate Chandler
f0f9351421 [NFC] IRGen: Extracted callOutlinedRelease.
In preparation to sometimes use a metadata collector.
2024-02-21 17:53:34 -08:00
Nate Chandler
93595e4e86 [NFC] IRGen: Extracted method. 2024-02-21 17:53:34 -08:00
nate-chandler
cccaf012aa Merge pull request #71770 from nate-chandler/rdar123203791
[NFC] IRGen: Extracted TI::withMetadataCollector.
2024-02-21 17:52:54 -08:00
nate-chandler
94b06b4111 Merge pull request #71787 from nate-chandler/noncopyable-bugs/20240221/1
[IRGen] Lower release_value_addr of noncopyable to deinit call.
2024-02-21 17:52:34 -08:00
Pavel Yaskevich
6789506474 [IRGen] Distributed: Skip protocols that don't require witness tables for decodeNextArgument call 2024-02-21 13:29:47 -08:00
Pavel Yaskevich
738ac14489 [IRGen] Distributed: Dispatch decodeNextArgument via witness thunk if concrete decoder is not available
Since distributed actors can now be generic over actor system
it's no longer guaranteed for concrete decoder to be present,
we need to handle that case specifically during accessor emission.
2024-02-21 13:29:47 -08:00
Pavel Yaskevich
c0dc88878c Revert "[IRGen] Distributed: Always invoke decodeNextArgument through witness thunk"
This reverts commit 4d4c80b8ec.
2024-02-21 13:29:47 -08:00
Arnold Schwaighofer
a17d79cd72 LargeTypesReg2Mem: Fix copy_addr optimization
Make sure that the value we store is the loaded value ...
rdar://123340151
2024-02-21 13:26:07 -08:00
Mishal Shah
b8cd763b21 Merge branch 'main' into bump-swift-version-to-6 2024-02-21 12:40:54 -08:00
Arnold Schwaighofer
7f1fc90df7 LargeTypesReg2Mem: Gracefully handle the case when the Container type is deemed small but the Containee is not
rdar://123340151
2024-02-21 12:38:57 -08:00
Ben Barham
ef8825bfe6 Migrate llvm::Optional to std::optional
LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
2024-02-21 11:20:06 -08:00
Nate Chandler
274e7c90fe [IRGen] Lower RVA(mo) to direct deinit call.
When lowering a release_value_addr instruction whose operand is a
value type with a deinit, directly emit a call to the deinit.
2024-02-21 10:56:56 -08:00
Nate Chandler
48e1428f11 [NFC] IRGen: Extracted TI::withMetadataCollector.
Deduplicate some code.
2024-02-21 07:03:41 -08:00
Augusto Noronha
de75f0aa7e Merge pull request #71769 from augusto2112/gen-class-enum
Generate full debug info for generic enums and classes, and emit spare bits mask of MPE enums
2024-02-21 06:34:19 -08:00
Arnold Schwaighofer
aab7c8957e Merge pull request #71767 from aschwaighofer/large_types_reg2mem_c_signature
LargeTypesReg2Mem: Remove overzealous assert
2024-02-21 04:00:34 -08:00
Mishal Shah
b488702cc9 Merge remote-tracking branch 'origin/main' into bump-swift-version-to-6 2024-02-20 21:04:47 -08:00
Augusto Noronha
393849290b [DebugInfo] Emit full DWARF info for generic classes and enums 2024-02-20 20:03:14 -08:00
Arnold Schwaighofer
216b3c8c9d LargeTypesReg2Mem: Remove overzealous assert
Functions with c convention can have large direct arguments that are not
re-written by the LoadableByAddress pass before they get to reg2Mem
optimization.

https://github.com/apple/swift/issues/71757
2024-02-20 16:44:30 -08:00
Augusto Noronha
af1d477674 [DebugInfo] Emit a MultiPayloadEnum's spare bits mask in DWARF 2024-02-20 15:38:46 -08:00
nate-chandler
40a0260c17 Merge pull request #71738 from nate-chandler/noncopyable-bugs/20240219/1/implement-single-payload-enum-deinit
[IRGen] Noncopyable enums dont forward.
2024-02-20 14:59:43 -08:00
Mishal Shah
96d61d3c5c Merge remote-tracking branch 'origin/main' into bump-swift-version-to-6 2024-02-20 14:31:55 -08:00
Pavel Yaskevich
11ef6e58d8 Merge pull request #71659 from xedin/noncopyable-circularity-fixes
[AST/Sema] NonCopyableGenerics: Address some of the request circularity issues
2024-02-20 12:38:16 -08:00
Joe Groff
b9f91144d1 Fix ABI breakage caused by ValueOwnership order change.
The `ABI` headers had accidentally grown an `#include` into compiler headers,
allowing the enum constant values of the `ValueOwnership` enum to leak into
the runtime ABI. Sever this inappropriate relationship by declaring a separate
`ParameterOwnership` enum with ABI-stable values in the ABI headers, and
explicitly converting between the AST and ABI representation where needed.
Fixes rdar://122435628.
2024-02-20 07:55:16 -08:00
Michael Gottesman
a11d5f9ea2 Merge pull request #71693 from gottesmm/transferring-mangling
[transferring] Add mangling support for transferring.
2024-02-19 23:52:57 -08:00
Konrad `ktoso` Malawski
551b07ba80 [Distributed] Fix _executeDistributedTarget ABI (#71725) 2024-02-19 21:23:11 -08:00
Nate Chandler
ca496e46ce [IRGen] Noncopyable enums dont forward.
If a payload is non-copyable, do not use the forward-to-payload strategy
for single-payload enums.
2024-02-19 19:02:06 -08:00
Mishal Shah
af112c1591 Update the Swift version to 6.0 from 5.11 2024-02-19 17:47:16 -08:00
Pavel Yaskevich
b6af269933 [AST] Remove TypeDecl::hasInverse and move canBe{Copyable, Escapable} to NominalTypeDecl` 2024-02-19 13:04:44 -08:00
Michael Gottesman
f4efcec55c [transferring] Add mangling support for transferring.
This includes runtime support for instantiating transferring param/result in
function types. This is especially important since that is how we instantiate
function types like: typealias Fn = (transferring X) -> ().

rdar://123118061
2024-02-19 12:11:57 -08:00
Nate Chandler
d1bd039ebd [IRGen] Use BC TI for resilient conformers.
Resilient types conforming to BitwiseCopyable mostly shouldn't go
through the VWT for value operations, they should just use memcpy.
2024-02-16 11:14:26 -08:00
Nate Chandler
4151f3bc94 [NFC] IRGen: Promote BC TypeInfo to header.
In preparation to use it for resilient conformers.
2024-02-16 11:14:26 -08:00
Konrad `ktoso` Malawski
e9c7f3c382 [Distributed] Target identifiers for protocol calls (#70928) 2024-02-16 07:19:20 -08:00
Becca Royal-Gordon
7aa5b7fd88 Merge pull request #71445 from beccadax/category-error 2024-02-13 11:13:48 -08:00
John McCall
d5142668f4 SIL and IRGen support for @isolated(any). SILGen to come. 2024-02-13 03:04:13 -05:00
Pavel Yaskevich
db020c1486 Merge pull request #71435 from xedin/fix-need-for-adhoc-distributed-requirements
[Distributed] Re-implement ad-hoc requirements into dynamic witness table lookup for `SerializationRequirement` conformance
2024-02-13 00:02:05 -08:00
Allan Shortlidge
b96812513c Merge pull request #71561 from tshortli/warnings
NFC: Address some warnings
2024-02-12 14:59:27 -08:00
Pavel Yaskevich
4d4c80b8ec [IRGen] Distributed: Always invoke decodeNextArgument through witness thunk
`decodeNextArgument` is now a requirement, so thunks should be
always calling that instead of trying to dispatch directly.
2024-02-12 14:26:30 -08:00