Library Support¶
This section contains definitions declared in the chpl::libraries namespace.
-
namespace chpl::libraries¶
-
Variables
-
static const uint64_t FILE_HEADER_MAGIC = 0x4c50484342494c7f¶
-
static const uint64_t MODULE_SECTION_MAGIC = 0x4d4dd01e5ec14d4d¶
-
static const uint64_t SYMBOL_TABLE_MAGIC = 0x4d59531e5ec110e0¶
-
static const uint64_t UAST_SECTION_MAGIC = 0x5453411e5ec110e0¶
-
static const uint32_t LONG_STRINGS_TABLE_MAGIC = 0x52545301¶
-
static const uint64_t LOCATION_SECTION_MAGIC = 0x434F4C075ec110e0¶
-
static const uint64_t GEN_CODE_SECTION_MAGIC = 0x4e4547075ec110e0¶
-
static const uint32_t FORMAT_VERSION_MAJOR = 0¶
-
static const uint32_t FORMAT_VERSION_MINOR = 1¶
-
static const int HASH_SIZE = 256 / 8¶
-
static const int MAX_NUM_MODULES = 100000000¶
-
static const int MAX_NUM_SYMBOLS = 100000000¶
-
static const int MAX_NUM_FILES = 100000000¶
-
static const int MAX_NUM_ASTS = 100000000¶
-
struct AstSectionHeader¶
-
struct FileHeader¶
-
struct GenCodeSectionHeader¶
-
class LibraryFile¶
- #include <LibraryFile.h>
For reading a .dyno LibraryFile. Some data is read from the file on-demand. Uses
mmap
to keep the code simple and to support random-access well.Public Functions
-
~LibraryFile()¶
-
bool operator==(const LibraryFile &other) const¶
-
inline bool operator!=(const LibraryFile &other) const¶
-
size_t hash()¶
-
void stringify(std::ostream &ss, chpl::StringifyKind stringKind) const¶
-
void registerLibrary(Context *context) const¶
Register all of the paths supported by this library so that attempts to load a module contained in the library will use the library version.
-
std::vector<UniqueString> containedFilePaths() const¶
Returns a vector containing the paths stored in this module.
-
const uast::BuilderResult &loadSourceAst(Context *context, UniqueString fromSourcePath) const¶
Load uAST from this LibraryFile for a particular source path.
-
const uast::Module *loadModuleAst(Context *context, UniqueString moduleSymPath) const¶
Load uAST from a this LibraryFile for a particular module path. For a toplevel module, the module path is just the module name. For a submodule M of a parent module P, it would be P.M.
Returns nullptr if no such module is found in this LibraryFile or if an error occurred.
-
const LocationMaps &loadLocations(Context *context, int moduleIndex, int symbolTableEntryIndex, const uast::AstNode *symbolTableEntryAst) const¶
Lookup the location for an Ast node stored in this library file. Assumes that ‘ast’ is stored within the Locations section found from module ‘moduleIndex’ and symbol entry ‘symbolTableEntryIndex’.
Public Static Functions
-
static bool update(owned<LibraryFile> &keep, owned<LibraryFile> &addin)¶
-
static const LibraryFile *load(Context *context, UniqueString libPath)¶
This query reads the file from the given path and produces a LibraryFile, which represents the contents of the library.
-
struct LocationMaps¶
- #include <LibraryFile.h>
Helper type to be returned by loadLocations
Public Static Functions
-
static bool update(LocationMaps &keep, LocationMaps &addin)¶
-
static bool update(LocationMaps &keep, LocationMaps &addin)¶
-
class ModuleSection¶
- #include <LibraryFile.h>
Helper object to represent a loaded Symbol Table from a module section.
Public Functions
-
inline bool operator==(const ModuleSection &other) const¶
-
inline bool operator!=(const ModuleSection &other) const¶
Public Static Functions
-
static inline bool update(owned<ModuleSection> &keep, owned<ModuleSection> &addin)¶
-
inline bool operator==(const ModuleSection &other) const¶
-
~LibraryFile()¶
-
class LibraryFileDeserializationHelper¶
- #include <LibraryFile.h>
Helper object to interact with the Deserializer to: read long strings from a LibraryFile strings table register deserialized AstNodes for symbol table objects
-
class LibraryFileSerializationHelper¶
- #include <LibraryFileWriter.h>
Helper object for registering serialized uAST positions during serialization
-
class LibraryFileWriter¶
- #include <LibraryFileWriter.h>
For writing a .dyno library file
Public Functions
-
inline LibraryFileWriter(Context *context, std::string outputFilePath)¶
Construct a LibraryFileWriter to output to ‘outputFilePath’
-
void setSourcePaths(std::vector<UniqueString> paths)¶
Parse the uAST for the provided source paths and save the result.
-
void setGeneratedCode(UniqueString modName, std::string buffer, std::unordered_map<ID, std::vector<GenInfo>> genMap)¶
Set the buffer storing the generated LLVM IR byte code for the top-level module with the passed name.
Must be done after ‘setSourcePaths’.
-
bool writeAllSections()¶
Write the header and sections to the library file. Returns ‘true’ if everything is OK, or ‘false’ if there was an error in the process.
Public Static Functions
-
static std::vector<UniqueString> gatherTopLevelModuleNames(Context *context, std::vector<UniqueString> paths)¶
Gather the names of the top-level modules in the source code files from ‘paths’
-
struct GenInfo¶
-
inline LibraryFileWriter(Context *context, std::string outputFilePath)¶
-
struct LocationSectionHeader¶
-
struct LongStringsTableHeader¶
-
struct ModuleHeader¶
-
struct Region¶
-
struct SymbolTableEntry¶
-
struct SymbolTableHeader¶
-
static const uint64_t FILE_HEADER_MAGIC = 0x4c50484342494c7f¶