Commit Graph

7 Commits

Author SHA1 Message Date
Erik Eckstein
b68cafb870 SIL: allow casts to class-bound archetypes to be done as scalar-casts instead of address-casts
This allows such casts to be done in embedded swift.

rdar://156302495
2025-07-22 07:04:37 +02:00
Erik Eckstein
23b4c6fc34 embedded: fix specialization of associated conformance entries in witness tables
When creating a specialized witness table, we need to get the right specialized conformance.
In IRGen don't emit associated conformance witness table entries if the protocol is not a class protocol.
In this case the associated type can never be used to create an existential. Therefore such a witness table entry is never used at runtime in embedded swift.

Fixes a compiler crash

rdar://146448091
2025-03-11 11:33:10 +01:00
Kuba Mracek
d8c0c25b4b [embedded] Centralize the OS/target requirements on (most) Embedded Swift tests 2025-01-19 11:44:55 -08:00
Daniel Rodríguez Troitiño
ba68faaed5 [test] Mark tests that use experimental/upcoming features as such
Find all the usages of `--enable-experimental-feature` or
`--enable-upcoming-feature` in the tests and replace some of the
`REQUIRES: asserts` to use `REQUIRES: swift-feature-Foo` instead, which
should correctly apply to depending on the asserts/noasserts mode of the
toolchain for each feature.

Remove some comments that talked about enabling asserts since they don't
apply anymore (but I might had miss some).

All this was done with an automated script, so some formatting weirdness
might happen, but I hope I fixed most of those.

There might be some tests that were `REQUIRES: asserts` that might run
in `noasserts` toolchains now. This will normally be because their
feature went from experimental to upcoming/base and the tests were not
updated.
2024-11-02 11:46:46 -07:00
Erik Eckstein
a3e6e86383 Embedded: support existentials with inherited conformances
That means: derived classes where the base conforms to a protocol
2024-10-07 12:25:18 +02:00
Erik Eckstein
f7aaf7e5a5 MandatoryPerformanceOptimizations: handle all kind of witness-table entries when specializing witness-tables
Support associated-type and associated-conformance entries.
This enable existentials with associated types.
2024-10-07 09:00:32 +02:00
Kuba Mracek
6b9a3051e3 [embedded] Introduce class-bound existentials into Embedded Swift
Motivated by need for protocol-based dynamic dispatch, which hasn't been possible in Embedded Swift due to a full ban on existentials. This lifts that restriction but only for class-bound existentials: Class-bound existentials are already (even in desktop Swift) much more lightweight than full existentials, as they don't need type metadata, their containers are typically 2 words only (reference + wtable pointer), don't incur copies (only retains+releases).

Included in this PR:
[x] Non-generic class-bound existentials, executable tests for those.
[x] Extension methods on protocols and using those from a class-bound existential.
[x] RuntimeEffects now differentiate between Existential and ExistentialClassBound.
[x] PerformanceDiagnostics don't flag ExistentialClassBound in Embedded Swift.
[x] WTables are generated in IRGen when needed.

Left for follow-up PRs:
[ ] Generic classes support
2024-09-19 07:49:50 -07:00