Skip to content

Commit 9e0b615

Browse files
committed
Add a comment on liveness terminology
1 parent 6861b31 commit 9e0b615

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

include/swift/SIL/OwnershipUtils.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,36 @@
99
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
1010
//
1111
//===----------------------------------------------------------------------===//
12+
///
13+
/// Terminology:
14+
///
15+
/// Simple liveness:
16+
/// - Ends at lifetime-ending operations.
17+
/// - Transitively follows guaranteed forwarding operations and address uses
18+
/// within the current scope.
19+
/// - Assumes inner scopes are complete, including borrow and address scopes
20+
/// - Rarely returns AddressUseKind::PointerEscape.
21+
/// - Per-definition dominance holds
22+
/// - Insulates outer scopes from inner scope details. Maintains the
23+
/// invariant that inlining cannot pessimize optimization.
24+
///
25+
/// Transitive liveness
26+
/// - Transitively follows uses within inner scopes, including forwarding
27+
/// operations and address uses.
28+
/// - Much more likely to returns AddressUseKind::PointerEscape
29+
/// - Per-definition dominance holds
30+
/// - Does not assume that any scopes are complete.
31+
///
32+
/// Extended liveness (copy-extension and reborrow-extension)
33+
/// - Extends a live range across lifetime-ending operations
34+
/// - Depending on context: owned values are extended across copies or
35+
/// guaranteed values are extended across reborrows
36+
/// - Copy-extension is used to canonicalize an OSSA lifetime
37+
/// - Reborrow-extension is used to check borrow scopes relative to its inner
38+
/// uses and outer lifetime
39+
/// - Per-definition dominance does not hold
40+
///
41+
//===----------------------------------------------------------------------===//
1242

1343
#ifndef SWIFT_SIL_OWNERSHIPUTILS_H
1444
#define SWIFT_SIL_OWNERSHIPUTILS_H

0 commit comments

Comments
 (0)