Commit Graph

6718 Commits

Author SHA1 Message Date
Arnold Schwaighofer
4b0328f24f IRGen: Also list specialized generic class' objective c ro data in the dedicated linker section
List the emitted ro_data of specialized generic classes in the
__objc_clsrolist section.

rdar://132354480
2024-07-31 12:52:50 -07:00
Alejandro Alonso
3ebcd23494 Update raw_layout.swift 2024-07-29 08:04:45 -07:00
Alejandro Alonso
0c1b51db97 Update raw_layout.swift 2024-07-28 10:29:59 -07:00
Alejandro Alonso
ca8c90ecc0 Support movesAsLike for the array variant of @_rawLayout 2024-07-28 10:29:57 -07:00
nate-chandler
b74303c214 Merge pull request #75478 from nate-chandler/rdar132473638
[Test] Pass C++ version to clang.
2024-07-25 12:06:39 -07:00
Nate Chandler
d5ab3de544 [Test] Pass C++ version to clang.
Specify that C++17 is used when tests rely on headers that use things
like `is_integral_v`.

rdar://132473638
2024-07-25 08:50:08 -07:00
Erik Eckstein
7bd8aeae4e tests: disable IRGen/nested_generics.swift for arm64e
The check lines don't consider ptrauth

rdar://131554269
2024-07-25 09:02:41 +02:00
Michael Gottesman
1c9a930254 [build-wrangler] Disable test that fails without an optimized_stdlib to get the build green.
rdar://131554269
2024-07-24 11:54:13 -07:00
Allan Shortlidge
66e2f972ab Merge pull request #75432 from tshortli/maccatalyst-upstream
Upstream missing macCatalyst support
2024-07-24 09:58:04 -07:00
Allan Shortlidge
54301e4f0f IRGen: Update AllocStackHoisting for macCatalyst.
Teach `inhibitsAllocStackHoisting` about the `targetVariantOSVersionAtLeast`
and `targetOSVersionOrVariantOSVersionAtLeast` builtins.
2024-07-23 17:00:10 -07:00
Allan Shortlidge
e4331af916 IRGen: Introduce macCatalyst target variant version check builtins. 2024-07-23 17:00:10 -07:00
Allan Shortlidge
bb8a837dcf IRGen: Honor -target-variant flag for zippered macCatalyst binaries. 2024-07-23 17:00:10 -07:00
Kavon Farvardin
5230b19ef6 Test: replace '@_moveOnly' with '~Copyable' 2024-07-23 11:05:33 -07:00
Dario Rexin
e0d9da454c [IRGen] Properly extract values in visitThrowInst for empty error
rdar://132122011

For async functions we have to extract the values, which was not happening when the error type was empty.
2024-07-19 17:01:13 -07:00
Dario Rexin
e3577ed266 Merge pull request #75316 from drexin/wip-131960281
[IRGen] Skip async context params before handling direct error return…
2024-07-17 19:00:46 -07:00
Dario Rexin
99db2dcc61 [IRGen] Skip async context params before handling direct error return values
rdar://131960281

We need to skip the async context params, otherwise we load the wrong parameters.
2024-07-17 15:47:29 -07:00
Kavon Farvardin
fedd5e2977 Merge pull request #74864 from kavon/ncgenerics-runtime-demangling-fix 2024-07-16 13:38:15 -07:00
Dave Lee
ad8b0f3397 [Sema] Allow @_section/@_used in concrete generic context (#75222)
Allow `@_section` and `@_used` to be used in fully constrained extensions.

This aligns with the existing behavior of static properties of generic types. The following is valid:

```swift
extension Array where Element == Int {
  static let specificConstant = 41
}
```

However, adding `@_section` or `@_used` to the above property, will result in an error diagnostic.

This change updates the logic of `@_section`/`@_used` to allow their use when the generic context is fully concrete.
2024-07-16 10:05:15 -07:00
Kavon Farvardin
4060ac86f7 Test: limit to macOS due to target flag 2024-07-16 07:51:01 -07:00
Kavon Farvardin
d755e90236 NCGenerics: limit field metadata heuristic
We have had a heuristic that lets you reflect fields of types, where
the field's type is conditionally Copyable, despite the reflection
infrastructure always copying a field. That heuristic was added to allow
ubiquitous types like Optional in the stdlib to continue to be
reflected, even if the Optional at runtime really isn't Copyable.

As a consequence, we were also allowing reflection of fields containing
user-defined conditionally copyable types, when that's unsafe for no
real benefit, yielding runtime crashes!

I think in that case it's better to fall-back on the non-crashy case of
reflection seeing it as the EmptyTupleType, which isn't inhabited, so it
won't try to copy the field and instead basically skip-over it until a
future runtime supports the reflection safely.

So, this patch limits the dangerous reflection to only stdlib-defined
types, until Mirror and friends are updated.
2024-07-15 22:10:17 -07:00
Kavon Farvardin
76bb266624 NCGenerics: fix runtime demangling strategy
We generally should use the open-coded, metadata function "accessor"
strategy when targeting older runtimes, but if the type is part of
the stdlib, assume the runtime demangler will produce correct
metadata, as the retrofitting of Optional, etc, was done Carefully.

resolves rdar://131337585
2024-07-15 22:10:17 -07:00
Dario Rexin
9b1a82d9ec [IRGen] Add direct error return support for async functions
rdar://129359370

Second part of direct error support. This implements direct errors for async functions. Instead of always returning typed errors indirectly, we are returning them directly when possible.
2024-07-13 17:02:32 -07:00
Ellie Shin
cb776089cb Merge pull request #75154 from swiftlang/elsh/drop-exp-prefix
Drop experimental prefixes from PackageCMO flags.
2024-07-11 12:12:29 -07:00
Dario Rexin
8fca31efde Merge pull request #75150 from drexin/wip-130971168
[IRGen] Don't apply direct error return to functions with indirect result
2024-07-10 21:07:40 -07:00
Dario Rexin
32af2f6c19 Merge pull request #75149 from drexin/wip-ptr-cast-tt
[IRGen] Apply int to ptr conversion for direct error returns if neces…
2024-07-10 20:37:49 -07:00
Ellie Shin
f405ad4b95 Update tests 2024-07-10 19:20:45 -07:00
Ellie Shin
18681c43fb Drop experimental prefixes from PackageCMO flags.
Deprecate experimental- flags with prompts to use the proper flags.

rdar://131498517
2024-07-10 16:19:16 -07:00
Dario Rexin
e3c0bc880c [IRGen] Don't apply direct error return to functions with indirect result
rdar://130971168

Having direct and indirect results on the same function is illegal.
2024-07-10 16:11:03 -07:00
Dario Rexin
11a55de697 [IRGen] Apply int to ptr conversion for direct error returns if necessary
rdar://131494255

When merging a ptr into an int value for direct error return, we have to properly convert it back to a pointer at the callsite
2024-07-10 16:09:39 -07:00
Slava Pestov
7fb943b0f3 test/IRGen/nested_generics.swift also works on arm64 2024-07-09 21:28:10 -04:00
Doug Gregor
21e5066249 Diagnose deployment constraints on type metadata involving typed throws
Fixes the rest of rdar://121530587.
2024-07-03 21:08:54 -07:00
Doug Gregor
9604019c87 Drop typed throws from the mangling in closure and field reflection metadata
This follows what we just did for `@isolated(any)` function types.

Part of rdar://130858222.
2024-07-03 20:14:01 -07:00
John McCall
80e23d377d Merge pull request #74916 from rjmccall/strip-isolated-any-reflection-metadata
Suppress `@isolated(any)` in reflective metadata strings on old targets
2024-07-03 02:41:23 -04:00
John McCall
2c6e0efb9c Suppress @isolated(any) in reflective metadata strings on old targets
Fix another aspect of rdar://129861211
2024-07-02 18:12:20 -04:00
Egor Zhdan
91bef8448a [IRGen] Upstream test changes for pointer authenticated value witness tables
The original change was done by Arnold Schwaighofer.
2024-07-02 18:35:12 +01:00
Egor Zhdan
75a00adcf0 Merge pull request #74625 from swiftlang/egorzhdan/upstream-ptrauth-vwt
[IRGen] Upstream pointer auth for value witness tables
2024-07-01 22:17:59 +01:00
Egor Zhdan
b22057e637 [IRGen] Upstream pointer auth for value witness tables
This makes Swift emit a signed pointer to the value witness table in type metadata.

The original change was done by Varun Gandhi.
2024-07-01 16:38:06 +01:00
Dario Rexin
7feb5927db Merge pull request #74840 from drexin/wip-130781414
[IRGen] Properly convert between ptr and int in typed error mapping
2024-06-28 23:30:01 -07:00
Dario Rexin
4edda08d26 Merge pull request #74839 from drexin/wip-130783369
[IRGen] Always apply error value mapping properly for direct returnin…
2024-06-28 23:29:22 -07:00
Dario Rexin
22fec31574 [IRGen] Properly convert between ptr and int in typed error mapping
rdar://130781414
2024-06-28 16:29:10 -07:00
Dario Rexin
b38a1b7ce7 [IRGen] Always apply error value mapping properly for direct returning typed throws
rdar://130783369

The missing mapping causes the wrong element to be used when the offsets are different.
2024-06-28 16:18:22 -07:00
Nate Chandler
7f1bc308e0 [Test] Loosen checks for arm64e.
rdar://130761556
2024-06-28 11:11:53 -07:00
Xi Ge
fb43cf6ffb Merge pull request #74801 from beccadax/objcimpl-enablement
Enable @objc @implementation (SE-0436) as an ordinary language feature
2024-06-28 09:12:52 -07:00
Becca Royal-Gordon
c19aaddd8c Enable @objc @implementation feature 2024-06-27 14:51:27 -07:00
Yuta Saito
d47ce0705a test: Fix test/IRGen/moveonly_value_functions.sil for 32-bit targets
We cannot assume Int is backed by BuiltIn.Int64 and ptr offset is i64.

Co-authored-by: Nate Chandler <nate_chandler@apple.com>
2024-06-27 17:35:55 +00:00
nate-chandler
0c0fb93389 Merge pull request #74748 from nate-chandler/rdar130612707
[Test] Add regression test.
2024-06-26 18:46:31 -07:00
Becca Royal-Gordon
e701223556 Merge pull request #74719 from beccadax/objcimpl-is-incomplete
Support nil completions in @objcImpl async methods
2024-06-26 14:23:04 -07:00
Nate Chandler
3a2a63ca82 [Test] Add regression test.
Verify that `RecordTypeInfoImpl::initWithTake` only emits a single implementation in the `@_rawLayout(..., movesAsLike)` case.

rdar://130612707
2024-06-26 12:42:23 -07:00
Becca Royal-Gordon
01a90cc99b Support nil completions in @objcImpl async methods
An async @objc method only checks if its completion handler parameter is null if ClangImporter forces it to. This is fine for @objc with a generated header, because the generated header always declares the parameter _Nonnull, but clients ignore that annotation and pass nil anyway often enough that for @objc @implementation, we ought to be defensive.

We can achieve this by simply making the completion handler’s type Optional—SILGen already looks for this and knows what to do when it sees it.

Fixes rdar://130527373.
2024-06-25 20:36:41 -07:00
Becca Royal-Gordon
aab28eec4a [NFC] Split up complex CHECKs in objcImpl test
Should make it easier to isolate failures in this test in the future.
2024-06-25 18:31:54 -07:00