Skip to content

Commit c89e502

Browse files
Merge pull request #1791 from swiftwasm/master
[pull] swiftwasm from master
2 parents 807a90c + b532e68 commit c89e502

File tree

475 files changed

+1324
-10536
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

475 files changed

+1324
-10536
lines changed

CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,6 @@ set(SWIFT_NATIVE_CLANG_TOOLS_PATH "" CACHE STRING
242242
set(SWIFT_NATIVE_SWIFT_TOOLS_PATH "" CACHE STRING
243243
"Path to the directory that contains Swift tools that are executable on the build machine")
244244

245-
option(SWIFT_ENABLE_MODULE_INTERFACES
246-
"Generate .swiftinterface files alongside .swiftmodule files"
247-
TRUE)
248-
249245
option(SWIFT_STDLIB_ENABLE_SIB_TARGETS
250246
"Should we generate sib targets for the stdlib or not?"
251247
FALSE)

benchmark/scripts/Benchmark_RuntimeLeaksRunner.in

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,13 @@ class LeaksRunnerResult(perf_test_driver.Result):
6262

6363

6464
class LeaksRunnerBenchmarkDriver(perf_test_driver.BenchmarkDriver):
65-
def __init__(self, binary, xfail_list, num_samples, num_iters):
65+
def __init__(self, binary, xfail_list, num_samples, num_iters, verbose):
6666
perf_test_driver.BenchmarkDriver.__init__(
6767
self, binary, xfail_list, enable_parallel=True
6868
)
6969
self.num_samples = num_samples
7070
self.num_iters = num_iters
71+
self.verbose = verbose
7172

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

124+
# If we are asked to emit verbose output, do so now.
125+
if self.verbose:
126+
tmp = (data["path"], data["test_name"], d)
127+
sys.stderr.write(
128+
"VERBOSE (%s,%s): %s" % tmp)
129+
sys.stderr.flush()
130+
123131
total_count = d["objc_count"] + d["swift_count"]
124132
return total_count
125133
except Exception:
@@ -156,13 +164,17 @@ def parse_args():
156164
)
157165
parser.add_argument("-num-samples", type=int, default=2)
158166
parser.add_argument("-num-iters", type=int, default=2)
167+
parser.add_argument("-v", "--verbose", action="store_true",
168+
help="Upon failure, dump out raw result",
169+
dest="verbose")
159170
return parser.parse_args()
160171

161172

162173
if __name__ == "__main__":
163174
args = parse_args()
164175
driver = LeaksRunnerBenchmarkDriver(
165-
SWIFT_BIN_DIR, XFAIL_LIST, args.num_samples, args.num_iters
176+
SWIFT_BIN_DIR, XFAIL_LIST, args.num_samples, args.num_iters,
177+
args.verbose
166178
)
167179
if driver.run(args.filter):
168180
sys.exit(0)

docs/DependencyAnalysis.md

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -56,33 +56,6 @@ Note:
5656
> may change its members drastically.
5757
5858

59-
Cascading vs. Non-Cascading Dependencies
60-
========================================
61-
62-
If file A depends on file B, and file B depends on file C, does file A depend
63-
on file C? The answer is: maybe! It depends how file B is using file C. If all
64-
uses are inside function bodies, for example, then changing file C only
65-
requires rebuilding file B, not file A. The terminology here is that file B has
66-
a *non-cascading* dependency on file C.
67-
68-
By contrast, if changing file C affects the interface of file B, then the
69-
dependency is said to be *cascading,* and changing file C would require
70-
rebuilding both file B and file A.
71-
72-
The various dependency tracking throughout the compiler will look at the
73-
context in which information is being used and attempt to determine whether or
74-
not a particular dependency should be considered cascading. If there's not
75-
enough context to decide, the compiler has to go with the conservative choice
76-
and record it as cascading.
77-
78-
79-
Note:
80-
81-
> In the current on-disk representation of dependency information, cascading
82-
> dependencies are the default. Non-cascading dependencies are marked
83-
> `private` by analogy with the Swift `private` keyword.
84-
85-
8659
External Dependencies
8760
=====================
8861

docs/Lexicon.md

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,6 @@ These can usually be directly compared to test whether two types are the
100100
same; the exception is when generics get involved. In this case you'll need
101101
a [generic environment](#generic-environment). Contrast with [sugared type](#sugared-type).
102102

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

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

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

469445
"Quality of implementation." The term is meant to describe not how

include/swift/AST/ASTScope.h

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -417,10 +417,6 @@ class ASTScopeImpl {
417417
static llvm::SmallVector<LabeledStmt *, 4>
418418
lookupLabeledStmts(SourceFile *sourceFile, SourceLoc loc);
419419

420-
static Optional<bool>
421-
computeIsCascadingUse(ArrayRef<const ASTScopeImpl *> history,
422-
Optional<bool> initialIsCascadingUse);
423-
424420
static std::pair<CaseStmt *, CaseStmt *>
425421
lookupFallthroughSourceAndDest(SourceFile *sourceFile, SourceLoc loc);
426422

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

509504
#pragma mark - - lookup- local bindings
510505
protected:
511-
virtual Optional<bool>
512-
resolveIsCascadingUseForThisScope(Optional<bool>) const;
513-
514506
// A local binding is a basically a local variable defined in that very scope
515507
// It is not an instance variable or inherited type.
516508

@@ -611,11 +603,11 @@ class Portion {
611603
virtual ASTScopeImpl *expandScope(GenericTypeOrExtensionScope *,
612604
ScopeCreator &) const = 0;
613605

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

618-
/// Returns isDone and isCascadingUse
619611
virtual bool lookupMembersOf(const GenericTypeOrExtensionScope *scope,
620612
ArrayRef<const ASTScopeImpl *>,
621613
ASTScopeImpl::DeclConsumer consumer) const;
@@ -780,10 +772,6 @@ class GenericTypeOrExtensionScope : public ASTScopeImpl {
780772
virtual bool doesDeclHaveABody() const;
781773
const char *portionName() const { return portion->portionName; }
782774

783-
protected:
784-
Optional<bool> resolveIsCascadingUseForThisScope(
785-
Optional<bool> isCascadingUse) const override;
786-
787775
public:
788776
// Only for DeclScope, not BodyScope
789777
// Returns the where clause scope, or the parent if none
@@ -969,8 +957,6 @@ class GenericParamScope final : public ASTScopeImpl {
969957
protected:
970958
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
971959
DeclConsumer) const override;
972-
Optional<bool>
973-
resolveIsCascadingUseForThisScope(Optional<bool>) const override;
974960
};
975961

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

10151001
protected:
10161002
NullablePtr<const GenericParamList> genericParams() const override;
1017-
1018-
Optional<bool>
1019-
resolveIsCascadingUseForThisScope(Optional<bool>) const override;
10201003
};
10211004

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

10931074
public:
10941075
NullablePtr<ASTScopeImpl> insertionPointForDeferredExpansion() override;
@@ -1123,10 +1104,6 @@ class DefaultArgumentInitializerScope final : public ASTScopeImpl {
11231104
virtual NullablePtr<DeclContext> getDeclContext() const override;
11241105
virtual NullablePtr<Decl> getDeclIfAny() const override { return decl; }
11251106
Decl *getDecl() const { return decl; }
1126-
1127-
protected:
1128-
Optional<bool>
1129-
resolveIsCascadingUseForThisScope(Optional<bool>) const override;
11301107
};
11311108

11321109
/// Consider:
@@ -1274,9 +1251,6 @@ class PatternEntryInitializerScope final : public AbstractPatternEntryScope {
12741251
protected:
12751252
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
12761253
DeclConsumer) const override;
1277-
1278-
Optional<bool>
1279-
resolveIsCascadingUseForThisScope(Optional<bool>) const override;
12801254
};
12811255

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

14091381
class TopLevelCodeScope final : public ASTScopeImpl {

include/swift/AST/ASTTypeIDZone.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
//
1616
//===----------------------------------------------------------------------===//
1717

18+
SWIFT_TYPEID(ActorIsolation)
1819
SWIFT_TYPEID(AncestryFlags)
1920
SWIFT_TYPEID(CtorInitializerKind)
2021
SWIFT_TYPEID(FunctionBuilderBodyPreCheck)

include/swift/AST/ASTTypeIDs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
namespace swift {
2424

2525
class AbstractFunctionDecl;
26+
class ActorIsolation;
2627
class BraceStmt;
2728
class ClosureExpr;
2829
class CodeCompletionCallbacksFactory;

include/swift/AST/ActorIsolation.h

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
//===--- ActorIsolation.h - Actor isolation ---------------------*- C++ -*-===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
//
13+
// This file provides a description of actor isolation state.
14+
//
15+
//===----------------------------------------------------------------------===//
16+
#ifndef SWIFT_AST_ACTORISOLATIONSTATE_H
17+
#define SWIFT_AST_ACTORISOLATIONSTATE_H
18+
19+
#include "llvm/ADT/Hashing.h"
20+
21+
namespace llvm {
22+
class raw_ostream;
23+
}
24+
25+
namespace swift {
26+
class ClassDecl;
27+
28+
/// Describes the actor isolation of a given declaration, which determines
29+
/// the actors with which it can interact.
30+
class ActorIsolation {
31+
public:
32+
enum Kind {
33+
/// The actor isolation has not been specified. It is assumed to be
34+
/// unsafe to interact with this declaration from any actor.
35+
Unspecified = 0,
36+
/// The declaration is isolated to the instance of an actor class.
37+
/// For example, a mutable stored property or synchronous function within
38+
/// the actor is isolated to the instance of that actor.
39+
ActorInstance,
40+
/// The declaration can refer to actor-isolated state, but can also be
41+
//// referenced from outside the actor.
42+
ActorPrivileged,
43+
/// The declaration is explicitly specified to be independent of any actor,
44+
/// meaning that it can be used from any actor but is also unable to
45+
/// refer to the isolated state of any given actor.
46+
Independent,
47+
};
48+
49+
private:
50+
Kind kind;
51+
ClassDecl *actor;
52+
53+
ActorIsolation(Kind kind, ClassDecl *actor) : kind(kind), actor(actor) { }
54+
55+
public:
56+
static ActorIsolation forUnspecified() {
57+
return ActorIsolation(Unspecified, nullptr);
58+
}
59+
60+
static ActorIsolation forIndependent() {
61+
return ActorIsolation(Independent, nullptr);
62+
}
63+
64+
static ActorIsolation forActorPrivileged(ClassDecl *actor) {
65+
return ActorIsolation(ActorPrivileged, actor);
66+
}
67+
68+
static ActorIsolation forActorInstance(ClassDecl *actor) {
69+
return ActorIsolation(ActorInstance, actor);
70+
}
71+
72+
Kind getKind() const { return kind; }
73+
74+
operator Kind() const { return getKind(); }
75+
76+
ClassDecl *getActor() const {
77+
assert(getKind() == ActorInstance || getKind() == ActorPrivileged);
78+
return actor;
79+
}
80+
81+
friend bool operator==(const ActorIsolation &lhs,
82+
const ActorIsolation &rhs) {
83+
if (lhs.kind != rhs.kind)
84+
return false;
85+
86+
switch (lhs.kind) {
87+
case Independent:
88+
case Unspecified:
89+
return true;
90+
91+
case ActorInstance:
92+
case ActorPrivileged:
93+
return lhs.actor == rhs.actor;
94+
}
95+
}
96+
97+
friend bool operator!=(const ActorIsolation &lhs,
98+
const ActorIsolation &rhs) {
99+
return !(lhs == rhs);
100+
}
101+
102+
friend llvm::hash_code hash_value(const ActorIsolation &state) {
103+
return llvm::hash_combine(state.kind, state.actor);
104+
}
105+
};
106+
107+
void simple_display(llvm::raw_ostream &out, const ActorIsolation &state);
108+
109+
} // end namespace swift
110+
111+
#endif /* SWIFT_AST_ACTORISOLATIONSTATE_H */

include/swift/AST/Attr.def

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ SIMPLE_DECL_ATTR(noDerivative, NoDerivative,
562562
100)
563563

564564
SIMPLE_DECL_ATTR(asyncHandler, AsyncHandler,
565-
OnFunc | UserInaccessible |
565+
OnFunc | ConcurrencyOnly |
566566
ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove,
567567
101)
568568

@@ -572,6 +572,12 @@ CONTEXTUAL_SIMPLE_DECL_ATTR(actor, Actor,
572572
APIBreakingToAdd | APIBreakingToRemove,
573573
102)
574574

575+
SIMPLE_DECL_ATTR(actorIndependent, ActorIndependent,
576+
OnFunc | OnVar | OnSubscript | ConcurrencyOnly |
577+
ABIStableToAdd | ABIStableToRemove |
578+
APIStableToAdd | APIBreakingToRemove,
579+
103)
580+
575581
#undef TYPE_ATTR
576582
#undef DECL_ATTR_ALIAS
577583
#undef CONTEXTUAL_DECL_ATTR_ALIAS

0 commit comments

Comments
 (0)