Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1f42677
[Property Wrappers] Lower assign_by_wrapper to re-assignment of the b…
hborla Sep 11, 2020
ab4c584
[Concurrency] Centralize rejection of concurrency-only attributes.
DougGregor Sep 17, 2020
2762405
[Concurrency] Introduce `@actorIndependent` attribute.
DougGregor Sep 18, 2020
66d62ff
stdlib: fix a back-deployment issue for array COW checks with a stdli…
eeckstein Sep 21, 2020
4529990
[runtime] Silence unreachable code warning (#33912)
xwu Sep 21, 2020
3921871
Merge pull request #34009 from eeckstein/fix-cow-checks
swift-ci Sep 21, 2020
0591fa0
[leaks-checker] Add verbose flag to dump out raw output from runtime …
gottesmm Sep 21, 2020
c0375db
Remove TypeResolutionFlags::KnownNonCascadingDependency
CodaFi Jul 24, 2020
7b1a6e4
Merge pull request #33998 from DougGregor/concurrency-actor-independent
DougGregor Sep 21, 2020
259e1a9
Remove UnqualifiedLookupFlags::KnownPrivate
CodaFi Jul 24, 2020
ee35a4f
Remove NameLookupFlags::KnownPrivate
CodaFi Jul 24, 2020
7bee5ff
Remove NLOptions::NL_Known*
CodaFi Jul 24, 2020
934f994
Remove DeclContext::isCascadingContextForLookup
CodaFi Jul 24, 2020
3dd74c1
Remove evaluator::getScopeForAccessLevel
CodaFi Jul 24, 2020
7fb4480
Remove DependencyScope
CodaFi Jul 24, 2020
9e7964f
Remove Reference::cascades
CodaFi Jul 24, 2020
fe5dacb
Remove unnecessary dependency sources
CodaFi Jul 24, 2020
d93c6d8
Remove Cascading Computations from ASTScope
CodaFi Jul 24, 2020
8c913e3
Remove LegacyCascadingDependencies
CodaFi Jul 24, 2020
daeb081
Remove appendHolderOfCascadingMembers
CodaFi Jul 24, 2020
e37b378
Remove DependencyRecorder::Mode
CodaFi Jul 24, 2020
78e78a2
Drop Legacy Tests
CodaFi Jul 24, 2020
1b7c713
[NFC] Only Register Primaries As Dependency Sources
CodaFi Jul 24, 2020
4557b69
Resolve ASTScope Issues
CodaFi Sep 21, 2020
1345a2b
Merge pull request #34010 from gottesmm/pr-77c03dc9163ef877e72f810701…
swift-ci Sep 21, 2020
4d875ee
Merge pull request #33096 from CodaFi/my-private-eyes
CodaFi Sep 21, 2020
62555ec
Drop Cascading Users from FrontendSourceFileDepGraphFactory's Modeling
CodaFi Sep 21, 2020
3cee2af
Remove Cascading Verification from the Dependency Verifier`
CodaFi Sep 21, 2020
41b976f
Drop "cascading" and "private" dependency from the lexicon
CodaFi Sep 21, 2020
d579675
Drop Interface Dependency Key APIs
CodaFi Sep 21, 2020
eea7699
[NFC] Move tests from Driver/PrivateDependencies to Driver/Dependencies
CodaFi Sep 21, 2020
cf2d0d3
Sema: Fix crash on static -vs- non-static witness mismatch with deser…
slavapestov Sep 21, 2020
6ef4b0d
[SILGen] Emit unreachable code diagnostic for single expression closu…
theblixguy Sep 21, 2020
a6d8425
[Test] Re-write the test for SR-13495 to use StblibUnitTest
hborla Sep 21, 2020
58f2ae6
Add a SWIFT_STDLIB_STABLE_ABI flag to be able to build the stdlib wit…
kubamracek Sep 21, 2020
04ddca3
Merge pull request #33923 from hborla/assign-by-wrapper-lowering
hborla Sep 22, 2020
fcd364d
Merge pull request #34012 from slavapestov/fix-witness-matching-crash…
slavapestov Sep 22, 2020
b532e68
Merge pull request #34011 from CodaFi/dont-go-chasing-waterfalls
CodaFi Sep 22, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,6 @@ set(SWIFT_NATIVE_CLANG_TOOLS_PATH "" CACHE STRING
set(SWIFT_NATIVE_SWIFT_TOOLS_PATH "" CACHE STRING
"Path to the directory that contains Swift tools that are executable on the build machine")

option(SWIFT_ENABLE_MODULE_INTERFACES
"Generate .swiftinterface files alongside .swiftmodule files"
TRUE)

option(SWIFT_STDLIB_ENABLE_SIB_TARGETS
"Should we generate sib targets for the stdlib or not?"
FALSE)
Expand Down
16 changes: 14 additions & 2 deletions benchmark/scripts/Benchmark_RuntimeLeaksRunner.in
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,13 @@ class LeaksRunnerResult(perf_test_driver.Result):


class LeaksRunnerBenchmarkDriver(perf_test_driver.BenchmarkDriver):
def __init__(self, binary, xfail_list, num_samples, num_iters):
def __init__(self, binary, xfail_list, num_samples, num_iters, verbose):
perf_test_driver.BenchmarkDriver.__init__(
self, binary, xfail_list, enable_parallel=True
)
self.num_samples = num_samples
self.num_iters = num_iters
self.verbose = verbose

def print_data_header(self, max_test_len):
fmt = "{:<%d}{:<10}{:}" % (max_test_len + 5)
Expand Down Expand Up @@ -120,6 +121,13 @@ class LeaksRunnerBenchmarkDriver(perf_test_driver.BenchmarkDriver):
]
d["objc_count"] = len(d["objc_objects"])

# If we are asked to emit verbose output, do so now.
if self.verbose:
tmp = (data["path"], data["test_name"], d)
sys.stderr.write(
"VERBOSE (%s,%s): %s" % tmp)
sys.stderr.flush()

total_count = d["objc_count"] + d["swift_count"]
return total_count
except Exception:
Expand Down Expand Up @@ -156,13 +164,17 @@ def parse_args():
)
parser.add_argument("-num-samples", type=int, default=2)
parser.add_argument("-num-iters", type=int, default=2)
parser.add_argument("-v", "--verbose", action="store_true",
help="Upon failure, dump out raw result",
dest="verbose")
return parser.parse_args()


if __name__ == "__main__":
args = parse_args()
driver = LeaksRunnerBenchmarkDriver(
SWIFT_BIN_DIR, XFAIL_LIST, args.num_samples, args.num_iters
SWIFT_BIN_DIR, XFAIL_LIST, args.num_samples, args.num_iters,
args.verbose
)
if driver.run(args.filter):
sys.exit(0)
Expand Down
27 changes: 0 additions & 27 deletions docs/DependencyAnalysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,33 +56,6 @@ Note:
> may change its members drastically.


Cascading vs. Non-Cascading Dependencies
========================================

If file A depends on file B, and file B depends on file C, does file A depend
on file C? The answer is: maybe! It depends how file B is using file C. If all
uses are inside function bodies, for example, then changing file C only
requires rebuilding file B, not file A. The terminology here is that file B has
a *non-cascading* dependency on file C.

By contrast, if changing file C affects the interface of file B, then the
dependency is said to be *cascading,* and changing file C would require
rebuilding both file B and file A.

The various dependency tracking throughout the compiler will look at the
context in which information is being used and attempt to determine whether or
not a particular dependency should be considered cascading. If there's not
enough context to decide, the compiler has to go with the conservative choice
and record it as cascading.


Note:

> In the current on-disk representation of dependency information, cascading
> dependencies are the default. Non-cascading dependencies are marked
> `private` by analogy with the Swift `private` keyword.


External Dependencies
=====================

Expand Down
24 changes: 0 additions & 24 deletions docs/Lexicon.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,6 @@ These can usually be directly compared to test whether two types are the
same; the exception is when generics get involved. In this case you'll need
a [generic environment](#generic-environment). Contrast with [sugared type](#sugared-type).

## cascading dependency

A kind of dependency edge relevant to the incremental name tracking
subsystem. A cascading dependency (as opposed to a
[private dependency](#private-dependency) requires the Swift driver to
transitively consider dependency edges in the file that defines the used
name when incremental compilation is enabled. A cascading dependency is much
safer to produce than its private counterpart, but it comes at the cost of
increased usage of compilation resources - even if those resources are being
wasted on rebuilding a file that didn't actually require rebuilding.
See [DependencyAnalysis.md](DependencyAnalysis.md).

## Clang importer

The part of the compiler that reads C and Objective-C declarations and
Expand Down Expand Up @@ -452,18 +440,6 @@ The file currently being compiled, as opposed to the other files that are
only needed for context. See also
[Whole-Module Optimization](#wmo-whole-module-optimization).

## private dependency

A kind of dependency edge relevant to the incremental name tracking
subsystem. A private dependency (as opposed to a
[cascading dependency](#cascading-dependency)) declares a dependency edge
from one file to a name referenced in that file that does not
require further transitive evaluation of dependency edges by the Swift
driver. Private dependencies are therefore cheaper than cascading
dependencies, but must be used with the utmost care or dependent files will
fail to rebuild and the result will most certainly be a miscompile.
See [DependencyAnalysis](DependencyAnalysis.md).

## QoI

"Quality of implementation." The term is meant to describe not how
Expand Down
30 changes: 1 addition & 29 deletions include/swift/AST/ASTScope.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,6 @@ class ASTScopeImpl {
static llvm::SmallVector<LabeledStmt *, 4>
lookupLabeledStmts(SourceFile *sourceFile, SourceLoc loc);

static Optional<bool>
computeIsCascadingUse(ArrayRef<const ASTScopeImpl *> history,
Optional<bool> initialIsCascadingUse);

static std::pair<CaseStmt *, CaseStmt *>
lookupFallthroughSourceAndDest(SourceFile *sourceFile, SourceLoc loc);

Expand Down Expand Up @@ -448,7 +444,6 @@ class ASTScopeImpl {
/// The main (recursive) lookup function:
/// Tell DeclConsumer about all names found in this scope and if not done,
/// recurse for enclosing scopes. Stop lookup if about to look in limit.
/// Return final value for isCascadingUse
///
/// If the lookup depends on implicit self, selfDC is its context.
/// (Names in extensions never depend on self.)
Expand Down Expand Up @@ -508,9 +503,6 @@ class ASTScopeImpl {

#pragma mark - - lookup- local bindings
protected:
virtual Optional<bool>
resolveIsCascadingUseForThisScope(Optional<bool>) const;

// A local binding is a basically a local variable defined in that very scope
// It is not an instance variable or inherited type.

Expand Down Expand Up @@ -611,11 +603,11 @@ class Portion {
virtual ASTScopeImpl *expandScope(GenericTypeOrExtensionScope *,
ScopeCreator &) const = 0;

/// \Returns \c true if this lookup is done looking for results, else \c false.
virtual SourceRange
getChildlessSourceRangeOf(const GenericTypeOrExtensionScope *scope,
bool omitAssertions) const = 0;

/// Returns isDone and isCascadingUse
virtual bool lookupMembersOf(const GenericTypeOrExtensionScope *scope,
ArrayRef<const ASTScopeImpl *>,
ASTScopeImpl::DeclConsumer consumer) const;
Expand Down Expand Up @@ -780,10 +772,6 @@ class GenericTypeOrExtensionScope : public ASTScopeImpl {
virtual bool doesDeclHaveABody() const;
const char *portionName() const { return portion->portionName; }

protected:
Optional<bool> resolveIsCascadingUseForThisScope(
Optional<bool> isCascadingUse) const override;

public:
// Only for DeclScope, not BodyScope
// Returns the where clause scope, or the parent if none
Expand Down Expand Up @@ -969,8 +957,6 @@ class GenericParamScope final : public ASTScopeImpl {
protected:
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
DeclConsumer) const override;
Optional<bool>
resolveIsCascadingUseForThisScope(Optional<bool>) const override;
};

/// Concrete class for a function/initializer/deinitializer
Expand Down Expand Up @@ -1014,9 +1000,6 @@ class AbstractFunctionDeclScope final : public ASTScopeImpl {

protected:
NullablePtr<const GenericParamList> genericParams() const override;

Optional<bool>
resolveIsCascadingUseForThisScope(Optional<bool>) const override;
};

/// The parameters for an abstract function (init/func/deinit)., subscript, and
Expand Down Expand Up @@ -1087,8 +1070,6 @@ class AbstractFunctionBodyScope : public ASTScopeImpl {
protected:
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
DeclConsumer) const override;
Optional<bool>
resolveIsCascadingUseForThisScope(Optional<bool>) const override;

public:
NullablePtr<ASTScopeImpl> insertionPointForDeferredExpansion() override;
Expand Down Expand Up @@ -1123,10 +1104,6 @@ class DefaultArgumentInitializerScope final : public ASTScopeImpl {
virtual NullablePtr<DeclContext> getDeclContext() const override;
virtual NullablePtr<Decl> getDeclIfAny() const override { return decl; }
Decl *getDecl() const { return decl; }

protected:
Optional<bool>
resolveIsCascadingUseForThisScope(Optional<bool>) const override;
};

/// Consider:
Expand Down Expand Up @@ -1274,9 +1251,6 @@ class PatternEntryInitializerScope final : public AbstractPatternEntryScope {
protected:
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
DeclConsumer) const override;

Optional<bool>
resolveIsCascadingUseForThisScope(Optional<bool>) const override;
};

/// The scope introduced by a conditional clause in an if/guard/while
Expand Down Expand Up @@ -1402,8 +1376,6 @@ class ClosureParametersScope final : public ASTScopeImpl {
protected:
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
DeclConsumer) const override;
Optional<bool> resolveIsCascadingUseForThisScope(
Optional<bool> isCascadingUse) const override;
};

class TopLevelCodeScope final : public ASTScopeImpl {
Expand Down
1 change: 1 addition & 0 deletions include/swift/AST/ASTTypeIDZone.def
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
//
//===----------------------------------------------------------------------===//

SWIFT_TYPEID(ActorIsolation)
SWIFT_TYPEID(AncestryFlags)
SWIFT_TYPEID(CtorInitializerKind)
SWIFT_TYPEID(FunctionBuilderBodyPreCheck)
Expand Down
1 change: 1 addition & 0 deletions include/swift/AST/ASTTypeIDs.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
namespace swift {

class AbstractFunctionDecl;
class ActorIsolation;
class BraceStmt;
class ClosureExpr;
class CodeCompletionCallbacksFactory;
Expand Down
111 changes: 111 additions & 0 deletions include/swift/AST/ActorIsolation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
//===--- ActorIsolation.h - Actor isolation ---------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file provides a description of actor isolation state.
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_AST_ACTORISOLATIONSTATE_H
#define SWIFT_AST_ACTORISOLATIONSTATE_H

#include "llvm/ADT/Hashing.h"

namespace llvm {
class raw_ostream;
}

namespace swift {
class ClassDecl;

/// Describes the actor isolation of a given declaration, which determines
/// the actors with which it can interact.
class ActorIsolation {
public:
enum Kind {
/// The actor isolation has not been specified. It is assumed to be
/// unsafe to interact with this declaration from any actor.
Unspecified = 0,
/// The declaration is isolated to the instance of an actor class.
/// For example, a mutable stored property or synchronous function within
/// the actor is isolated to the instance of that actor.
ActorInstance,
/// The declaration can refer to actor-isolated state, but can also be
//// referenced from outside the actor.
ActorPrivileged,
/// The declaration is explicitly specified to be independent of any actor,
/// meaning that it can be used from any actor but is also unable to
/// refer to the isolated state of any given actor.
Independent,
};

private:
Kind kind;
ClassDecl *actor;

ActorIsolation(Kind kind, ClassDecl *actor) : kind(kind), actor(actor) { }

public:
static ActorIsolation forUnspecified() {
return ActorIsolation(Unspecified, nullptr);
}

static ActorIsolation forIndependent() {
return ActorIsolation(Independent, nullptr);
}

static ActorIsolation forActorPrivileged(ClassDecl *actor) {
return ActorIsolation(ActorPrivileged, actor);
}

static ActorIsolation forActorInstance(ClassDecl *actor) {
return ActorIsolation(ActorInstance, actor);
}

Kind getKind() const { return kind; }

operator Kind() const { return getKind(); }

ClassDecl *getActor() const {
assert(getKind() == ActorInstance || getKind() == ActorPrivileged);
return actor;
}

friend bool operator==(const ActorIsolation &lhs,
const ActorIsolation &rhs) {
if (lhs.kind != rhs.kind)
return false;

switch (lhs.kind) {
case Independent:
case Unspecified:
return true;

case ActorInstance:
case ActorPrivileged:
return lhs.actor == rhs.actor;
}
}

friend bool operator!=(const ActorIsolation &lhs,
const ActorIsolation &rhs) {
return !(lhs == rhs);
}

friend llvm::hash_code hash_value(const ActorIsolation &state) {
return llvm::hash_combine(state.kind, state.actor);
}
};

void simple_display(llvm::raw_ostream &out, const ActorIsolation &state);

} // end namespace swift

#endif /* SWIFT_AST_ACTORISOLATIONSTATE_H */
8 changes: 7 additions & 1 deletion include/swift/AST/Attr.def
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ SIMPLE_DECL_ATTR(noDerivative, NoDerivative,
100)

SIMPLE_DECL_ATTR(asyncHandler, AsyncHandler,
OnFunc | UserInaccessible |
OnFunc | ConcurrencyOnly |
ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove,
101)

Expand All @@ -572,6 +572,12 @@ CONTEXTUAL_SIMPLE_DECL_ATTR(actor, Actor,
APIBreakingToAdd | APIBreakingToRemove,
102)

SIMPLE_DECL_ATTR(actorIndependent, ActorIndependent,
OnFunc | OnVar | OnSubscript | ConcurrencyOnly |
ABIStableToAdd | ABIStableToRemove |
APIStableToAdd | APIBreakingToRemove,
103)

#undef TYPE_ATTR
#undef DECL_ATTR_ALIAS
#undef CONTEXTUAL_DECL_ATTR_ALIAS
Expand Down
Loading