Skip to content

Commit f88d8e2

Browse files
authored
Merge pull request #2431 from swiftwasm/main
[pull] swiftwasm from main
2 parents 625e6e0 + c974725 commit f88d8e2

37 files changed

+2433
-939
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ channel in [the SwiftPM Slack](https://swift-package-manager.herokuapp.com/).
2121

2222
| | **Architecture** | **main** | **Package** |
2323
|---|:---:|:---:|:---:|
24-
| **macOS** | x86_64 |[![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-osx/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-osx)|[![Build Status](https://ci.swift.org/job/oss-swift-package-osx/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-osx)|
24+
| **macOS** | x86_64 |[![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-macos/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-macos)|[![Build Status](https://ci.swift.org/job/oss-swift-package-macos/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-macos)|
2525
| **Ubuntu 16.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04)|
2626
| **Ubuntu 18.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-18_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04)|
2727
| **Ubuntu 20.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04)|

docs/ContinuousIntegration.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ We describe each in detail below:
4949

5050
Platform | Comment | Check Status
5151
------------ | ------- | ------------
52-
All supported platforms | @swift-ci Please smoke test | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)
53-
All supported platforms | @swift-ci Please clean smoke test | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)
54-
All supported platforms | @swift-ci Please smoke test and merge | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)
55-
All supported platforms | @swift-ci Please clean smoke test and merge | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)
56-
macOS platform | @swift-ci Please smoke test OS X platform | Swift Test OS X Platform (smoke test)
57-
macOS platform | @swift-ci Please clean smoke test OS X platform | Swift Test OS X Platform (smoke test)
52+
All supported platforms | @swift-ci Please smoke test | Swift Test Linux Platform (smoke test)<br>Swift Test macOS Platform (smoke test)
53+
All supported platforms | @swift-ci Please clean smoke test | Swift Test Linux Platform (smoke test)<br>Swift Test macOS Platform (smoke test)
54+
All supported platforms | @swift-ci Please smoke test and merge | Swift Test Linux Platform (smoke test)<br>Swift Test macOS Platform (smoke test)
55+
All supported platforms | @swift-ci Please clean smoke test and merge | Swift Test Linux Platform (smoke test)<br>Swift Test macOS Platform (smoke test)
56+
macOS platform | @swift-ci Please smoke test macOS platform | Swift Test macOS Platform (smoke test)
57+
macOS platform | @swift-ci Please clean smoke test macOS platform | Swift Test macOS Platform (smoke test)
5858
Linux platform | @swift-ci Please smoke test Linux platform | Swift Test Linux Platform (smoke test)
5959
Linux platform | @swift-ci Please clean smoke test Linux platform | Swift Test Linux Platform (smoke test)
6060

@@ -84,17 +84,17 @@ A smoke test on Linux does the following:
8484

8585
Platform | Comment | Check Status
8686
------------ | ------- | ------------
87-
All supported platforms | @swift-ci Please test | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)<br>Swift Test Linux Platform<br>Swift Test OS X Platform<br>
88-
All supported platforms | @swift-ci Please clean test | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)<br>Swift Test Linux Platform<br>Swift Test OS X Platform<br>
89-
All supported platforms | @swift-ci Please test and merge | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)<br> Swift Test Linux Platform <br>Swift Test OS X Platform
90-
All supported platforms | @swift-ci Please clean test and merge | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)<br> Swift Test Linux Platform <br>Swift Test OS X Platform
91-
macOS platform | @swift-ci Please test OS X platform | Swift Test OS X Platform (smoke test)<br>Swift Test OS X Platform
92-
macOS platform | @swift-ci Please clean test OS X platform | Swift Test OS X Platform (smoke test)<br>Swift Test OS X Platform
93-
macOS platform | @swift-ci Please benchmark | Swift Benchmark on OS X Platform (many runs - rigorous)
94-
macOS platform | @swift-ci Please smoke benchmark | Swift Benchmark on OS X Platform (few runs - sanity)
87+
All supported platforms | @swift-ci Please test | Swift Test Linux Platform (smoke test)<br>Swift Test macOS Platform (smoke test)<br>Swift Test Linux Platform<br>Swift Test macOS Platform<br>
88+
All supported platforms | @swift-ci Please clean test | Swift Test Linux Platform (smoke test)<br>Swift Test macOS Platform (smoke test)<br>Swift Test Linux Platform<br>Swift Test macOS Platform<br>
89+
All supported platforms | @swift-ci Please test and merge | Swift Test Linux Platform (smoke test)<br>Swift Test macOS Platform (smoke test)<br> Swift Test Linux Platform <br>Swift Test macOS Platform
90+
All supported platforms | @swift-ci Please clean test and merge | Swift Test Linux Platform (smoke test)<br>Swift Test macOS Platform (smoke test)<br> Swift Test Linux Platform <br>Swift Test macOS Platform
91+
macOS platform | @swift-ci Please test macOS platform | Swift Test macOS Platform (smoke test)<br>Swift Test macOS Platform
92+
macOS platform | @swift-ci Please clean test macOS platform | Swift Test macOS Platform (smoke test)<br>Swift Test macOS Platform
93+
macOS platform | @swift-ci Please benchmark | Swift Benchmark on macOS Platform (many runs - rigorous)
94+
macOS platform | @swift-ci Please smoke benchmark | Swift Benchmark macOS Platform (few runs - sanity)
9595
Linux platform | @swift-ci Please test Linux platform | Swift Test Linux Platform (smoke test)<br>Swift Test Linux Platform
9696
Linux platform | @swift-ci Please clean test Linux platform | Swift Test Linux Platform (smoke test)<br>Swift Test Linux Platform
97-
macOS platform | @swift-ci Please ASAN test | Swift ASAN Test OS X Platform
97+
macOS platform | @swift-ci Please ASAN test | Swift ASAN Test macOS Platform
9898
Ubuntu 18.04 | @swift-ci Please test Ubuntu 18.04 platform | Swift Test Ubuntu 18.04 Platform
9999
Ubuntu 20.04 | @swift-ci Please test Ubuntu 20.04 platform | Swift Test Ubuntu 20.04 Platform
100100
CentOS 7 | @swift-ci Please test CentOS 7 platform | Swift Test CentOS 7 Platform
@@ -134,8 +134,8 @@ A validation test on Linux does the following:
134134

135135
Platform | Comment | Check Status
136136
------------ | ------- | ------------
137-
macOS platform | @swift-ci Please benchmark | Swift Benchmark on OS X Platform (many runs - rigorous)
138-
macOS platform | @swift-ci Please smoke benchmark | Swift Benchmark on OS X Platform (few runs - sanity)
137+
macOS platform | @swift-ci Please benchmark | Swift Benchmark on macOS Platform (many runs - rigorous)
138+
macOS platform | @swift-ci Please smoke benchmark | Swift Benchmark on macOS Platform (few runs - sanity)
139139

140140
### Linting
141141

docs/DynamicCasting.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,8 @@ Casting from a function type F1 to a function type F2 will succeed iff the follo
302302

303303
Note that it is _not_ sufficient for argument and return types to be castable; they must actually be identical.
304304

305+
Caveat: The current Swift compiler supports more general casts of function types in certain cases where the compiler has enough information to statically construct the necessary adapter function. Function types that must be cast at runtime follow the less permissive rules described above.
306+
305307
## Existential Types
306308

307309
Conceptually, an "existential type" is an opaque wrapper that carries a type and an instance of that type.
@@ -372,7 +374,7 @@ For casting purposes, `AnyHashable` behaves like an existential type.
372374
It satisfies the weak existential invariant above.
373375

374376
However, note that `AnyHashable` does not act like an existential for other purposes.
375-
For example, it's metatype is named `AnyHashable.Type` and it does not have an existential metatype.
377+
For example, its metatype is named `AnyHashable.Type` and it does not have an existential metatype.
376378

377379
### Protocol Witness types
378380

@@ -491,6 +493,12 @@ Non-protocol types do not have existential metatypes.
491493
For a generic variable `G`, the expression also refers to the regular metatype, even if the generic variable is bound to a protocol.
492494
There is no mechanism in Swift to refer to the existential metatype via a generic variable.)
493495

496+
In essence, an existential metatype simply defines an existential that can hold a metatype instance.
497+
An instance of the existential metatype `Any.Type` can hold any metatype instance.
498+
An instance of the existential metatype `P.Type` of a protocol `P` can hold a metatype instance of any type that conforms to `P`.
499+
As with other existentials, casting _from_ an existential metatype is equivalent to casting the contents of the existential.
500+
Casting _to_ an existential metatype succeeds whenever the source is a conforming metatype instance (or can be unwrapped to yield such a metatype instance).
501+
494502
Example
495503
```
496504
protocol P {

include/swift/AST/Attr.def

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,9 +572,10 @@ CONTEXTUAL_SIMPLE_DECL_ATTR(actor, Actor,
572572
102)
573573

574574
DECL_ATTR(actorIndependent, ActorIndependent,
575-
OnFunc | OnVar | OnSubscript | ConcurrencyOnly |
575+
OnClass | OnStruct | OnEnum | OnExtension | OnFunc | OnConstructor |
576+
OnVar | OnSubscript | ConcurrencyOnly |
576577
ABIStableToAdd | ABIStableToRemove |
577-
APIStableToAdd | APIBreakingToRemove,
578+
APIBreakingToAdd | APIBreakingToRemove,
578579
103)
579580

580581
SIMPLE_DECL_ATTR(globalActor, GlobalActor,

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3786,8 +3786,8 @@ ERROR(expression_unused_closure,none,
37863786
"closure expression is unused", ())
37873787
ERROR(expression_unused_function,none,
37883788
"expression resolves to an unused function", ())
3789-
ERROR(expression_unused_lvalue,none,
3790-
"expression resolves to an unused %select{variable|property|subscript}0", (unsigned))
3789+
WARNING(expression_unused_lvalue,none,
3790+
"expression resolves to an unused %select{variable|property|subscript}0", (unsigned))
37913791
WARNING(expression_unused_result_call,none,
37923792
"result of call to %0 is unused", (DeclName))
37933793
WARNING(expression_unused_result_operator,none,
@@ -4281,13 +4281,6 @@ ERROR(actorindependent_mutable_storage,none,
42814281
ERROR(actorindependent_local_var,none,
42824282
"'@actorIndependent' can not be applied to local variables",
42834283
())
4284-
ERROR(actorindependent_not_actor_member,none,
4285-
"'@actorIndependent' can only be applied to actor members and "
4286-
"global/static variables",
4287-
())
4288-
ERROR(actorindependent_not_actor_instance_member,none,
4289-
"'@actorIndependent' can only be applied to instance members of actors",
4290-
())
42914284

42924285
ERROR(concurrency_lib_missing,none,
42934286
"missing '%0' declaration, probably because the '_Concurrency' "

include/swift/AST/Evaluator.h

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include "swift/AST/AnyRequest.h"
2222
#include "swift/AST/EvaluatorDependencies.h"
23+
#include "swift/AST/RequestCache.h"
2324
#include "swift/Basic/AnyValue.h"
2425
#include "swift/Basic/Debug.h"
2526
#include "swift/Basic/LangOptions.h"
@@ -211,7 +212,7 @@ class Evaluator {
211212
llvm::SetVector<ActiveRequest> activeRequests;
212213

213214
/// A cache that stores the results of requests.
214-
llvm::DenseMap<AnyRequest, AnyValue> cache;
215+
evaluator::RequestCache cache;
215216

216217
/// Track the dependencies of each request.
217218
///
@@ -314,14 +315,15 @@ class Evaluator {
314315
typename std::enable_if<!Request::hasExternalCache>::type* = nullptr>
315316
void cacheOutput(const Request &request,
316317
typename Request::OutputType &&output) {
317-
cache.insert({AnyRequest(request), std::move(output)});
318+
cache.insert<Request>(request, std::move(output));
318319
}
319320

320321
/// Do not introduce new callers of this function.
321322
template<typename Request,
322323
typename std::enable_if<!Request::hasExternalCache>::type* = nullptr>
323324
void clearCachedOutput(const Request &request) {
324-
cache.erase(AnyRequest(request));
325+
cache.erase<Request>(request);
326+
recorder.clearRequest<Request>(request);
325327
}
326328

327329
/// Clear the cache stored within this evaluator.
@@ -372,21 +374,21 @@ class Evaluator {
372374
FrontendStatsTracer statsTracer = make_tracer(stats, request);
373375
if (stats) reportEvaluatedRequest(*stats, request);
374376

375-
recorder.beginRequest(activeReq);
377+
recorder.beginRequest<Request>();
376378

377-
auto &&r = getRequestFunction<Request>()(request, *this);
379+
auto &&result = getRequestFunction<Request>()(request, *this);
378380

379-
recorder.endRequest(activeReq);
381+
recorder.endRequest<Request>(request);
380382

381383
handleDependencySourceRequest<Request>(request);
382-
handleDependencySinkRequest<Request>(request, r);
384+
handleDependencySinkRequest<Request>(request, result);
383385

384386
// Make sure we remove this from the set of active requests once we're
385387
// done.
386388
assert(activeRequests.back() == activeReq);
387389
activeRequests.pop_back();
388390

389-
return std::move(r);
391+
return std::move(result);
390392
}
391393

392394
/// Get the result of a request, consulting an external cache
@@ -398,7 +400,7 @@ class Evaluator {
398400
getResultCached(const Request &request) {
399401
// If there is a cached result, return it.
400402
if (auto cached = request.getCachedResult()) {
401-
recorder.replayCachedRequest(ActiveRequest(request));
403+
recorder.replayCachedRequest(request);
402404
handleDependencySinkRequest<Request>(request, *cached);
403405
return *cached;
404406
}
@@ -424,12 +426,12 @@ class Evaluator {
424426
llvm::Expected<typename Request::OutputType>
425427
getResultCached(const Request &request) {
426428
// If we already have an entry for this request in the cache, return it.
427-
auto known = cache.find_as(request);
428-
if (known != cache.end()) {
429-
auto r = known->second.template castTo<typename Request::OutputType>();
430-
recorder.replayCachedRequest(ActiveRequest(request));
431-
handleDependencySinkRequest<Request>(request, r);
432-
return r;
429+
auto known = cache.find_as<Request>(request);
430+
if (known != cache.end<Request>()) {
431+
auto result = known->second;
432+
recorder.replayCachedRequest(request);
433+
handleDependencySinkRequest<Request>(request, result);
434+
return result;
433435
}
434436

435437
// Compute the result.
@@ -438,7 +440,7 @@ class Evaluator {
438440
return result;
439441

440442
// Cache the result.
441-
cache.insert({AnyRequest(request), *result});
443+
cache.insert<Request>(request, *result);
442444
return result;
443445
}
444446

@@ -465,7 +467,7 @@ class Evaluator {
465467
void handleDependencySourceRequest(const Request &r) {
466468
auto source = r.readDependencySource(recorder);
467469
if (!source.isNull() && source.get()->isPrimary()) {
468-
recorder.handleDependencySourceRequest(ActiveRequest(r), source.get());
470+
recorder.handleDependencySourceRequest(r, source.get());
469471
}
470472
}
471473

0 commit comments

Comments
 (0)