Skip to content

Commit 32caa17

Browse files
committed
Runtime: Finish removing the 'extra argument' notion
1 parent 6df72d6 commit 32caa17

File tree

9 files changed

+128
-150
lines changed

9 files changed

+128
-150
lines changed

include/swift/ABI/MetadataValues.h

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,28 +1855,23 @@ enum class GenericParamKind : uint8_t {
18551855
};
18561856

18571857
class GenericParamDescriptor {
1858+
/// Don't set 0x40 for compatibility with pre-Swift 5.8 runtimes
18581859
uint8_t Value;
18591860

18601861
explicit constexpr GenericParamDescriptor(uint8_t Value)
18611862
: Value(Value) {}
18621863
public:
18631864
constexpr GenericParamDescriptor(GenericParamKind kind,
1864-
bool hasKeyArgument,
1865-
bool hasExtraArgument)
1865+
bool hasKeyArgument)
18661866
: GenericParamDescriptor(GenericParamDescriptor(0)
18671867
.withKind(kind)
1868-
.withKeyArgument(hasKeyArgument)
1869-
.withExtraArgument(hasExtraArgument))
1868+
.withKeyArgument(hasKeyArgument))
18701869
{}
18711870

18721871
constexpr bool hasKeyArgument() const {
18731872
return (Value & 0x80u) != 0;
18741873
}
18751874

1876-
constexpr bool hasExtraArgument() const {
1877-
return (Value & 0x40u) != 0;
1878-
}
1879-
18801875
constexpr GenericParamKind getKind() const {
18811876
return GenericParamKind(Value & 0x3Fu);
18821877
}
@@ -1887,12 +1882,6 @@ class GenericParamDescriptor {
18871882
| (hasKeyArgument ? 0x80u : 0));
18881883
}
18891884

1890-
constexpr GenericParamDescriptor
1891-
withExtraArgument(bool hasExtraArgument) const {
1892-
return GenericParamDescriptor((Value & 0xBFu)
1893-
| (hasExtraArgument ? 0x40u : 0));
1894-
}
1895-
18961885
constexpr GenericParamDescriptor withKind(GenericParamKind kind) const {
18971886
return assert((uint8_t(kind) & 0x3Fu) == uint8_t(kind)),
18981887
GenericParamDescriptor((Value & 0xC0u) | uint8_t(kind));
@@ -1914,8 +1903,7 @@ class GenericParamDescriptor {
19141903
/// The default parameter descriptor for an implicit parameter.
19151904
static constexpr GenericParamDescriptor implicit() {
19161905
return GenericParamDescriptor(GenericParamKind::Type,
1917-
/*key argument*/ true,
1918-
/*extra argument*/ false);
1906+
/*key argument*/ true);
19191907
}
19201908
};
19211909

@@ -1952,30 +1940,25 @@ enum class GenericRequirementKind : uint8_t {
19521940
};
19531941

19541942
class GenericRequirementFlags {
1943+
/// Don't set 0x40 for compatibility with pre-Swift 5.8 runtimes
19551944
uint32_t Value;
19561945

19571946
explicit constexpr GenericRequirementFlags(uint32_t Value)
19581947
: Value(Value) {}
19591948
public:
19601949
constexpr GenericRequirementFlags(GenericRequirementKind kind,
19611950
bool hasKeyArgument,
1962-
bool hasExtraArgument,
19631951
bool isPackRequirement)
19641952
: GenericRequirementFlags(GenericRequirementFlags(0)
19651953
.withKind(kind)
19661954
.withKeyArgument(hasKeyArgument)
1967-
.withExtraArgument(hasExtraArgument)
19681955
.withPackRequirement(isPackRequirement))
19691956
{}
19701957

19711958
constexpr bool hasKeyArgument() const {
19721959
return (Value & 0x80u) != 0;
19731960
}
19741961

1975-
constexpr bool hasExtraArgument() const {
1976-
return (Value & 0x40u) != 0;
1977-
}
1978-
19791962
/// If this is true, the subject type of the requirement is a pack.
19801963
/// When the requirement is a conformance requirement, the corresponding
19811964
/// entry in the generic arguments array becomes a TargetWitnessTablePack.
@@ -1993,12 +1976,6 @@ class GenericRequirementFlags {
19931976
| (hasKeyArgument ? 0x80u : 0));
19941977
}
19951978

1996-
constexpr GenericRequirementFlags
1997-
withExtraArgument(bool hasExtraArgument) const {
1998-
return GenericRequirementFlags((Value & 0xBFu)
1999-
| (hasExtraArgument ? 0x40u : 0));
2000-
}
2001-
20021979
constexpr GenericRequirementFlags
20031980
withPackRequirement(bool isPackRequirement) const {
20041981
return GenericRequirementFlags((Value & 0xBFu)

include/swift/Remote/MetadataReader.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3026,11 +3026,6 @@ class MetadataReader {
30263026
for (auto param : generics->getGenericParams()) {
30273027
switch (param.getKind()) {
30283028
case GenericParamKind::Type:
3029-
// We don't know about type parameters with extra arguments.
3030-
if (param.hasExtraArgument()) {
3031-
return {};
3032-
}
3033-
30343029
// The type should have a key argument unless it's been same-typed
30353030
// to another type.
30363031
if (param.hasKeyArgument()) {
@@ -3057,6 +3052,9 @@ class MetadataReader {
30573052
}
30583053
break;
30593054

3055+
case GenericParamKind::TypePack:
3056+
assert(false && "Packs not supported here yet");
3057+
30603058
default:
30613059
// We don't know about this kind of parameter.
30623060
return {};

0 commit comments

Comments
 (0)