Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
6b8642c
[Distributed] Prevent overloading on async in distributed methods, fo…
ktoso Jul 5, 2022
33f2906
spelling: actions
jsoref Apr 17, 2022
93f7750
spelling: administrators
jsoref Apr 17, 2022
7a889a8
spelling: against
jsoref Apr 17, 2022
a296687
spelling: between
jsoref Apr 17, 2022
a653225
spelling: clazz
jsoref Apr 17, 2022
6af887f
spelling: configuration
jsoref Apr 17, 2022
3d1e901
spelling: definitions
jsoref Apr 17, 2022
f310b33
spelling: describe
jsoref Apr 17, 2022
062f196
spelling: display
jsoref Apr 17, 2022
46eda2b
spelling: equipped
jsoref Apr 17, 2022
01bde49
spelling: forwarded
jsoref Apr 17, 2022
658f441
spelling: heuristic
jsoref Apr 17, 2022
dd47c3b
spelling: includes
jsoref Apr 17, 2022
aaf1ddc
spelling: inherits
jsoref Apr 17, 2022
ca76e2c
spelling: migrate
jsoref Apr 17, 2022
97649ee
spelling: multi
jsoref Apr 17, 2022
6c79195
spelling: nonsensical
jsoref Apr 17, 2022
4eae57f
spelling: optimizer
jsoref Apr 17, 2022
8aa2a99
spelling: option
jsoref Apr 17, 2022
667aba0
spelling: overridden
jsoref Apr 17, 2022
336caae
spelling: package
jsoref Apr 17, 2022
73dc2ec
spelling: parser
jsoref Apr 17, 2022
caad924
spelling: platform
jsoref Apr 17, 2022
c81cad6
spelling: predefined
jsoref Apr 17, 2022
62f8148
spelling: return
jsoref Apr 17, 2022
4611caf
spelling: separately
jsoref Apr 17, 2022
2b5bb20
spelling: simultaneously
jsoref Apr 17, 2022
ca9a199
spelling: specifying
jsoref Apr 17, 2022
f75688f
spelling: that
jsoref Apr 17, 2022
7f04dca
spelling: the
jsoref Apr 17, 2022
de23580
spelling: toolchain
jsoref Apr 17, 2022
aec1cab
spelling: uncategorized
jsoref Apr 17, 2022
50e9ae3
spelling: unsupported
jsoref Apr 17, 2022
5460443
spelling: utility
jsoref Apr 17, 2022
e27ea12
Gardening: Migrate test suite to GH issues (file names): Concurrency
AnthonyLatsis Sep 17, 2022
d32facc
Gardening: Migrate test suite to GH issues (file names): Constraints
AnthonyLatsis Sep 17, 2022
0ab77fb
Gardening: Migrate test suite to GH issues (file names): decl
AnthonyLatsis Sep 18, 2022
ae35f15
Gardening: Migrate test suite to GH issues (file names): Generics
AnthonyLatsis Sep 17, 2022
32e587f
Gardening: Migrate test suite to GH issues (file names): IDE
AnthonyLatsis Sep 17, 2022
9816adc
Gardening: Migrate test suite to GH issues (file names): Interpreter
AnthonyLatsis Sep 17, 2022
1feed1d
Gardening: Migrate test suite to GH issues (file names): multifile
AnthonyLatsis Sep 18, 2022
de35614
Default to building the early SwiftSyntax package.
DougGregor Aug 27, 2022
970baae
[Sema] Do not attempt openning same generic argument twice while chec…
LucianoPAlmeida Sep 19, 2022
e06d1c6
WalkUtils: add two inline elements into the WalkerCache to avoid memo…
eeckstein Sep 16, 2022
2137e41
Swift SIL: add `ProjectedValue`.
eeckstein Sep 19, 2022
eec201c
AccessUtils: Replace the `struct PointerIdentification` with a comput…
eeckstein Sep 19, 2022
572d513
rename `EscapeInfo.swift` -> `EscapeUtils.swift`
eeckstein Sep 19, 2022
a8b5873
Swift Optimizer: improve ergonomics of EscapeUtils
eeckstein Sep 19, 2022
9889f16
EscapeUtils: another small refactoring of the `isEscape` functions
eeckstein Sep 19, 2022
ba46170
Implement type checking for the `#_hasSymbol` directive. The directiv…
tshortli Sep 16, 2022
9c62890
Sema: Temporarily reject if #_hasSymbol in a closure context.
tshortli Sep 19, 2022
2132cc9
[interop][SwiftToCxx] do not use std::move to move the returned C++ v…
hyp Sep 19, 2022
edd8d1c
Merge pull request #61148 from tshortli/type-check-has-symbol
tshortli Sep 19, 2022
cfb6f8c
Add -e flag for new driver (#61171)
beccadax Sep 19, 2022
e584195
SIL: Use the right generic signature for computing SIL function type …
slavapestov Sep 13, 2022
df85825
[Sema|NFC] Rename enum cases to MissingImport
xymus Sep 19, 2022
3002ec3
[Tests|NFC] Update tests to use missing-import naming
xymus Sep 19, 2022
11a9447
[DI] Add a way to determine full initialization points
xedin Sep 19, 2022
5344040
Merge pull request #61188 from hyp/eng/nomove
swift-ci Sep 19, 2022
6c2fad4
[test] Fixing test case types
LucianoPAlmeida Sep 19, 2022
24a4b12
[Sanitizer] Deflake TSan test (#61166)
yln Sep 20, 2022
b3c1339
Merge pull request #60815 from DougGregor/default-build-early-swiftsy…
DougGregor Sep 20, 2022
6bd817c
RequirementMachine: Add -debug-requirement-machine=split-concrete-equ…
slavapestov Sep 19, 2022
658ba01
RequirementMachine: Redo concrete contraction after splitting concret…
slavapestov Sep 20, 2022
7054460
Merge pull request #61183 from eeckstein/escape-utils
eeckstein Sep 20, 2022
78cdf5e
[cxx-interop][SwiftCompilerSources] Use `swift::BuiltinValueKind` ins…
egorzhdan Sep 15, 2022
3f1a30c
[cxx-interop][SwiftCompilerSources] Use `swift::SILAccessKind` instea…
egorzhdan Sep 15, 2022
5f2a641
[cxx-interop][SwiftCompilerSources] Use `swift::SILWitnessTable::Witn…
egorzhdan Sep 15, 2022
ae23892
Merge branch 'main' into wip-prevent-async-overloads-dist
ktoso Sep 20, 2022
372b7b0
[test] Add regression test for SR-307
hamishknight Sep 20, 2022
e458b53
Merge pull request #61180 from LucianoPAlmeida/crash-default
LucianoPAlmeida Sep 20, 2022
be3249d
[Sema] Reject `@objc` functions with incompatible property wrapper in…
drexin Sep 20, 2022
7d28333
IRGen: Sign function pointers passed to swift_(store/get)EnumTagSingl…
aschwaighofer Sep 20, 2022
e979dc2
Merge pull request #59880 from apple/wip-prevent-async-overloads-dist
swift-ci Sep 20, 2022
c87d7ae
Merge pull request #61153 from apple/egorzhdan/scs-enum
egorzhdan Sep 20, 2022
e58e249
[cxx-interop] Do not synthesize `successor()` for immortal types
egorzhdan Sep 20, 2022
238270f
Merge pull request #42458 from jsoref/spelling-utils
tshortli Sep 20, 2022
e8cba2c
Merge pull request #61199 from slavapestov/rqm-redo-concrete-contraction
slavapestov Sep 20, 2022
4c4e3b0
Merge pull request #61063 from slavapestov/sil-function-type-coroutine
slavapestov Sep 20, 2022
009f65e
Merge pull request #61190 from xymus/rename-missing-import
xymus Sep 20, 2022
d643b22
Merge pull request #61200 from hamishknight/regression-test
hamishknight Sep 20, 2022
2b5f901
Revert "Default to building the early SwiftSyntax package."
DougGregor Sep 20, 2022
67e361a
Merge pull request #61205 from apple/egorzhdan/cxx-successor-no-immortal
egorzhdan Sep 20, 2022
101cf45
Merge pull request #61204 from aschwaighofer/sign_function_pointer_fo…
aschwaighofer Sep 20, 2022
6dda91c
Merge pull request #61194 from xedin/DI-full-init-generialization
xedin Sep 20, 2022
1b71154
Merge pull request #61207 from apple/revert-60815-default-build-early…
kavon Sep 20, 2022
9e07e69
Merge pull request #61176 from AnthonyLatsis/migrate-test-suite-to-gh…
AnthonyLatsis Sep 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ struct FunctionUses {

for witnessTable in context.witnessTables {
for entry in witnessTable.entries {
if entry.kind == .method, let f = entry.methodFunction {
if entry.kind == .Method, let f = entry.methodFunction {
markUnknown(f)
}
}
}

for witnessTable in context.defaultWitnessTables {
for entry in witnessTable.entries {
if entry.kind == .method, let f = entry.methodFunction {
if entry.kind == .Method, let f = entry.methodFunction {
markUnknown(f)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ let computeEffects = FunctionPass(name: "compute-effects", {
(function: Function, context: PassContext) in
var argsWithDefinedEffects = getArgIndicesWithDefinedEffects(of: function)

struct IgnoreRecursiveCallVisitor : EscapeInfoVisitor {
struct IgnoreRecursiveCallVisitor : EscapeVisitor {
func visitUse(operand: Operand, path: EscapePath) -> UseResult {
return isOperandOfRecursiveCall(operand) ? .ignore : .continueWalk
}
}
var escapeInfo = EscapeInfo(calleeAnalysis: context.calleeAnalysis, visitor: IgnoreRecursiveCallVisitor())
var newEffects = Stack<ArgumentEffect>(context)
let returnInst = function.returnInstruction

Expand All @@ -47,7 +46,8 @@ let computeEffects = FunctionPass(name: "compute-effects", {
if argsWithDefinedEffects.contains(arg.index) { continue }

// First check: is the argument (or a projected value of it) escaping at all?
if !escapeInfo.isEscapingWhenWalkingDown(object: arg, path: SmallProjectionPath(.anything)) {
if !arg.at(.anything).isEscapingWhenWalkingDown(using: IgnoreRecursiveCallVisitor(),
context) {
newEffects.push(ArgumentEffect(.notEscaping, argumentIndex: arg.index, pathPattern: SmallProjectionPath(.anything)))
continue
}
Expand Down Expand Up @@ -78,7 +78,7 @@ func addArgEffects(_ arg: FunctionArgument, argPath ap: SmallProjectionPath,
// containing one or more references.
let argPath = arg.type.isClass ? ap : ap.push(.anyValueFields)

struct ArgEffectsVisitor : EscapeInfoVisitor {
struct ArgEffectsVisitor : EscapeVisitorWithResult {
enum EscapeDestination {
case notSet
case toReturn(SmallProjectionPath)
Expand Down Expand Up @@ -131,8 +131,8 @@ func addArgEffects(_ arg: FunctionArgument, argPath ap: SmallProjectionPath,
}
}

var walker = EscapeInfo(calleeAnalysis: context.calleeAnalysis, visitor: ArgEffectsVisitor())
if walker.isEscapingWhenWalkingDown(object: arg, path: argPath) {
guard let result = arg.at(argPath).visitByWalkingDown(using: ArgEffectsVisitor(),
context) else {
return false
}

Expand All @@ -142,7 +142,7 @@ func addArgEffects(_ arg: FunctionArgument, argPath ap: SmallProjectionPath,
}

let effect: ArgumentEffect
switch walker.visitor.result {
switch result {
case .notSet:
effect = ArgumentEffect(.notEscaping, argumentIndex: arg.index, pathPattern: argPath)
case .toReturn(let toPath):
Expand Down Expand Up @@ -200,7 +200,7 @@ private
func isExclusiveEscapeToReturn(fromArgument: Argument, fromPath: SmallProjectionPath,
toPath: SmallProjectionPath,
returnInst: ReturnInst, _ context: PassContext) -> Bool {
struct IsExclusiveReturnEscapeVisitor : EscapeInfoVisitor {
struct IsExclusiveReturnEscapeVisitor : EscapeVisitor {
let fromArgument: Argument
let fromPath: SmallProjectionPath
let toPath: SmallProjectionPath
Expand Down Expand Up @@ -228,14 +228,13 @@ func isExclusiveEscapeToReturn(fromArgument: Argument, fromPath: SmallProjection
}
}
let visitor = IsExclusiveReturnEscapeVisitor(fromArgument: fromArgument, fromPath: fromPath, toPath: toPath)
var walker = EscapeInfo(calleeAnalysis: context.calleeAnalysis, visitor: visitor)
return !walker.isEscaping(object: returnInst.operand, path: toPath)
return !returnInst.operand.at(toPath).isEscaping(using: visitor, context)
}

private
func isExclusiveEscapeToArgument(fromArgument: Argument, fromPath: SmallProjectionPath,
toArgumentIndex: Int, toPath: SmallProjectionPath, _ context: PassContext) -> Bool {
struct IsExclusiveArgumentEscapeVisitor : EscapeInfoVisitor {
struct IsExclusiveArgumentEscapeVisitor : EscapeVisitor {
let fromArgument: Argument
let fromPath: SmallProjectionPath
let toArgumentIndex: Int
Expand All @@ -253,8 +252,7 @@ func isExclusiveEscapeToArgument(fromArgument: Argument, fromPath: SmallProjecti
}
let visitor = IsExclusiveArgumentEscapeVisitor(fromArgument: fromArgument, fromPath: fromPath,
toArgumentIndex: toArgumentIndex, toPath: toPath)
var walker = EscapeInfo(calleeAnalysis: context.calleeAnalysis, visitor: visitor)
let toArg = fromArgument.function.arguments[toArgumentIndex]
return !walker.isEscaping(object: toArg, path: toPath)
return !toArg.at(toPath).isEscapingWhenWalkingDown(using: visitor, context)
}

Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,8 @@ func tryPromoteAlloc(_ allocRef: AllocRefInstBase,
if allocRef.isObjC || allocRef.canAllocOnStack {
return false
}
struct DefaultVisitor : EscapeInfoVisitor {}
var ei = EscapeInfo(calleeAnalysis: context.calleeAnalysis, visitor: DefaultVisitor())

// The most important check: does the object escape the current function?
if ei.isEscaping(object:allocRef) {
if allocRef.isEscaping(context) {
return false
}

Expand Down Expand Up @@ -196,21 +193,19 @@ func tryPromoteAlloc(_ allocRef: AllocRefInstBase,
private func getDominatingBlockOfAllUsePoints(context: PassContext,
_ value: SingleValueInstruction,
domTree: DominatorTree) -> BasicBlock {
struct Visitor : EscapeInfoVisitor {
var dominatingBlock: BasicBlock
struct FindDominatingBlock : EscapeVisitorWithResult {
var result: BasicBlock
let domTree: DominatorTree
mutating func visitUse(operand: Operand, path: EscapePath) -> UseResult {
let defBlock = operand.value.definingBlock
if defBlock.dominates(dominatingBlock, domTree) {
dominatingBlock = defBlock
if defBlock.dominates(result, domTree) {
result = defBlock
}
return .continueWalk
}
}

var walker = EscapeInfo(calleeAnalysis: context.calleeAnalysis, visitor: Visitor(dominatingBlock: value.block, domTree: domTree))
_ = walker.isEscaping(object: value)
return walker.visitor.dominatingBlock
return value.visit(using: FindDominatingBlock(result: value.block, domTree: domTree), context)!
}


Expand All @@ -219,11 +214,13 @@ func computeInnerAndOuterLiferanges(instruction: SingleValueInstruction, in domB
/// All uses which are dominated by the `innerInstRange`s begin-block are included
/// in both, the `innerInstRange` and the `outerBlockRange`.
/// All _not_ dominated uses are only included in the `outerBlockRange`.
struct Visitor : EscapeInfoVisitor {
struct Visitor : EscapeVisitorWithResult {
var innerRange: InstructionRange
var outerBlockRange: BasicBlockRange
let domTree: DominatorTree

var result: (InstructionRange, BasicBlockRange) { (innerRange, outerBlockRange) }

init(instruction: Instruction, domBlock: BasicBlock, domTree: DominatorTree, context: PassContext) {
innerRange = InstructionRange(begin: instruction, context)
outerBlockRange = BasicBlockRange(begin: domBlock, context)
Expand All @@ -245,7 +242,7 @@ func computeInnerAndOuterLiferanges(instruction: SingleValueInstruction, in domB
outerBlockRange.insert(defBlock)

// We need to explicitly add predecessor blocks of phi-arguments becaues they
// are not necesesarily visited by `EscapeInfo.walkDown`.
// are not necesesarily visited during the down-walk in `isEscaping()`.
// This is important for the special case where there is a back-edge from the
// inner range to the inner rage's begin-block:
//
Expand All @@ -261,16 +258,11 @@ func computeInnerAndOuterLiferanges(instruction: SingleValueInstruction, in domB
return .continueWalk
}
}

var walker = EscapeInfo(calleeAnalysis: context.calleeAnalysis,
visitor: Visitor(
instruction: instruction,
domBlock: domBlock,
domTree: domTree,
context: context
))
_ = walker.isEscaping(object: instruction)
return (walker.visitor.innerRange, walker.visitor.outerBlockRange)

return instruction.visit(using: Visitor(instruction: instruction,
domBlock: domBlock,
domTree: domTree,
context: context), context)!
}

private extension BasicBlockRange {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private struct StackProtectionOptimization {
mustFixStackNesting: inout Bool, _ context: PassContext) {

// `withUnsafeTemporaryAllocation(of:capacity:_:)` is compiled to a `builtin "stackAlloc"`.
if let bi = instruction as? BuiltinInst, bi.id == .stackAlloc {
if let bi = instruction as? BuiltinInst, bi.id == .StackAlloc {
function.setNeedsStackProtection(context)
return
}
Expand Down Expand Up @@ -332,7 +332,7 @@ private struct StackProtectionOptimization {
/// Moves the value of a `beginAccess` to a temporary stack location, if possible.
private func moveToTemporary(scope beginAccess: BeginAccessInst, mustFixStackNesting: inout Bool,
_ context: PassContext) {
if beginAccess.accessKind != .modify {
if beginAccess.accessKind != .Modify {
// We can only move from a `modify` access.
// Also, read-only accesses shouldn't be subject to buffer overflows (because
// no one should ever write to such a storage).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ let accessDumper = FunctionPass(name: "dump-access", {

private struct AccessStoragePathVisitor : AccessStoragePathWalker {
var walkUpCache = WalkerCache<Path>()
mutating func visit(access: AccessStoragePath) {
print(" Storage: \(access.storage)")
print(" Path: \"\(access.path)\"")
mutating func visit(accessStoragePath: ProjectedValue) {
print(" Storage: \(accessStoragePath.value)")
print(" Path: \"\(accessStoragePath.path)\"")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ let escapeInfoDumper = FunctionPass(name: "dump-escape-info", {

print("Escape information for \(function.name):")

struct Visitor : EscapeInfoVisitor {
var results: Set<String> = Set()
struct Visitor : EscapeVisitorWithResult {
var result: Set<String> = Set()

mutating func visitUse(operand: Operand, path: EscapePath) -> UseResult {
if operand.instruction is ReturnInst {
results.insert("return[\(path.projectionPath)]")
result.insert("return[\(path.projectionPath)]")
return .ignore
}
return .continueWalk
Expand All @@ -37,7 +37,7 @@ let escapeInfoDumper = FunctionPass(name: "dump-escape-info", {
guard let arg = def as? FunctionArgument else {
return .continueWalkUp
}
results.insert("arg\(arg.index)[\(path.projectionPath)]")
result.insert("arg\(arg.index)[\(path.projectionPath)]")
return .walkDown
}
}
Expand All @@ -46,19 +46,17 @@ let escapeInfoDumper = FunctionPass(name: "dump-escape-info", {
for inst in function.instructions {
if let allocRef = inst as? AllocRefInst {

var walker = EscapeInfo(calleeAnalysis: context.calleeAnalysis, visitor: Visitor())
let escapes = walker.isEscaping(object: allocRef)
let results = walker.visitor.results

let res: String
if escapes {
res = "global"
} else if results.isEmpty {
res = " - "
let resultStr: String
if let result = allocRef.visit(using: Visitor(), context) {
if result.isEmpty {
resultStr = " - "
} else {
resultStr = Array(result).sorted().joined(separator: ",")
}
} else {
res = Array(results).sorted().joined(separator: ",")
resultStr = "global"
}
print("\(res): \(allocRef)")
print("\(resultStr): \(allocRef)")
}
}
print("End function \(function.name)\n")
Expand Down Expand Up @@ -90,7 +88,7 @@ let addressEscapeInfoDumper = FunctionPass(name: "dump-addr-escape-info", {
}
}

struct Visitor : EscapeInfoVisitor {
struct Visitor : EscapeVisitor {
let apply: Instruction
mutating func visitUse(operand: Operand, path: EscapePath) -> UseResult {
let user = operand.instruction
Expand All @@ -111,13 +109,14 @@ let addressEscapeInfoDumper = FunctionPass(name: "dump-addr-escape-info", {
for apply in applies {
let path = AliasAnalysis.getPtrOrAddressPath(for: value)

var escapeInfo = EscapeInfo(calleeAnalysis: context.calleeAnalysis, visitor: Visitor(apply: apply))
let escaping = escapeInfo.isEscaping(addressesOf: value, path: path)
print(" \(escaping ? "==>" : "- ") \(apply)")
if value.at(path).isAddressEscaping(using: Visitor(apply: apply), context) {
print(" ==> \(apply)")
} else {
print(" - \(apply)")
}
}
}

var eaa = EscapeAliasAnalysis(calleeAnalysis: context.calleeAnalysis)
// test `canReferenceSameField` for each pair of `fix_lifetime`.
if !valuesToCheck.isEmpty {
for lhsIdx in 0..<(valuesToCheck.count - 1) {
Expand All @@ -127,9 +126,14 @@ let addressEscapeInfoDumper = FunctionPass(name: "dump-addr-escape-info", {
let rhs = valuesToCheck[rhsIdx]
print(lhs)
print(rhs)
if eaa.canReferenceSameField(
lhs, path: AliasAnalysis.getPtrOrAddressPath(for: lhs),
rhs, path: AliasAnalysis.getPtrOrAddressPath(for: rhs)) {

let projLhs = lhs.at(AliasAnalysis.getPtrOrAddressPath(for: lhs))
let projRhs = rhs.at(AliasAnalysis.getPtrOrAddressPath(for: rhs))
let mayAlias = projLhs.canAddressAlias(with: projRhs, context)
assert(mayAlias == projRhs.canAddressAlias(with: projLhs, context),
"canAddressAlias(with:) must be symmetric")

if mayAlias {
print("may alias")
} else {
print("no alias")
Expand Down
Loading