LLVM API Documentation
#include <StreamableMemoryObject.h>
Public Member Functions | |
virtual | ~StreamableMemoryObject () |
Destructor - Override as necessary. | |
uint64_t | getBase () const override=0 |
uint64_t | getExtent () const override=0 |
int | readByte (uint64_t address, uint8_t *ptr) const override=0 |
int | readBytes (uint64_t address, uint64_t size, uint8_t *buf) const override=0 |
virtual const uint8_t * | getPointer (uint64_t address, uint64_t size) const =0 |
virtual bool | isValidAddress (uint64_t address) const =0 |
virtual bool | isObjectEnd (uint64_t address) const =0 |
StreamableMemoryObject - Interface to data which might be streamed. Streamability has 2 important implications/restrictions. First, the data might not yet exist in memory when the request is made. This just means that readByte/readBytes might have to block or do some work to get it. More significantly, the exact size of the object might not be known until it has all been fetched. This means that to return the right result, getExtent must also wait for all the data to arrive; therefore it should not be called on objects which are actually streamed (this would defeat the purpose of streaming). Instead, isValidAddress and isObjectEnd can be used to test addresses without knowing the exact size of the stream. Finally, getPointer can be used instead of readBytes to avoid extra copying.
Definition at line 35 of file StreamableMemoryObject.h.
llvm::StreamableMemoryObject::~StreamableMemoryObject | ( | ) | [virtual] |
Destructor - Override as necessary.
Definition at line 133 of file StreamableMemoryObject.cpp.
uint64_t llvm::StreamableMemoryObject::getBase | ( | ) | const [override, pure virtual] |
getBase - Returns the lowest valid address in the region.
Implements llvm::MemoryObject.
Implemented in llvm::StreamingMemoryObject.
uint64_t llvm::StreamableMemoryObject::getExtent | ( | ) | const [override, pure virtual] |
getExtent - Returns the size of the region in bytes. (The region is contiguous, so the highest valid address of the region is getBase() + getExtent() - 1). May block until all bytes in the stream have been read
Implements llvm::MemoryObject.
Implemented in llvm::StreamingMemoryObject.
Referenced by llvm::BitstreamCursor::readRecord(), and llvm::BitstreamCursor::skipRecord().
virtual const uint8_t* llvm::StreamableMemoryObject::getPointer | ( | uint64_t | address, |
uint64_t | size | ||
) | const [pure virtual] |
getPointer - Ensures that the requested data is in memory, and returns A pointer to it. More efficient than using readBytes if the data is already in memory. May block until (address - base + size) bytes have been read
address | - address of the byte, in the same space as getBase() |
size | - amount of data that must be available on return |
Implemented in llvm::StreamingMemoryObject.
Referenced by llvm::BitstreamCursor::readRecord().
virtual bool llvm::StreamableMemoryObject::isObjectEnd | ( | uint64_t | address | ) | const [pure virtual] |
isObjectEnd - Returns true if the address is one past the end of the object (i.e. if it is equal to base + extent) May block until (address - base) bytes have been read
address | - address of the byte, in the same space as getBase() |
Implemented in llvm::StreamingMemoryObject.
Referenced by llvm::BitstreamCursor::isEndPos().
virtual bool llvm::StreamableMemoryObject::isValidAddress | ( | uint64_t | address | ) | const [pure virtual] |
isValidAddress - Returns true if the address is within the object (i.e. between base and base + extent - 1 inclusive) May block until (address - base) bytes have been read
address | - address of the byte, in the same space as getBase() |
Implemented in llvm::StreamingMemoryObject.
Referenced by llvm::BitstreamCursor::canSkipToPos().
int llvm::StreamableMemoryObject::readByte | ( | uint64_t | address, |
uint8_t * | ptr | ||
) | const [override, pure virtual] |
readByte - Tries to read a single byte from the region. May block until (address - base) bytes have been read
address | - The address of the byte, in the same space as getBase(). |
ptr | - A pointer to a byte to be filled in. Must be non-NULL. |
Implements llvm::MemoryObject.
Implemented in llvm::StreamingMemoryObject.
int llvm::StreamableMemoryObject::readBytes | ( | uint64_t | address, |
uint64_t | size, | ||
uint8_t * | buf | ||
) | const [override, pure virtual] |
readBytes - Tries to read a contiguous range of bytes from the region, up to the end of the region. May block until (address - base + size) bytes have been read. Additionally, StreamableMemoryObjects will not do partial reads - if size bytes cannot be read, readBytes will fail.
address | - The address of the first byte, in the same space as getBase(). |
size | - The number of bytes to copy. |
buf | - A pointer to a buffer to be filled in. Must be non-NULL and large enough to hold size bytes. |
Reimplemented from llvm::MemoryObject.
Implemented in llvm::StreamingMemoryObject.
Referenced by llvm::BitstreamCursor::getWord(), and llvm::BitstreamCursor::Read().