[Serialization] Serialize Differentiability WT index sorted

When there are sil_property and sil_differentiability_witness at once,
serialized file couldn't be deserialized because it's index table is
serialized un-sortedly but deserializer assumes that contents of table
index are sorted.

This patch fixes the un-sorted serialization and adds test case to
ensure that table index contents can be deserialized
This commit is contained in:
Yuta Saito
2020-08-06 00:47:43 +09:00
parent d3f0de804d
commit d913e57d84
3 changed files with 58 additions and 5 deletions

View File

@@ -2346,6 +2346,11 @@ void SILSerializer::writeIndexTables() {
DefaultWitnessTableOffset);
}
if (!PropertyOffset.empty()) {
Offset.emit(ScratchRecord, sil_index_block::SIL_PROPERTY_OFFSETS,
PropertyOffset);
}
if (!DifferentiabilityWitnessList.empty()) {
writeIndexTable(S, List,
sil_index_block::SIL_DIFFERENTIABILITY_WITNESS_NAMES,
@@ -2355,11 +2360,6 @@ void SILSerializer::writeIndexTables() {
DifferentiabilityWitnessOffset);
}
if (!PropertyOffset.empty()) {
Offset.emit(ScratchRecord, sil_index_block::SIL_PROPERTY_OFFSETS,
PropertyOffset);
}
}
void SILSerializer::writeSILGlobalVar(const SILGlobalVariable &g) {