32 GlobalsStream::GlobalsStream(std::unique_ptr<MappedBlockStream> Stream)
33 : Stream(
std::move(Stream)) {}
39 if (
auto E = GlobalsTable.
read(Reader))
46 return make_error<RawError>(
48 "Encountered unsupported globals stream version.");
57 "Stream does not contain a GSIHashHeader.");
60 return make_error<RawError>(
62 "GSIHashHeader signature (0xffffffff) not found.");
77 "Invalid HR array size.");
79 if (
auto EC = Reader.
readArray(HashRecords, NumHashRecords))
82 "Error reading hash records."));
97 uint32_t NumBitmapEntries = BitmapSizeInBits / 8;
98 if (
auto EC = Reader.
readBytes(HashBitmap, NumBitmapEntries))
101 "Could not read a bitmap."));
103 for (uint8_t
B : HashBitmap)
107 if (
auto EC = Reader.
readArray(HashBuckets, NumBuckets))
110 "Hash buckets corrupted."));
120 if (HashHdr->HrSize > 0)
static Error readGSIHashBuckets(FixedStreamArray< support::ulittle32_t > &HashBuckets, ArrayRef< uint8_t > &HashBitmap, const GSIHashHeader *HashHdr, BinaryStreamReader &Reader)
Compute iterated dominance frontiers using a linear time algorithm.
Error readObject(const T *&Dest)
Get a pointer to an object of type T from the underlying stream, as if by memcpy, and store the resul...
uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Alig...
static Error checkHashHdrVersion(const GSIHashHeader *HashHdr)
Error read(BinaryStreamReader &Reader)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static Error readGSIHashRecords(FixedStreamArray< PSHashRecord > &HashRecords, const GSIHashHeader *HashHdr, BinaryStreamReader &Reader)
static ErrorSuccess success()
Create a success value.
unsigned countPopulation(T Value)
Count the number of set bits in a value.
static Error readGSIHashHeader(const GSIHashHeader *&HashHdr, BinaryStreamReader &Reader)
Error readBytes(ArrayRef< uint8_t > &Buffer, uint32_t Size)
Read Size bytes from the underlying stream at the current offset and and set Buffer to the resulting ...
Error joinErrors(Error E1, Error E2)
Concatenate errors.
Lightweight error class with error context and mandatory checking.
Provides read only access to a subclass of BinaryStream.
Error readArray(ArrayRef< T > &Array, uint32_t NumElements)
Get a reference to a NumElements element array of objects of type T from the underlying stream as if ...