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
[SR-7139] Support enforcement of exclusive memory accesses in Release builds #49687
Comments
PR: #20302 Enabling run-time exclusivity checking in release modeIt's time to change the compiler default for run-time exclusivity What's changing in Swift 5Exclusivity checking was introduced in Swift 4.0. Compile-time (static) diagnostics catch many common exclusivity In Swift 4.1 and 4.2, compiler diagnostics were gradually strengthened Devin's Swift 4.2 announcement, [Upgrading exclusive access warning to The goal for Swift 5 is to fix the remaining holes in the language This change could impact Swift programs that previously appeared Why we need exclusivity checks.A combination of static and dynamic checks are necessary to enforce 1. Adherence to exclusivity rules removes a common class of As programs scale in size, it becomes increasingly likely for routines func moveElements(from src: inout Set<String>, to dest: inout Set<String>) {
while let e = src.popFirst() {
dest.insert(e)
}
}
class Names {
var nameSet: Set<String> = []
}
func moveNames(from src: Names, to dest: Names) {
moveElements(from: &src.nameSet, to: &dest.nameSet)
} 2. Enforcement eliminates an unspecified behavior rule from the language. Prior to Swift 4, these memory rules were unenforced, making it the 3. Enforcement legalizes performance optimization while protecting A guarantee of exclusivity on `inout` parameters and `mutating` 4. Exclusivity rules are needed to give programmer control of John McCall's Ownership Manifesto intoduces the [Law of Current performance impactOf the 656 public microbenchmarks in the Swift repository, there are
The common pattern in these benchmarks is to define an array of data As a general guideline, avoid performing class property access within |
Additional Detail from JIRA
md5: afc211616daff96bb8fc13ffad465fe5
relates to:
Issue Description:
Exclusivity is currently supported in Debug builds but not in Release builds.
We need to make sure the optimizer works with access markers to support the mode. Further, we would need to evaluate performance impact and minimize it. For example, we will need to fix the optimization passes to handle access markers without missing optimization opportunities. We might also want to add new optimizations to merge and eliminate access scopes.
The text was updated successfully, but these errors were encountered: