Commit Graph

1692 Commits

Author SHA1 Message Date
Michael Gottesman
4a309575d7 [sil] Rename [moved] flag on debug_value/alloc_stack to moveable_value_debuginfo.
This is in preparation for wiring up debug info support for noncopyable
values. Originally this flag name made sense since it was set when we performed
consume operator checking. Now I am going to use it for noncopyable types as
well. I think the new name uses_moveable_value_debuginfo actually describes what
the flag is supposed to do, tell IRGen that the value may be moved since it
needs to use moveable value debug info emission.
2023-03-19 15:38:42 -07:00
Adrian Prantl
0fa64b53c1 Fix a use-after-free in IRGenSIL.
A StringRef of the name is used as key into a DenseMap.
2023-03-17 17:23:08 -07:00
Meghana Gupta
c0204d33ec Fix IRGen for pointer auth qualified field function pointers when they are null 2023-03-09 19:16:34 -08:00
Adrian Prantl
e6aa779aec Let pack_count helper variables be zero-indexed. 2023-03-06 16:04:18 -08:00
Michael Gottesman
00d54ebaa8 [reference-binding] Add mark_unresolved_reference_binding to signal from SILGen to the pass to check.
Just the SIL part of this.
2023-03-03 17:14:41 -08:00
swift-ci
6a6e06f04d Merge remote-tracking branch 'origin/main' into rebranch 2023-02-23 19:53:16 -08:00
Alex Lorenz
fedf86ff76 Merge pull request #63809 from hyp/eng/exception1
[interop] add itanium ABI support for trapping on uncaught exceptions when making a foreign call
2023-02-23 19:41:43 -08:00
swift-ci
e08b90e925 Merge remote-tracking branch 'origin/main' into rebranch 2023-02-23 08:33:40 -08:00
Joe Groff
136c179b28 Merge pull request #63840 from jckarter/irgen-struct-deinit
IRGen: Use `deinit` to destroy move-only structs that have them.
2023-02-23 08:22:20 -08:00
swift-ci
bb900c39ed Merge remote-tracking branch 'origin/main' into rebranch 2023-02-22 22:53:27 -08:00
Joe Groff
afa5837aeb IRGen: Use deinit to destroy move-only structs that have them.
The `deinit` takes full responsibility for destroying the value, using the
user-defined deinit body and implicitly destroying any remaining resources
not consumed during the deinit.

Remaining to do after this patch:

- Run the deinit for enums
- Pass generic arguments for generic move-only types
- Handle deinits that take their parameter indirectly
- Teach value witness layout about when types are move-only and/or have
  deinits, so that we don't attempt to give move-only types standard
  value witness tables or share box metadata with copyable payloads
2023-02-22 16:48:30 -08:00
Adrian Prantl
97964f1ba9 Emit debug info for pack count parameters. 2023-02-22 16:16:21 -08:00
Adrian Prantl
4aadffe9f5 Describe type pack parameters in debug info. 2023-02-22 16:16:21 -08:00
Alex Lorenz
355f00c5bd [interop] ensure that call to a C++ constructor traps on uncaught exception 2023-02-22 10:59:58 -08:00
Alex Lorenz
1dc0f019bf [interop] add initial support for trapping on uncaught exceptions when making a foreign call 2023-02-21 13:30:18 -08:00
swift-ci
4ef3f893d6 Merge remote-tracking branch 'origin/main' into rebranch 2023-02-16 20:13:47 -08:00
nate-chandler
57ceb506df Merge pull request #63733 from nate-chandler/variadic-generics/irgen/open_pack_element_requirements
[IRGen] Bound all requirements of open_pack_element.
2023-02-16 20:07:35 -08:00
Nate Chandler
6378efee04 [IRGen] Bound all reqs of open_pack_element.
Previously, only the element archetypes that corresponded to the
relevant pack generic parameters were bound, and the wtables that were
bound for them were based on looking up what they conform to.  Here, the
requirements of the generic signature are used to find which archetypes
must be bound to metadata and which conformances must be bound to
wtables.
2023-02-16 15:29:45 -08:00
swift-ci
969a797b1d Merge remote-tracking branch 'origin/main' into rebranch 2023-02-15 12:14:18 -08:00
Erik Eckstein
748264c45f Add a unprotectedStackAlloc builtin
It's like `Builtin.stackAlloc`, but doesn't set the `[stack_protection]` flag on its containing function.
2023-02-15 08:09:38 +01:00
swift-ci
2b5b1424f4 Merge remote-tracking branch 'origin/main' into rebranch 2023-02-11 23:54:59 -08:00
John McCall
a38478724a Add a pack_length SIL instruction for measuring the length of a pack 2023-02-10 21:50:44 -05:00
swift-ci
3b29bbe82e Merge remote-tracking branch 'origin/main' into rebranch 2023-02-09 10:14:46 -08:00
nate-chandler
3b4d03c4ed Merge pull request #63513 from nate-chandler/variadic-generics/irgen/alloc_pack
[IRGen] Lowered de/alloc_pack.
2023-02-09 09:57:54 -08:00
Nate Chandler
da5b5c1ea5 [IRGen] Lowered de/alloc_pack. 2023-02-09 07:24:01 -08:00
swift-ci
962e99f385 Merge remote-tracking branch 'origin/main' into rebranch 2023-02-09 01:13:59 -08:00
Erik Eckstein
cef6ef9a84 SIL: add a debug_step instruction
This instruction can be inserted by Onone optimizations as a replacement for deleted instructions to
ensure that it's possible to single step on its location.
2023-02-09 06:50:05 +01:00
swift-ci
4e70bf848c Merge remote-tracking branch 'origin/main' into rebranch 2023-02-08 19:53:47 -08:00
swift-ci
1bfb3e6e1c Merge pull request #62499 from adrian-prantl/102367872
Add an assertion that verifies the size of cached debug info types.
2023-02-08 19:47:10 -08:00
swift-ci
1a230aefa5 Merge remote-tracking branch 'origin/main' into rebranch 2023-02-08 17:53:33 -08:00
Adrian Prantl
0f4429b224 DebugTypeInfo: Prefer the size of the Storage type derived from the TypeInfo.
Previously type sizes would be inconsistently sourced from either the LLVM type
or the FixedTypeInfo, depending on the call site. This was problematic because
TypeInfo operates with a resolution of whole bytes, which means that types such
as i1 would get a reported as having a size of 8. This patch now asserts that
all occurrences of the same type have the same size as the first, cached
occurence.

To avoid triggering the cached type verification assertion, this patch avoids
caching of storage-sized containers. It also removes the unique identifier from
forward declarations, which could lead to type confusion during LTO.

rdar://102367872
2023-02-08 15:09:53 -08:00
Meghana Gupta
feceaa2ff7 Fix bug during IR generation of a signed access 2023-02-08 12:42:12 -08:00
swift-ci
e36e8b8b4f Merge remote-tracking branch 'origin/main' into rebranch 2023-02-08 08:55:09 -08:00
John McCall
dcf90ba3f3 Merge pull request #63512 from rjmccall/tuple_pack_element_addr
Add the tuple_pack_element_addr SIL instruction
2023-02-08 11:48:23 -05:00
swift-ci
42d238274b Merge remote-tracking branch 'origin/main' into rebranch 2023-02-07 21:54:26 -08:00
Meghana Gupta
5d17c846fa Merge pull request #63475 from meg-gupta/ptrauthaddchanges
Misc changes to support import of structs with ptrauth qualified field function ptrs
2023-02-07 21:37:49 -08:00
swift-ci
93690e0073 Merge remote-tracking branch 'origin/main' into rebranch 2023-02-07 20:53:11 -08:00
Nate Chandler
58954ab405 [IRGen] Added getPackElementSize. 2023-02-07 20:51:03 -08:00
nate-chandler
ddf09369ba Merge pull request #63502 from nate-chandler/variadic-generics/irgen/open_pack_element_witnesses
[IRGen] Bind wtables at open_pack_element.
2023-02-07 20:46:36 -08:00
John McCall
159c653780 Add the tuple_pack_element_addr SIL instruction.
This allows dynamically indexing into tuples.  IRGen not yet
implemented.

I think I'm going to need a type_refine_addr instruction in
order to handle substitutions into the operand type that
eliminate the outer layer of tuple-ness.  Gonna handle that
in a follow-up commit.
2023-02-07 23:22:35 -05:00
Nate Chandler
cd7e675bce [IRGen] Bind wtables at open_pack_element.
Call out to the infrastructure for emitting witness table packs to emit
references to individual witness tables when binding opened archetypes
during open_pack_element.
2023-02-07 12:40:46 -08:00
swift-ci
078a588ac0 Merge remote-tracking branch 'origin/main' into rebranch 2023-02-07 08:52:59 -08:00
Meghana Gupta
75a9137f89 Enclose with begin_access[signed]/end_access during SILGen of implicit value ctor 2023-02-07 00:17:32 -08:00
John McCall
27142e42f6 Add SIL instructions to get and set pack elements 2023-02-07 01:10:15 -05:00
swift-ci
a61d2ef868 Merge remote-tracking branch 'origin/main' into rebranch 2023-02-02 20:36:01 -08:00
nate-chandler
7b317c0f1e Merge pull request #63363 from nate-chandler/variadic-generics/irgen/open_pack_element
[IRGen] Lowered open_pack_element.
2023-02-02 20:26:29 -08:00
Nate Chandler
a442245925 [IRGen] Lowered open_pack_element. 2023-02-02 12:48:40 -08:00
swift-ci
9fd0ce37f4 Merge remote-tracking branch 'origin/main' into rebranch 2023-02-01 18:53:37 -08:00
John McCall
6bf9ac858b Add instructions to allocate and deallocate packs.
Having added these, I'm not entirely sure we couldn't just use
alloc_stack and dealloc_stack.  Well, if we find ourselves adding
a lot of redundancy with those instructions (e.g. around DI), we
can always go back and rip these out.
2023-01-31 22:39:34 -05:00
swift-ci
8ec181f456 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-27 14:14:10 -08:00