Commit Graph

2624 Commits

Author SHA1 Message Date
Erik Eckstein
ddea9f6aa0 Optimizer: switch to the new ConstantCapturePropagation pass in the pass pipeline 2025-09-04 08:15:46 +02:00
Dario Rexin
c38db438b2 Merge pull request #83922 from drexin/wip-159143492
[IRGen] Fix computation of spare bits for fixed arrays
2025-08-29 09:21:50 -07:00
Mike Ash
788e3c0138 Merge pull request #83948 from mikeash/objc-getclass-test-availability
[Test] Gate newer objc_getClass tests on OS version.
2025-08-28 20:04:50 -04:00
Dario Rexin
81af291c4f [IRGen] Fix computation of spare bits for fixed arrays
rdar://159143492

Previously all bits after the spare bits of the first element were marked as spare bits. This caused enum tags to be stored in bits used by the payload.
2025-08-28 12:27:40 -07:00
Mike Ash
45f795240e Merge pull request #83951 from mikeash/builtin-bridge-object-test-fix
[Test] Don't test builtin_bridge_object.swift on older OSes.
2025-08-27 18:17:45 -04:00
Dario Rexin
69cafe42a3 Merge pull request #83837 from drexin/wip-157795547
[IRGen] Do not set HasLayoutString flag for non-copyable types requir…
2025-08-27 13:58:59 -07:00
Mike Ash
d82c6a20d5 [Test] Don't test builtin_bridge_object.swift on older OSes.
This test sets a specific target triple which is too new for some older OSes. There's no need to run this test in back-deployment testing, so make it only run when testing a fresh-built runtime.

rdar://159026118
2025-08-27 12:37:19 -04:00
Mike Ash
e1fff8127e [Test] Gate newer objc_getClass tests on OS version.
The last two tests in the NotPresent test check for fixes that went into 5.3. Testing these against earlier runtimes will fail. Add availability checks so we only test when the fix is present.

While we're here, switch the symbolic references test to use indirect references. Direct references are very likely to pass the test even without the fix, as the reference is likely to point to readable memory. Indirect references make this much more likely to crash by then reading and dereferencing a pointer from the memory the relative pointer points to.

rdar://159034772
2025-08-27 11:53:06 -04:00
Dario Rexin
67d0a22e2f [IRGen] Do not set HasLayoutString flag for non-copyable types requiring metadata instantiation
rdar://157795547

When types contain stored properties of resilient types, we instantiate their metadata at runtime. If those types are non-copyable, they won't have layout strings, so we must not set the flag.
2025-08-20 17:12:59 -07:00
Alexis Laferrière
7642d410af Merge pull request #83814 from xymus/cdecl-enum-layout
IRGen: Use C compatible representation for `@cdecl` enums
2025-08-20 10:39:09 -07:00
Alexis Laferrière
a8cf1a477f IRGen: Use C compatible representation for @cdecl enums
https://github.com/swiftlang/swift/issues/83738
2025-08-19 13:40:09 -07:00
Alejandro Alonso
9b67867dbb Restrict existential test to just built 2025-08-19 12:34:14 -07:00
Dario Rexin
3c66c17a37 [Test] Disable Interpreter/typed_throws_abi.swift on back deployment runtime
rdar://158442662

This is not supported on back deployment runtimes.
2025-08-18 11:19:29 -07:00
Mykola (Nickolas) Pokhylets
31470bbd1e Merge pull request #82732 from nickolas-pohilets/mpokhylets/weak-let-feature
Wrap SE-0481 into an upcoming feature until source incompatibilities are resolved
2025-08-14 23:59:28 +02:00
Alexis Laferrière
ddb13d1cf3 Tests: Update tests importing AppKit from the SDK to use a local cache
Tests importing AppKit have a tendency to be flaky when they share a
module cache with other builds using a different set of framework search
flags. Make sure they use a local cache, otherwise the compiler can
reuse incompatible cached modules.

Alternatively, we could align all builds using the same cache to have
exactly the same framework search paths or enable explicit module
builds. I picked the module cache as it's the most reliable solution in
the short and long term.

rdar://142949965
2025-08-11 13:57:28 -07:00
Pavel Yaskevich
387b4ff2d3 [CSSimplify] Skip member access on existential checks if base is existential only due to marker protocols
If the base type is composed with marker protocol(s) i.e.
`<<Type>> & Sendable`, let's skip this check because such
compositions are always opened and simplified down to a
superclass bound post-Sema.

Resolves: rdar://148782046
2025-08-04 17:00:48 -07:00
Mykola Pokhylets
89f8f8b9bf Wrap only changes related to the closure frontend logic 2025-08-02 20:24:46 +02:00
Mykola Pokhylets
ae48446716 Wrap SE-0481 into an upcoming feature until source incompatibilities are resolved 2025-08-02 20:24:21 +02:00
Evan Wilde
de23d4b251 FreeBSD: PIC cdecl_official_run.swift Client.o
Swift defaults to PIC everywhere. The Swift toolchain clang emits PIC
relocatable objects by default without passing `-fPIC` on Linux, so the
emitted Client.o is relocatable. This is not the case on FreeBSD, where
clang uses the static relocation model by default resulting in a link
failure due to mixing relocations with non-relocatable objects.

```
ld.lld: error: relocation R_X86_64_64 cannot be used against local symbol; recompile with -fPIC
```

Passing `-fPIC` where needed.
2025-07-24 15:08:19 -07:00
Alexis Laferrière
3cfd3f9c32 Tests: Fix missing dylib on device in cdecl_implementation_run.swift
rdar://155529527
2025-07-11 09:34:23 -07:00
Alexis Laferrière
e63a1dea0a Tests: Add missing -target clang flags in @cdecl Interpreter tests
rdar://155013885&155529527
2025-07-10 09:21:31 -07:00
Alexis Laferrière
cb3d82094a Merge pull request #82706 from xymus/cdecl-implementation-tests
Sema: Add `@cdecl @implementation` tests
2025-07-09 09:44:09 -07:00
Alexis Laferrière
38f88efe6d Interpreter: Add @cdecl @implementation test variant 2025-07-07 09:52:27 -07:00
Alexis Laferrière
8cf3a824b6 AST: Fix crash on references to @cdecl enums at code generation
Add related end-to-end test.
2025-07-02 11:25:49 -07:00
Slava Pestov
610887cdb4 Re-enable some tests that were disabled a long time ago 2025-06-25 22:07:23 -04:00
Dario Rexin
61581563c8 [Test] Fix Interpreter/layout_string_witnesses_dynamic.swift
rdar://151476435

Two tests incorrectly assigned values to an uninitialized pointer instead of initializing it. This caused crashes on some distros.
2025-06-16 15:16:46 -07:00
Mykola Pokhylets
de3a87c0ab Merge branch 'main' into mpokhylets/weak-let 2025-05-23 17:26:49 +02:00
Slava Pestov
490edfa523 Merge pull request #81564 from slavapestov/fix-issue-78191
IRGen: Fix miscompile when a generic parameter is fixed to a tuple containing a pack
2025-05-21 00:06:59 -04:00
Anthony Latsis
eafc48fb1a [test] Fix REQUIRES line in test 2025-05-20 12:08:44 +01:00
Dario Rexin
b6e7f96c76 Disable layout_string_witnesses_dynamic.swift
rdar://151476435

The test is currently crashing on Amazon Linux 2, so until we have a solution, we are disabling it.
2025-05-19 18:39:34 -07:00
Slava Pestov
f17baefd7a IRGen: Fix miscompile when a generic parameter is fixed to a tuple containing a pack
If you had something like:

    struct G<T> {
      func f<each U>(_: repeat each U) where T == (repeat each U) {}
    }

We would fulfill 'each U' from the metadata for 'G<(repeat each U)>',
by taking apart the tuple metadata for `(repeat each U)` and forming
a pack.

However this code path was only intended to kick in for a tuple
conformance witness thunk. In the general case, this optimization
is not correct, because if 'each U' is substituted with a
one-element pack, the generic argument of `G<(repeat each U)>` is
just that one element's metadata, and not a tuple. In fact, we
cannot distinguish the one-element tuple case, because the wrapped
element may itself be a tuple.

The fix is to just split off FulfillmentMap::searchTupleTypeMetadata()
from searchTypeMetadata(), and only call the former when we're in
the specific situation that requires it.

- Fixes https://github.com/swiftlang/swift/issues/78191.
- Fixes rdar://problem/135325886.
2025-05-16 17:34:11 -04:00
Dario Rexin
ee9c0cc14c Merge pull request #81530 from drexin/wip-151176697
[IRGen] Don't set HasLayoutString flag on non-copyable generic types
2025-05-15 15:27:26 -07:00
Dario Rexin
a904fee7fe [IRGen] Don't set HasLayoutString flag on non-copyable generic types
rdar://151176697

While generic types generally have layout strings (when enabled), non-copyable types don't, so
we have to make sure the flag does not get set.
2025-05-15 10:21:22 -07:00
Mykola Pokhylets
3e0de8672a Removed the feature and made changes unconditional 2025-05-15 10:52:09 +02:00
Mykola Pokhylets
5a69c8ebdb Added REQUIRES: swift_feature_WeakLet 2025-05-15 10:26:27 +02:00
Mykola Pokhylets
26106107eb Updated existing tests to run with feature enabled 2025-05-15 10:26:27 +02:00
Alejandro Alonso
9e24563bb7 Merge pull request #81365 from Azoy/my-existentials
[AST & Runtime] Correctly mangle extended existentials with inverse requirements
2025-05-12 13:21:07 -07:00
Alejandro Alonso
0574c9d254 Fix test to use target cpu 2025-05-08 10:20:16 -07:00
Alejandro Alonso
d26bde798e Start building the runtime demangle tree for extended existentials 2025-05-07 13:56:25 -07:00
Alejandro Alonso
c165509147 Correctly emit inverse proto comps with extended shape symbolic refs 2025-04-30 13:43:01 -07:00
Erik Eckstein
7a5dbdc20b CastOptimizer: don't assume dynamic casts from ObjectiveC classes to unrelated classes will fail
In case of ObjectiveC classes, the runtime type can differ from its declared type.
Therefore a cast between (compile-time) unrelated classes may succeed at runtime.

rdar://149810124
2025-04-30 16:42:42 +02:00
Nate Chandler
bdcf27f583 [Test] Mark that test requires executable_test.
rdar://150103417
2025-04-28 07:36:50 -07:00
nate-chandler
fcebcd31fb Merge pull request #81058 from nate-chandler/rdar149782365
[SILGen] Make eagerMove class init's self lexical.
2025-04-24 06:51:49 -07:00
Nate Chandler
96eb85cc93 [SILGen] Make eagerMove class init's self lexical.
Change the representation for eagerMove classes so that the body of
their deinit runs after the body of their init.

rdar://149782365
2025-04-23 17:16:05 -07:00
Nate Chandler
40bcc74b47 [OSSACanOwned] Don't dead-end extend if consumed.
When the utility is used by the ConsumeOperatorCopyableValuesChecker,
the checker guarantees that the lifetime can end at the consumes, that
there are no uses after those consumes.  In that circumstance, the
utility maintains liveness to those consumes and as far as possible
without introducing a copy everywhere else.

The lack of complete lifetimes has forced the utility to extend liveness
of values to dead-ends.  That extension, however, is in tension with the
use that the checker is putting the utility to.  If there is a dead-end
after a consume, liveness must not be maintained to that dead-end.

rdar://147586673
2025-04-21 18:09:30 -07:00
nate-chandler
2e1494df9f Merge pull request #80701 from nate-chandler/rdar148941214
[CoroutineAccessors] Use yield_once_2 on Darwin and Linux.
2025-04-10 14:46:05 -07:00
Nate Chandler
b76a76bdf1 [CoroutineAccessors] Unwind based on feature.
Now that coroutine kind (and consequently ABI) for the accessors is
keyed off a SIL option, it's no longer possible to read whether a given
SILFunction arose from a read/modify coroutine just by checking its
coroutine kind.  Regardless of ABI, read/modify coroutines may only
unwind (i.e. are only permitted not to "run to completion") if the
relevant experimental (soon to be deleted) feature is enabled.
2025-04-10 07:41:37 -07:00
Nate Chandler
056fbc44c9 [CoroutineAccessors] Control ABI via flag. 2025-04-10 07:41:37 -07:00
Nate Chandler
3f356fa088 [Test] Disable this test for old runtimes.
The test verifies back compatibility of old binaries with new runtimes
and depends on new runtime support.

rdar://148852062
2025-04-08 14:17:23 -07:00
nate-chandler
785759ad6e Merge pull request #80603 from nate-chandler/rdar148641825
[Test] Codesign lib on same line as binary.
2025-04-07 18:27:01 -07:00