Commit Graph

104 Commits

Author SHA1 Message Date
Devin Coughlin
7d271cb444 [SILDiagnostics] Fix an invalidation crash in DiagnoseStaticExclusivity.
Fix a crash when re-hashing the basic-block map would leave behind a dangling
mutable reference.

The irony that the language feature this pass implements would have caught this
issue statically is not lost on me.
2017-04-11 19:14:32 -07:00
Devin Coughlin
d6b99e17df [SILDiagnostics] Change DiagnoseStaticExclusivity to use PostOrderAnalysis
This allows the analysis to potentially be reused.
2017-04-10 14:40:52 -07:00
Devin Coughlin
8649165372 [SILDiagnostics] Address style feedback in DiagnoseStaticExclusivity
Address the style aspects of Michael's feedback on
https://github.com/apple/swift/pull/8560
2017-04-10 11:35:14 -07:00
Devin Coughlin
bee17f7838 [SILDiagnostics] Add static enforcement of Law of Exclusivity (#8560)
Add a diagnostic pass that emits errors when a violation of the "Law of
Exclusivity" is detected at compile time. The Law of Exclusivity requires
that the access duration of any access to an address not overlap
with an access to the same address unless both accesses are reads.

This pass relies on 'begin_access' and 'end_access' SIL instruction
markers inserted by SILGen to determine when an access to an address begins and
ends. It models the in-progress accesses with a map from storage locations to
the counts of read and write-like accesses in progress for that location.
2017-04-09 21:41:13 -07:00