Skip to content

Commit 4b073b9

Browse files
authored
Merge pull request #4225 from swiftwasm/main
2 parents a8e2e01 + ef6d43e commit 4b073b9

Some content is hidden

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

41 files changed

+1382
-768
lines changed

docs/SIL.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2065,7 +2065,7 @@ called a "forwarding instruction" and any use with such a user instruction a
20652065
"forwarding use". This inference generally occurs upon instruction construction
20662066
and as a result:
20672067

2068-
* When manipulating forwarding instructions programatically, one must manually
2068+
* When manipulating forwarding instructions programmatically, one must manually
20692069
update their forwarded ownership since most of the time the ownership is
20702070
stored in the instruction itself. Don't worry though because the SIL verifier
20712071
will catch this error for you if you forget to do so!
@@ -2075,7 +2075,7 @@ and as a result:
20752075
parsed operand.
20762076
In some cases the forwarding ownership kind is different from the ownership kind
20772077
of its operand. In such cases, textual SIL represents the forwarding ownership kind
2078-
explicity.
2078+
explicitly.
20792079
Eg: ::
20802080

20812081
%cast = unchecked_ref_cast %val : $Klass to $Optional<Klass>, forwarding: @unowned

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ ERROR(cannot_infer_closure_parameter_type,none,
274274
(StringRef))
275275
ERROR(cannot_infer_closure_type,none,
276276
"unable to infer closure type in the current context", ())
277+
ERROR(cannot_infer_empty_closure_result_type,none,
278+
"cannot infer return type of empty closure", ())
277279
ERROR(cannot_infer_closure_result_type,none,
278280
"cannot infer return type for closure with multiple statements; "
279281
"add explicit type to disambiguate", ())

include/swift/Reflection/ReflectionContext.h

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,28 +1190,7 @@ class ReflectionContext
11901190
if (!ConformancesAddr)
11911191
return "unable to read value of " + ConformancesPointerName;
11921192

1193-
auto Root = getReader().readPointer(ConformancesAddr->getResolvedAddress(),
1194-
sizeof(StoredPointer));
1195-
auto ReaderCount = Root->getResolvedAddress().getAddressData();
1196-
1197-
// ReaderCount will be the root pointer if the conformance cache is a
1198-
// ConcurrentMap. It's very unlikely that there would ever be more readers
1199-
// than the least valid pointer value, so compare with that to distinguish.
1200-
// TODO: once the old conformance cache is gone for good, remove that code.
1201-
uint64_t LeastValidPointerValue;
1202-
if (!getReader().queryDataLayout(
1203-
DataLayoutQueryType::DLQ_GetLeastValidPointerValue, nullptr,
1204-
&LeastValidPointerValue)) {
1205-
return std::string("unable to query least valid pointer value");
1206-
}
1207-
1208-
if (ReaderCount < LeastValidPointerValue)
1209-
IterateConformanceTable(ConformancesAddr->getResolvedAddress(), Call);
1210-
else {
1211-
// The old code has the root address at this location.
1212-
auto RootAddr = ReaderCount;
1213-
iterateConformanceTree(RootAddr, Call);
1214-
}
1193+
IterateConformanceTable(ConformancesAddr->getResolvedAddress(), Call);
12151194
return llvm::None;
12161195
}
12171196

include/swift/Reflection/RuntimeInternals.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ template <typename Runtime> struct MetadataCacheNode {
4949
};
5050

5151
template <typename Runtime> struct ConcurrentHashMap {
52-
typename Runtime::StoredSize ReaderCount;
53-
typename Runtime::StoredSize ElementCount;
52+
uint32_t ReaderCount;
53+
uint32_t ElementCount;
5454
typename Runtime::StoredPointer Elements;
5555
typename Runtime::StoredPointer Indices;
5656
// We'll ignore the remaining fields for now....

include/swift/Runtime/Concurrent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ struct ConcurrentReadableHashMap {
812812
/// the first element of a variable-length array, whose size is determined by
813813
/// the allocation.
814814
struct ElementStorage {
815-
uint32_t Capacity;
815+
uintptr_t Capacity : 32;
816816
ElemTy Elem;
817817

818818
static ElementStorage *allocate(size_t capacity) {

include/swift/Sema/CSFix.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,6 +2335,10 @@ class SpecifyClosureReturnType final : public ConstraintFix {
23352335

23362336
bool diagnose(const Solution &solution, bool asNote = false) const override;
23372337

2338+
bool diagnoseForAmbiguity(CommonFixesArray commonFixes) const override {
2339+
return diagnose(*commonFixes.front().first);
2340+
}
2341+
23382342
static SpecifyClosureReturnType *create(ConstraintSystem &cs,
23392343
ConstraintLocator *locator);
23402344

lib/AST/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ add_swift_host_library(swiftAST STATIC
7474
ProtocolConformance.cpp
7575
RawComment.cpp
7676
RequirementEnvironment.cpp
77+
RequirementMachine/ConcreteTypeWitness.cpp
7778
RequirementMachine/GenericSignatureQueries.cpp
7879
RequirementMachine/HomotopyReduction.cpp
7980
RequirementMachine/InterfaceType.cpp

0 commit comments

Comments
 (0)