Skip to content

[silgen] Change a bunch of self accesses to use true formal evaluation scopes and formal accesses. #7717

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

Conversation

gottesmm
Copy link
Contributor

[silgen] Change a bunch of self accesses to use true formal evaluation scopes and formal accesses.

This is in preparation for removing the +0 self hack.

This commit in more detail does the following:

  1. It adds Formal Evaluation Scopes to certain places where the scopes were
    missing. Specifically:

    a. The SILGenLValue cases are places where we are invoking accessors. In each
    one of these cases, we had a formal evaluation scope in the accessor
    itself, but we did not have a scope that closed over the base access and
    the accessor access. The base access is a formal evaluation in the sense
    that just like with inout bases, we must create a new reference to the
    base and re-destroy the base in a chain of accesses. This is to ensure
    that we do not extend the lifetime of the base inappropriately.

    b. The SILGenPoly case is a place where we have never properly placed a
    Formal Evaluation Scope and have completely been relying on the +0 self
    hack to make sure that archetype callees are properly destroyed
    immediately after a +0 call.

  2. It changes all of the places in SILGen that emit self to using formal access
    cleanups instead of normal cleanups.

rdar://29791263

…n scopes and formal accesses.

This is in preparation for removing the +0 self hack.

This commit in more detail does the following:

1. It adds Formal Evaluation Scopes to certain places where the scopes were
missing. Specifically:

   a. The SILGenLValue cases are places where we are invoking accessors. In each
      one of these cases, we had a formal evaluation scope in the accessor
      itself, but we did not have a scope that closed over the base access and
      the accessor access. The base access is a formal evaluation in the sense
      that just like with inout bases, we must create a new reference to the
      base and re-destroy the base in a chain of accesses. This is to ensure
      that we do not extend the lifetime of the base inappropriately.

   b. The SILGenPoly case is a place where we have never properly placed a
      Formal Evaluation Scope and have completely been relying on the +0 self
      hack to make sure that archetype callees are properly destroyed
      immediately after a +0 call.

2. It changes all of the places in SILGen that emit self to using formal access
cleanups instead of normal cleanups.

rdar://29791263
@gottesmm
Copy link
Contributor Author

@swift-ci Please smoke test and merge

@swift-ci swift-ci merged commit cbdc917 into swiftlang:master Feb 23, 2017
@gottesmm gottesmm deleted the self_access_should_use_formal_evaluation_scopes_and_formal_accesses branch February 23, 2017 19:03
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