Skip to content

[IRGen] Outlined value functions that destroy move-only-with-deinit types take and forward those types' metadata. #71799

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

Conversation

nate-chandler
Copy link
Contributor

@nate-chandler nate-chandler commented Feb 22, 2024

When it's needed (for outlined release and destroy functions) by outlined value functions, pass the metadata of generic, noncopyable value types with deinits that appear within the type's layout. Because the deinit takes the metadata for the type being destroyed itself, this is straightforward.

In preparation to sometimes use a metadata collector.
Made a function reasonably debuggable (type -> ty) and renamed
misleading variable (formalType -> astType).
Some outlined functions call deinits for noncopyable values.  These
deinits require the metadata for the full type.

Teach the OutliningMetadataCollector to collect the metadata for these
types, when the new needsDeinit flag is set.

Also add the new needsLayout flag.  For now, all outlined functions need
it.
Given a releasable value which contains a noncopyable value type with a
deinit, that values outlined release function, among other things, must
call the deinit of that noncopyable value type.  In order to do that,
its type metadata must be passed to the value function if it has an
archetype.
@nate-chandler nate-chandler force-pushed the noncopyable-bugs/20240221/2 branch from c209f7b to 36b473d Compare February 22, 2024 03:31
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler marked this pull request as ready for review February 22, 2024 14:53
@nate-chandler nate-chandler merged commit 4154cdb into swiftlang:main Feb 22, 2024
@nate-chandler nate-chandler deleted the noncopyable-bugs/20240221/2 branch February 22, 2024 14:53
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