Skip to content
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

Disable stack promotion for classes with isolated deinit #76995

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nickolas-pohilets
Copy link
Contributor

This provides a proper fix of the issue, reverting workaround implemented in #76960

@ktoso
Copy link
Contributor

ktoso commented Oct 13, 2024

@swift-ci please smoke test

Copy link
Contributor

@ktoso ktoso left a comment

Choose a reason for hiding this comment

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

Hah, great observation, fix sounds good to me.

Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

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

lgtm

@eeckstein
Copy link
Contributor

eeckstein commented Oct 14, 2024

Thinking about this again, a better fix would be to make this check in EscapeWalker.handleDestroy, because then it would also be correct for other optimizations which use EscapeInfo:

// The object to destroy (= the argument of the destructor) cannot escape itself.

Though, it's a bit more complicated because it also needs to handle structs/tuples/enums which contain a class reference. This can be done by adding a flag in TypeLowering.RecursiveProperties, like done for SILType::isOrContainsRawPointer (which is called by SIL.Type.isTrivialNonPointer).

@ktoso
Copy link
Contributor

ktoso commented Oct 14, 2024

@eeckstein @nickolas-pohilets shall we merge this to resolve the crashes and investigate the follow up alternative approach you’re suggesting, or hold off merging and do the alternative approach instead immediately — wdyt @eeckstein?

@eeckstein
Copy link
Contributor

I'm fine with merging this and doing it the right way in a follow-up. But it would be nice to first file a github issue and reference it in a to-do comment in the stack promotion

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.

3 participants