Files
swift-mirror/include/swift/Serialization/SerializedSILLoader.h
Manman Ren b2bd2e9f8d SIL Serialization: handle SILVTable.
We add two records in sil_block to specify a Vtable and its entry list. Two
records are also added in sil_index_block for mapping from name to ID and
from ID to bit offset.

Two functions are added to SerializedSILLoader: to look up a specific VTable
given the class name or to deserialize all VTables in all SILModules. The latter
is mostly used for testing.

We serialize a VTable if the class is fragile and deserialize it via
SerializedSILLoader::lookupVTable.


Swift SVN r9746
2013-10-28 23:38:48 +00:00

52 lines
1.7 KiB
C++

//===--- SerializedSILLoader.h - Handle SIL section in modules --*- c++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_SERIALIZATION_SILLOADER_H
#define SWIFT_SERIALIZATION_SILLOADER_H
namespace swift {
class ASTContext;
class SILDeserializer;
class SILFunction;
class SILModule;
class SILVTable;
/// Maintains a list of SILDeserializer, one for each serialized modules
/// in ASTContext. It provides lookupSILFunction that will perform lookup
/// on each SILDeserializer.
class SerializedSILLoader {
private:
std::vector<std::unique_ptr<SILDeserializer> > LoadedSILSections;
explicit SerializedSILLoader(ASTContext &ctx, SILModule *SILMod);
public:
static SerializedSILLoader *create(ASTContext &ctx, SILModule *SILMod) {
return new SerializedSILLoader(ctx, SILMod);
}
SILFunction *lookupSILFunction(SILFunction *Callee);
SILVTable *lookupVTable(Identifier Name);
/// Deserialize all VTables in all SILModules.
void getAllVTables();
~SerializedSILLoader();
SerializedSILLoader(const SerializedSILLoader &) = delete;
SerializedSILLoader(SerializedSILLoader &&) = delete;
SerializedSILLoader &operator=(const SerializedSILLoader &) = delete;
SerializedSILLoader &operator=(SerializedSILLoader &&) = delete;
};
} // end namespace swift
#endif