Skip to content

embedded: Fix a few problems with vtable specialization #71579

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 3 commits into from
Feb 14, 2024

Conversation

eeckstein
Copy link
Contributor

  • Make sure to specialize tables of superclasses
    Fixes an IRGen crash if a superclass of a class is generic and not used otherwise.
    rdar://122405558

  • make the ManagedBuffer initializer public in the embedded stdlib
    Otherwise derived classes cannot be specialized.
    Fixes a compile time error when using ManagedBuffer in embedded mode.
    rdar://122414669

  • support printing and parsing specialized vtables

@eeckstein eeckstein requested a review from a team as a code owner February 13, 2024 11:26
@eeckstein eeckstein requested a review from kubamracek February 13, 2024 11:26
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein eeckstein force-pushed the fix-embedded-classes branch from 40aadec to 960a553 Compare February 13, 2024 13:05
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein eeckstein force-pushed the fix-embedded-classes branch from 960a553 to 599da5f Compare February 13, 2024 15:51
@eeckstein
Copy link
Contributor Author

@swift-ci test

if (SILType classTy = vtable->getClassType()) {
superClassTy = classTy.getSuperclass();
} else {
superClassTy = SILType::getPrimitiveObjectType(CanType(vtable->getClass()->getSuperclass()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the CanType() guaranteed to succeed? Maybe getCanonicalType() is safer.

If the vtable refers to a specialized class, a SIL type specifies the bound generic class type:
```
  sil_vtable $G<Int> {
    // ...
  }
```
Fixes an IRGen crash if a superclass of a class is generic and not used otherwise.

rdar://122405558
…edded stdlib

Otherwise derived classes cannot be specialized.

Fixes a compile time error when using ManagedBuffer in embedded mode.
rdar://122414669
@eeckstein eeckstein force-pushed the fix-embedded-classes branch from 599da5f to 75e2f36 Compare February 14, 2024 08:51
@eeckstein
Copy link
Contributor Author

@swift-ci smoke test

@eeckstein eeckstein merged commit 79fcb5e into swiftlang:main Feb 14, 2024
@eeckstein eeckstein deleted the fix-embedded-classes branch February 14, 2024 12:51
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.

2 participants