Skip to content

Commit 714e9c5

Browse files
authored
Merge pull request #18648 from slavapestov/serialize-new-function-representation
Serialize new function type representation
2 parents 97cb87e + 728e97c commit 714e9c5

File tree

4 files changed

+164
-211
lines changed

4 files changed

+164
-211
lines changed

include/swift/Serialization/DeclTypeRecordNodes.def

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ TYPE(PAREN)
8686
TYPE(TUPLE)
8787
TRAILING_INFO(TUPLE_TYPE_ELT)
8888
TYPE(FUNCTION)
89+
TRAILING_INFO(FUNCTION_PARAM)
8990
TYPE(METATYPE)
90-
TYPE(INOUT)
9191
TYPE(ARCHETYPE)
9292
TYPE(PROTOCOL_COMPOSITION)
9393
TYPE(BOUND_GENERIC)
@@ -99,7 +99,6 @@ TYPE(REFERENCE_STORAGE)
9999
TYPE(UNBOUND_GENERIC)
100100
TYPE(OPTIONAL)
101101
TYPE(SIL_FUNCTION)
102-
TYPE(UNCHECKED_OPTIONAL)
103102
TYPE(DYNAMIC_SELF)
104103
TYPE(OPENED_EXISTENTIAL)
105104
TYPE(EXISTENTIAL_METATYPE)

include/swift/Serialization/ModuleFormat.h

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const uint16_t VERSION_MAJOR = 0;
5555
/// describe what change you made. The content of this comment isn't important;
5656
/// it just ensures a conflict if two people change the module format.
5757
/// Don't worry about adhering to the 80-column limit for this line.
58-
const uint16_t VERSION_MINOR = 433; // Last change: GenericTypeParamDecl doesn't need a DC
58+
const uint16_t VERSION_MINOR = 435; // Last change: serialize new-style function parameters
5959

6060
using DeclIDField = BCFixed<31>;
6161

@@ -706,11 +706,7 @@ namespace decls_block {
706706

707707
using ParenTypeLayout = BCRecordLayout<
708708
PAREN_TYPE,
709-
TypeIDField, // inner type
710-
BCFixed<1>, // vararg?
711-
BCFixed<1>, // autoclosure?
712-
BCFixed<1>, // escaping?
713-
ValueOwnershipField // inout, shared or owned?
709+
TypeIDField // inner type
714710
>;
715711

716712
using TupleTypeLayout = BCRecordLayout<
@@ -720,21 +716,28 @@ namespace decls_block {
720716
using TupleTypeEltLayout = BCRecordLayout<
721717
TUPLE_TYPE_ELT,
722718
IdentifierIDField, // name
723-
TypeIDField, // type
724-
BCFixed<1>, // vararg?
725-
BCFixed<1>, // autoclosure?
726-
BCFixed<1>, // escaping?
727-
ValueOwnershipField // inout, shared or owned?
719+
TypeIDField // type
728720
>;
729721

730722
using FunctionTypeLayout = BCRecordLayout<
731723
FUNCTION_TYPE,
732-
TypeIDField, // input
733724
TypeIDField, // output
734725
FunctionTypeRepresentationField, // representation
735726
BCFixed<1>, // auto-closure?
736727
BCFixed<1>, // noescape?
737728
BCFixed<1> // throws?
729+
730+
// trailed by parameters
731+
>;
732+
733+
using FunctionParamLayout = BCRecordLayout<
734+
FUNCTION_PARAM,
735+
IdentifierIDField, // name
736+
TypeIDField, // type
737+
BCFixed<1>, // vararg?
738+
BCFixed<1>, // autoclosure?
739+
BCFixed<1>, // escaping?
740+
ValueOwnershipField // inout, shared or owned?
738741
>;
739742

740743
using MetatypeTypeLayout = BCRecordLayout<
@@ -749,11 +752,6 @@ namespace decls_block {
749752
MetatypeRepresentationField // representation
750753
>;
751754

752-
using InOutTypeLayout = BCRecordLayout<
753-
INOUT_TYPE,
754-
TypeIDField // object type
755-
>;
756-
757755
using ArchetypeTypeLayout = BCRecordLayout<
758756
ARCHETYPE_TYPE,
759757
GenericEnvironmentIDField, // generic environment
@@ -785,11 +783,12 @@ namespace decls_block {
785783

786784
using GenericFunctionTypeLayout = BCRecordLayout<
787785
GENERIC_FUNCTION_TYPE,
788-
TypeIDField, // input
789786
TypeIDField, // output
790787
FunctionTypeRepresentationField, // representation
791788
BCFixed<1>, // throws?
792789
GenericSignatureIDField // generic signture
790+
791+
// trailed by parameters
793792
>;
794793

795794
using SILFunctionTypeLayout = BCRecordLayout<
@@ -965,7 +964,6 @@ namespace decls_block {
965964
BCFixed<1>, // throws?
966965
CtorInitializerKindField, // initializer kind
967966
GenericEnvironmentIDField, // generic environment
968-
TypeIDField, // interface type
969967
DeclIDField, // overridden decl
970968
AccessLevelField, // access level
971969
BCFixed<1>, // requires a new vtable slot
@@ -1024,7 +1022,7 @@ namespace decls_block {
10241022
BCFixed<1>, // has forced static dispatch?
10251023
BCFixed<1>, // throws?
10261024
GenericEnvironmentIDField, // generic environment
1027-
TypeIDField, // interface type
1025+
TypeIDField, // result interface type
10281026
DeclIDField, // operator decl
10291027
DeclIDField, // overridden function
10301028
BCVBR<5>, // 0 for a simple name, otherwise the number of parameter name
@@ -1053,7 +1051,7 @@ namespace decls_block {
10531051
BCFixed<1>, // has forced static dispatch?
10541052
BCFixed<1>, // throws?
10551053
GenericEnvironmentIDField, // generic environment
1056-
TypeIDField, // interface type
1054+
TypeIDField, // result interface type
10571055
DeclIDField, // overridden function
10581056
DeclIDField, // AccessorStorageDecl
10591057
AccessorKindField, // accessor kind
@@ -1110,7 +1108,6 @@ namespace decls_block {
11101108
using EnumElementLayout = BCRecordLayout<
11111109
ENUM_ELEMENT_DECL,
11121110
DeclContextIDField,// context decl
1113-
TypeIDField, // interface type
11141111
BCFixed<1>, // implicit?
11151112
BCFixed<1>, // has payload?
11161113
EnumElementRawValueKindField, // raw value kind
@@ -1136,7 +1133,7 @@ namespace decls_block {
11361133
ReadWriteImplKindField, // read-write implementation
11371134
AccessorCountField, // number of accessors
11381135
GenericEnvironmentIDField, // generic environment
1139-
TypeIDField, // interface type
1136+
TypeIDField, // element interface type
11401137
DeclIDField, // overridden decl
11411138
AccessLevelField, // access level
11421139
AccessLevelField, // setter access, if applicable
@@ -1167,9 +1164,7 @@ namespace decls_block {
11671164
DeclContextIDField, // context decl
11681165
BCFixed<1>, // implicit?
11691166
BCFixed<1>, // objc?
1170-
GenericEnvironmentIDField, // generic environment
1171-
TypeIDField // interface type
1172-
// Trailed by a pattern for self.
1167+
GenericEnvironmentIDField // generic environment
11731168
>;
11741169

11751170
using ParameterListLayout = BCRecordLayout<
@@ -1257,8 +1252,8 @@ namespace decls_block {
12571252
using GenericRequirementLayout = BCRecordLayout<
12581253
GENERIC_REQUIREMENT,
12591254
GenericRequirementKindField, // requirement kind
1260-
TypeIDField, // types involved (two for conformance,
1261-
TypeIDField // same-type; one for value witness marker)
1255+
TypeIDField, // subject type
1256+
TypeIDField // constraint type
12621257
>;
12631258

12641259
using LayoutRequirementLayout = BCRecordLayout<

0 commit comments

Comments
 (0)