Skip to content

Conversation

@slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Jan 8, 2024

We need the self metatype parameter to correctly lower DynamicSelfType in IRGen, so plumb this through to all calls of init accessors, and inside the prolog of an init accessor definition.

This does not break the public ABI, because init accessors are never public. Also for value types, the metatype is thin, so it should not change generated code.

For classes we need the metatype in the general case because of Self, but hopefully in most cases the init accessor can be inlined away and the value_metatype instruction subject to dead code elimination.

Fixes rdar://problem/119822466.

@slavapestov slavapestov force-pushed the fix-119822466 branch 3 times, most recently from 61d5b28 to 71b5983 Compare January 8, 2024 22:07
@slavapestov slavapestov marked this pull request as ready for review January 8, 2024 22:08
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

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

Thank you!

We need the self metatype parameter to correctly lower
DynamicSelfType in IRGen, so plumb this through to all
calls of init accessors, and inside the prolog of an
init accessor definition.

This does not break the public ABI, because init
accessors are never public. Also for value types, the
metatype is thin, so it should not change generated
code.

For classes we need the metatype in the general case
because of `Self`, but hopefully in most cases the
init accessor can be inlined away and the value_metatype
instruction subject to dead code elimination.

Fixes rdar://problem/119822466.
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test Linux

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test Linux

@slavapestov slavapestov merged commit 25789fd into swiftlang:main Jan 10, 2024
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