Skip to content

Embedded: specialized witness tables, part2: support remaining cases of class existentials #76874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Oct 7, 2024

Conversation

eeckstein
Copy link
Contributor

@eeckstein eeckstein commented Oct 4, 2024

This is part 2 of #76669

This PR adds support for

  • existential of protocols with associated types and conformances.
  • base-protocols: inheritance of protocols
  • inherited conformanes: derived classes where the base conforms to a protocol

rdar://135311381

@eeckstein
Copy link
Contributor Author

@swift-ci test

…added to MandatoryPerformanceOptimization's worklist

Do it by passing a closure instead of returning the new witness table.
This allows to add more than one new witness table to the worklist
For example:
```
protocol Base: AnyObject {}
protocol Derived: Base {}

class C: Derived {}

let e: Derived = C()
```
In Embedded Swift, witness method lookup is done from specialized witness tables.
For this to work, the type of witness_method must be specialized as well.
Otherwise the method call would be done with wrong parameter conventions (indirect instead of direct).
…le entries

Associated-type entries are simply skipped.
Associated-conformance entries point to the specialized conformance witness tables.
…ions

In Embedded Swift, witness method lookup is done from specialized witness tables.
For this to work, the type of witness_method must be specialized as well.
Otherwise the method call would be done with wrong parameter conventions (indirect instead of direct).
…ntries when specializing witness-tables

Support associated-type and associated-conformance entries.
This enable existentials with associated types.
@eeckstein eeckstein force-pushed the witnesstable-specialization2 branch from 7beae5a to f769080 Compare October 7, 2024 09:03
@eeckstein
Copy link
Contributor Author

@swift-ci test

That means: derived classes where the base conforms to a protocol
@eeckstein eeckstein force-pushed the witnesstable-specialization2 branch from f769080 to a3e6e86 Compare October 7, 2024 10:25
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein eeckstein merged commit d6e8eb2 into swiftlang:main Oct 7, 2024
5 checks passed
@eeckstein eeckstein deleted the witnesstable-specialization2 branch October 7, 2024 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant