Skip to content

Add EscapeAnalysis verification to catch unmapped SILValues. #29410

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 2 commits into from
Jan 24, 2020
Merged

Add EscapeAnalysis verification to catch unmapped SILValues. #29410

merged 2 commits into from
Jan 24, 2020

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Jan 24, 2020

This verification would have prevented the following recent miscompilation:

commit fbe38ce
Fix EscapeAnalysis losing precision during merge.

Only the second commit has new changes.

Noticed via code inspection. This could potentially miscompile, but we
haven't seen that happen to my knowledge.

Both value_to_bridge_object and strong_copy_XXX need to escape their
resulting value.

The implementation seemed to assume that it is conservatively correct
simply to avoid building a connection graph node for an value. This is
*not* true. Any value that has a pointer type requires a connection
graph node. The only way to be conservative is to create the value
node *and* point it to an escaping content node.

We can always declare that certain special types are not considered
pointer types, but then we need to handle all conversions from those
types to pointer types by escaping the resulting
pointer. BridgeObjects are often on the performance-critical path.
This verification would have prevented the following recent miscompilation:

  commit fbe38ce
  Fix EscapeAnalysis losing precision during merge.
@atrick atrick requested a review from eeckstein January 24, 2020 01:46
@atrick
Copy link
Contributor Author

atrick commented Jan 24, 2020

@swift-ci test

@atrick
Copy link
Contributor Author

atrick commented Jan 24, 2020

@swift-ci test source compatibility

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

@atrick atrick merged commit 7b611fc into swiftlang:master Jan 24, 2020
@atrick atrick deleted the escape-verify-unmapped branch January 29, 2020 18:05
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