SIL Serialization: seperate sil_index_block from sil_block.

Use generic layout for Lists and Offsets in sil_index_block. This will help
handling of VTable.

Records for VTable are added.


Swift SVN r9735
This commit is contained in:
Manman Ren
2013-10-28 22:27:23 +00:00
parent c9f73820ed
commit d38b1a1637
4 changed files with 51 additions and 22 deletions

View File

@@ -1073,12 +1073,11 @@ void SILSerializer::writeFuncTable() {
tableOffset = generator.Emit(blobStream);
}
unsigned abbrCode = SILAbbrCodes[FuncListLayout::Code];
FuncListLayout::emitRecord(Out, ScratchRecord, abbrCode, tableOffset,
hashTableBlob);
abbrCode = SILAbbrCodes[FuncOffsetLayout::Code];
FuncOffsetLayout::emitRecord(Out, ScratchRecord, abbrCode, Funcs);
sil_index_block::ListLayout List(Out);
sil_index_block::OffsetLayout Offset(Out);
List.emit(ScratchRecord, sil_index_block::SIL_FUNC_NAMES, tableOffset,
hashTableBlob);
Offset.emit(ScratchRecord, sil_index_block::SIL_FUNC_OFFSETS, Funcs);
}
void SILSerializer::writeAllSILFunctions(const SILModule *M) {
@@ -1097,6 +1096,9 @@ void SILSerializer::writeAllSILFunctions(const SILModule *M) {
registerSILAbbr<SILInstApplyLayout>();
registerSILAbbr<SILInstNoOperandLayout>();
registerSILAbbr<VTableLayout>();
registerSILAbbr<VTableEntryLayout>();
// Register the abbreviation codes so these layouts can exist in both
// decl blocks and sil blocks.
// We have to make sure BOUND_GENERIC_SUBSTITUTION does not overlap with
@@ -1117,8 +1119,6 @@ void SILSerializer::writeAllSILFunctions(const SILModule *M) {
}
{
BCBlockRAII restoreBlock(Out, SIL_INDEX_BLOCK_ID, 4);
registerSILAbbr<FuncListLayout>();
registerSILAbbr<FuncOffsetLayout>();
writeFuncTable();
}
}