Skip to content

[6.1] SIL: builtin willThrow does not modify memory or release #78662

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

aschwaighofer
Copy link
Contributor

This enables access enforcement analysis to classify a dynamic begin_access in access patterns (such as the one below) involving a throwing function as not having nested conflicts.

struct Stack {
  var items : [UInt8]

  mutating func pop() throws -> UInt8 {
    guard let item = items.popLast() else { throw SomeErr.err }
    return item
  }
  ...
}

class Container {
  private var ref : Stack

  @inline(never)
  internal func someMethod() throws {
     try ref.pop()
  }
  ...
}

Scope: Performance improvement
Risk: Medium, we are changing the side-effects of willThrow which should not matter all that match. There is a second order effect: other wrongly computed/assigned could now become visible.

Original PR: #78091
Reviewed by: Erik Eckstein

rdar://141182074

(cherry picked from commit fa01d8d)

This enables access enforcement analysis to classify a dynamic begin_access in
access patterns (such as the one below) involving a throwing function as not
having nested conflicts.

```
struct Stack {
  var items : [UInt8]

  mutating func pop() throws -> UInt8 {
    guard let item = items.popLast() else { throw SomeErr.err }
    return item
  }
  ...
}

class Container {
  private var ref : Stack

  @inline(never)
  internal func someMethod() throws {
     try ref.pop()
  }
  ...
}
```

Scope: Performance improvement
Risk: Medium, we are changing the side-effects of willThrow which should
not matter all that match. There is a second order effect: other wrongly
computed/assigned could now become visible.

Original PR: swiftlang#78091
Reviewed by: Erik Eckstein

rdar://141182074

(cherry picked from commit fa01d8d)
@aschwaighofer aschwaighofer requested a review from a team as a code owner January 15, 2025 20:53
@aschwaighofer
Copy link
Contributor Author

@swift-ci test

@aschwaighofer aschwaighofer merged commit fa5461d into swiftlang:release/6.1 Jan 16, 2025
5 checks passed
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