File tree Expand file tree Collapse file tree 3 files changed +58
-5
lines changed Expand file tree Collapse file tree 3 files changed +58
-5
lines changed Original file line number Diff line number Diff line change @@ -856,6 +856,8 @@ void Serializer::writeBlockInfoBlock() {
856
856
BLOCK_RECORD (sil_index_block, SIL_DEFAULT_WITNESS_TABLE_NAMES);
857
857
BLOCK_RECORD (sil_index_block, SIL_DEFAULT_WITNESS_TABLE_OFFSETS);
858
858
BLOCK_RECORD (sil_index_block, SIL_PROPERTY_OFFSETS);
859
+ BLOCK_RECORD (sil_index_block, SIL_DIFFERENTIABILITY_WITNESS_NAMES);
860
+ BLOCK_RECORD (sil_index_block, SIL_DIFFERENTIABILITY_WITNESS_OFFSETS);
859
861
860
862
#undef BLOCK
861
863
#undef BLOCK_RECORD
Original file line number Diff line number Diff line change @@ -2345,6 +2345,11 @@ void SILSerializer::writeIndexTables() {
2345
2345
DefaultWitnessTableOffset);
2346
2346
}
2347
2347
2348
+ if (!PropertyOffset.empty ()) {
2349
+ Offset.emit (ScratchRecord, sil_index_block::SIL_PROPERTY_OFFSETS,
2350
+ PropertyOffset);
2351
+ }
2352
+
2348
2353
if (!DifferentiabilityWitnessList.empty ()) {
2349
2354
writeIndexTable (S, List,
2350
2355
sil_index_block::SIL_DIFFERENTIABILITY_WITNESS_NAMES,
@@ -2354,11 +2359,6 @@ void SILSerializer::writeIndexTables() {
2354
2359
DifferentiabilityWitnessOffset);
2355
2360
}
2356
2361
2357
- if (!PropertyOffset.empty ()) {
2358
- Offset.emit (ScratchRecord, sil_index_block::SIL_PROPERTY_OFFSETS,
2359
- PropertyOffset);
2360
- }
2361
-
2362
2362
}
2363
2363
2364
2364
void SILSerializer::writeSILGlobalVar (const SILGlobalVariable &g) {
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+
3
+ // Ensure that serialized sib can be deserialized correctly assuming
4
+ // contents of SIL_INDEX_BLOCK are sorted by their ids
5
+ // RUN: %target-swift-frontend -emit-sib %s -module-name test -o %t/test.sib
6
+ // RUN: %target-swift-frontend -emit-sil %t/test.sib -module-name test
7
+ // CHECK-DAG: sil_vtable
8
+ // CHECK-DAG: sil_global
9
+ // CHECK-DAG: sil_witness_table
10
+ // CHECK-DAG: sil_default_witness_table
11
+ // CHECK-DAG: sil_property
12
+
13
+ sil_stage canonical
14
+
15
+ import Builtin
16
+ import Swift
17
+
18
+ // For SIL_FUNC_NAMES
19
+ sil @id : $@convention(thin) (Float) -> Float {
20
+ bb0(%0 : $Float):
21
+ return %0 : $Float
22
+ }
23
+
24
+
25
+ // For SIL_VTABLE_NAMES
26
+ class C {}
27
+ sil_vtable C {}
28
+
29
+ // For SIL_GLOBALVAR_NAMES
30
+ sil_global @x : $Int
31
+
32
+ // For SIL_WITNESS_TABLE_NAMES
33
+ protocol P1 {}
34
+ struct S : P1 {}
35
+
36
+ sil_witness_table S: P1 module test {}
37
+
38
+ // For SIL_DEFAULT_WITNESS_TABLE_NAMES
39
+ protocol P2 {}
40
+ sil_default_witness_table P2 {}
41
+
42
+ // For SIL_PROPERTY_OFFSETS
43
+ struct A {
44
+ var a: Int
45
+ }
46
+
47
+ sil_property #A.a ()
48
+
49
+ // For SIL_DIFFERENTIABILITY_WITNESS_NAMES
50
+ sil_differentiability_witness [parameters 0] [results 0] @id : $@convention(thin) (Float) -> Float {}
51
+
You can’t perform that action at this time.
0 commit comments