LLVM API Documentation

Public Member Functions
llvm::StreamableMemoryObject Class Reference

#include <StreamableMemoryObject.h>

Inheritance diagram for llvm::StreamableMemoryObject:
Inheritance graph
[legend]
Collaboration diagram for llvm::StreamableMemoryObject:
Collaboration graph
[legend]

List of all members.

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

Detailed Description

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.


Constructor & Destructor Documentation

Destructor - Override as necessary.

Definition at line 133 of file StreamableMemoryObject.cpp.


Member Function Documentation

uint64_t llvm::StreamableMemoryObject::getBase ( ) const [override, pure virtual]

getBase - Returns the lowest valid address in the region.

Returns:
- The lowest valid address.

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

Returns:
- The size of the region.

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

Parameters:
address- address of the byte, in the same space as getBase()
size- amount of data that must be available on return
Returns:
- valid pointer to the requested data

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

Parameters:
address- address of the byte, in the same space as getBase()
Returns:
- true if the address is equal to base + extent

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

Parameters:
address- address of the byte, in the same space as getBase()
Returns:
- true if the address may be read with readByte()

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

Parameters:
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.
Returns:
- 0 if successful; -1 if not. Failure may be due to a bounds violation or an implementation-specific error.

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.

Parameters:
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.
Returns:
- 0 if successful; -1 if not. Failure may be due to a bounds violation or an implementation-specific error.

Reimplemented from llvm::MemoryObject.

Implemented in llvm::StreamingMemoryObject.

Referenced by llvm::BitstreamCursor::getWord(), and llvm::BitstreamCursor::Read().


The documentation for this class was generated from the following files: